Skip to content

Conversation

melisande-c
Copy link
Member

Description

Note

tldr: Pydantic BaseModel.model_dump function signature in 2.11 is not back compatible with 2.10. This PR sets the Pydantic lower bound version to 2.11 and bumps the upper bound to 2.12.

Background - why do we need this PR?

The reason we need this PR is because we override the model_dump method in the Configuration class. Pydantic 2.11 introduces a new fallback argument and also changes the type of by_alias to bool | None from bool. These were introduced in the PRs pydantic/pydantic#11398 and pydantic/pydantic#11468 respectively.

If we do not update the function signature mypy tells us that we have overridden the function in a way that is incompatible with the base class, if we do update the signature it is no longer compatible with Pydantic 2.10. I have updated the signature so we can continue to use newer versions of Pydantic.

Overview - what changed?

Updated pyproject.toml and Configuration.model_dump.

Breaking changes

This will cause the same backwards compatibility issue in CAREamics as Pydantic, but it should not break existing code.


Please ensure your PR meets the following requirements:

  • Code builds and passes tests locally, including doctests
  • New tests have been added (for bug fixes/features)
  • Pre-commit passes
  • PR to the documentation exists (for bug fixes / features)

@jdeschamps jdeschamps merged commit 063b610 into main May 5, 2025
16 of 18 checks passed
@jdeschamps jdeschamps deleted the mc/chore/bump-pydantic branch May 5, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants