Skip to content

Conversation

@tokebe
Copy link
Contributor

@tokebe tokebe commented May 6, 2025

This PR upgrades dependencies to bring reasoner-pydantic to pydantic v2. Changes:

  • Python minimum version bumped to 3.9
  • Pydantic minimum version bumped to 2
    • parse_obj() is replaced by model_validate()
    • Model.dict() is replaced by model_dump()
    • Validation now occurs by default on model construction, this can be avoided using model_construct() (not recommended)
    • Normalization on model creation now requires a validation context to disable (see docs/NORMALIZE.md)
    • LogLevel is now directly an enum and uses matching case (e.g. LogLevel.INFO)
  • Hashing is now deterministic without users having to set PYTHONHASHSEED
  • Minor changes to bring models in line with TRAPI 1.5

@uhbrar uhbrar self-requested a review May 6, 2025 17:29
@tokebe
Copy link
Contributor Author

tokebe commented May 30, 2025

Worthy of note: stable_hash() probably needs to be made more efficient-- in my testing using this PR for Retriever implementation it's called more than most other functions in the entire server (though not having much cumulative call time), and may be contributing to Result.model_validate() being slower than expected.

@maximusunc maximusunc marked this pull request as draft June 11, 2025 17:40
@maximusunc
Copy link
Collaborator

Could we move the stable_hash to a new PR? Seems like it's not quite ready for production, plus it seems out of scope of a bump to pydantic v2.

@tokebe
Copy link
Contributor Author

tokebe commented Jun 12, 2025

@maximusunc I've removed stable_hash from this PR.

@tokebe tokebe marked this pull request as ready for review June 12, 2025 16:52
@uhbrar
Copy link
Collaborator

uhbrar commented Jul 8, 2025

Without the stable hash, this looks good. As discussed, the plan is to rebase so we can resolve conflicts and merge this in.

@tokebe
Copy link
Contributor Author

tokebe commented Jul 15, 2025

Rebased to main, passes all tests on my local

@uhbrar
Copy link
Collaborator

uhbrar commented Jul 17, 2025

Looks like there are a few errors with imports in the tests. If we can get those fixed and run black, this should be good!

@uhbrar
Copy link
Collaborator

uhbrar commented Jul 17, 2025

Looks like typing.Self requires python >= 3.11.

@uhbrar uhbrar merged commit d44bd4f into TranslatorSRI:main Jul 17, 2025
2 checks passed
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.

3 participants