diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c1675b62..e0a7cb9b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,6 @@ jobs: - id: cache-rust name: cache rust uses: Swatinem/rust-cache@v2 - with: - key: coverage-v2 - run: cargo install rustfilt coverage-prepare if: steps.cache-rust.outputs.cache-hit != 'true' @@ -120,14 +118,49 @@ jobs: - name: cache rust uses: Swatinem/rust-cache@v2 + + - name: set up python + uses: actions/setup-python@v5 with: - key: ${{ matrix.os }}-v1 + python-version: '3.11' + + - run: pip install -r tests/requirements.txt + + - run: pip install -e . + env: + RUST_BACKTRACE: 1 + + - run: pip freeze + + - run: pytest + + - 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 . @@ -164,8 +197,6 @@ jobs: - name: cache rust uses: Swatinem/rust-cache@v2 - with: - key: test-debug - run: pip install -r tests/requirements.txt - run: make build-dev @@ -197,8 +228,6 @@ jobs: - name: cache rust uses: Swatinem/rust-cache@v2 - with: - key: test-pydantic-integration - name: install deps run: | diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 33497021f..332c6ae58 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -48,8 +48,6 @@ jobs: - name: cache rust uses: Swatinem/rust-cache@v2 - with: - key: v1 - name: Compile pydantic-core for profiling run: make build-profiling 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) } }