Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dokempf
Copy link
Contributor

@dokempf dokempf commented Oct 29, 2025

I am in the unfortunate situation that I am trying to wrap a tool for OCR-D, which requires pydantic >=2, whereas core currently asks for pydantic == 1.*. I went ahead and dropped the pin, then fixed the one failing unit test, as well as all deprecation warnings arising during execution of the test suite. Of course, this is only as good as the unit test suite, but at worst it serves as a basis for refinement. I would be very happy to see this change accepted, as requiring pydantic >=2 is not uncommon in the Python ecosystem these days.

@dokempf dokempf changed the title Fix all Pydantic v2 deprecation warnings and drop the pydentic v1.* pin Fix all Pydantic v2 deprecation warnings and drop the pydantic v1.* pin Oct 29, 2025
@dokempf
Copy link
Contributor Author

dokempf commented Oct 29, 2025

CI fails on the network integration tests that I had not previously run locally. It seems like it fails to validate the beanie Document DBWorkspace - stating that required properties are missing. Those missing are exactly the ones marked with Optional[].

@dokempf
Copy link
Contributor Author

dokempf commented Oct 29, 2025

I have now marked all those properties of pydantic/beanie models that use the Optional[] annotation with None as the default - which in my understanding should always be a safe bet if this was the correct type annotation to begin with. This fixes the network integration tests for me locally (let's see what CI has to say).

@kba kba requested a review from MehmedGIT October 30, 2025 09:51
Copy link
Contributor

@joschrew joschrew left a comment

Choose a reason for hiding this comment

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

I run some tests locally, for me this PR works. In my notes I wrote we pinned pydantic because in earlier days when we used python3.7 or 3.8 we needed/used beanie version 1.11 (don't know exactly why any more). But it produced error(s) with pydantic 2.* which wasn't pined/noticed by their developers so we pinned it

Copy link
Contributor

@MehmedGIT MehmedGIT left a comment

Choose a reason for hiding this comment

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

@dokempf, thanks for resolving this. I did some more testing locally with my ocrd_network setup, and everything runs fine.

Co-authored-by: Mehmed Mustafa <[email protected]>
@kba kba merged commit 935b28a into OCR-D:master Nov 25, 2025
17 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.

4 participants