Skip to content

Conversation

Viicos
Copy link
Member

@Viicos Viicos commented Feb 5, 2025

Change Summary

Closes #11381.

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Feb 5, 2025
Copy link

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1cd0bc2
Status: ✅  Deploy successful!
Preview URL: https://4823e9d6.pydantic-docs.pages.dev
Branch Preview URL: https://fallback.pydantic-docs.pages.dev

View logs

Copy link

codspeed-hq bot commented Feb 5, 2025

CodSpeed Performance Report

Merging #11398 will not alter performance

Comparing fallback (1cd0bc2) with main (929e8f4)

Summary

✅ 45 untouched benchmarks

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  type_adapter.py
Project Total  

This report was generated by python-coverage-comment-action

@Viicos Viicos requested a review from samuelcolvin February 5, 2025 14:50
Copy link
Contributor

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superb and simple :)

@Viicos Viicos merged commit cb9f5a0 into main Feb 7, 2025
56 checks passed
@Viicos Viicos deleted the fallback branch February 7, 2025 17:11
jdeschamps added a commit to CAREamics/careamics that referenced this pull request May 5, 2025
…#465)

## Description

<!-- This section provides the necessary background and information for
reviewers to
understand the code and have the correct mindset when examining changes.
-->

> [!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:**

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

Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-fix Used for bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support for fallback method to serialize unknown types
2 participants