Skip to content

Conversation

@ghmeier
Copy link

@ghmeier ghmeier commented Nov 26, 2025

Description

As of python 3.14, pydantic>=2.0.0 does not work with the pydantic.v1 namespace. While trying to fix this same issue for spaCy (explosion/spaCy#13895), I ran into this library also throwing errors from the old pydantic version.

To fix this without a major version upgrade, I added some conditional model definitions where necessary. I think this approach is fairly safe since pydantic appears to only be used internally to validate configuration so you shouldn't have to worry about any other packages calling deprecated pydantic model functions. I saw a similar pattern from one of y'alls other repos here: explosion/confection#31

The main pydantic breaking changes impacting this repo are pretty straightforward, just changing root_validator to model_validator, altering the model configration to use a dictionary, and swapping to pattern over regex for string fields.

I've also updated CI to test against python 3.14.

On my own, I've run tests against back to python 3.8 with pydantic==1.7.4.

Types of change

Bug fix - the package is broken on python 3.14 and breaks any upstream packages that attempt to use python 3.14.

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the test suite, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

As of python 3.14, pydantic>=2.0.0 does not work with the pydantic.v1
namespace. To fix this without a major version upgrade, I added
some conditional model definitions where necessary.

The main breaking changes impacting this repo are pretty straightforward,
just changing root_validator to model_validator, altering the model configration
to use a dictionary, and swapping to pattern over regex for string fields.

I've also updated CI to test against python 3.14.
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.

1 participant