fix: handle both pydantic version 1 and 2 to support python 3.14
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 (https://github.com/explosion/spaCy/issues/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: https://github.com/explosion/confection/pull/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
- [x] I confirm that I have the right to submit this contribution under the project's MIT license.
- [x] I ran the test suite, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.