diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edf20696e..394837c6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,6 +140,43 @@ jobs: - run: cargo test + test-msrv: + name: test MSRV + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: set up python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: resolve MSRV + id: resolve-msrv + run: + echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT + + - name: install rust MSRV + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ steps.resolve-msrv.outputs.MSRV }} + + - name: cache rust + uses: Swatinem/rust-cache@v2 + + - run: pip install -r tests/requirements.txt + + - run: pip install -e . + env: + RUST_BACKTRACE: 1 + + - run: pip freeze + + - run: pytest + + - run: cargo test + # test with a debug build as it picks up errors which optimised release builds do not test-debug: name: test-debug ${{ matrix.python-version }} diff --git a/Cargo.toml b/Cargo.toml index 47b9d784c..7ba4759da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ include = [ "!tests/.pytest_cache", "!*.so", ] +rust-version = "1.70" [dependencies] pyo3 = { version = "0.20.2", features = ["generate-import-lib", "num-bigint"] } diff --git a/src/serializers/fields.rs b/src/serializers/fields.rs index c57729c46..4d192d344 100644 --- a/src/serializers/fields.rs +++ b/src/serializers/fields.rs @@ -147,7 +147,7 @@ impl GeneralFieldsSerializer { } } - pub fn main_to_python<'py>( + pub(crate) fn main_to_python<'py>( &self, py: Python<'py>, main_iter: impl Iterator>, @@ -212,7 +212,7 @@ impl GeneralFieldsSerializer { } } - pub fn main_serde_serialize<'py, S: serde::ser::Serializer>( + pub(crate) fn main_serde_serialize<'py, S: serde::ser::Serializer>( &self, main_iter: impl Iterator>, expected_len: usize, @@ -258,7 +258,7 @@ impl GeneralFieldsSerializer { Ok(map) } - pub fn add_computed_fields_python( + pub(crate) fn add_computed_fields_python( &self, model: Option<&PyAny>, output_dict: &PyDict, @@ -275,7 +275,7 @@ impl GeneralFieldsSerializer { Ok(()) } - pub fn add_computed_fields_json( + pub(crate) fn add_computed_fields_json( &self, model: Option<&PyAny>, map: &mut S::SerializeMap, @@ -291,7 +291,7 @@ impl GeneralFieldsSerializer { Ok(()) } - pub fn computed_field_count(&self) -> usize { + pub(crate) fn computed_field_count(&self) -> usize { option_length!(self.computed_fields) } }