pydantic v2 support
Closed this issue · 9 comments
Is your feature request related to a problem? Please describe.
pydantic v2 is released, but this project has an upper bound on pydantic<2.0.
This leads to incompatibilities with other dependencies. Plus, pydantic v2 is faster than v1, therefore a migration is a good idea.
Describe the solution you'd like
Support either v1 and v2 or migrate fully to v2, depending on the complexity of migration.
Note that supporting both versions at the same time would be cumbersome, due to many deprecations in v2.
This also requires bumping email-validator to v2 and due to that dropping support for Python 3.6
Describe alternatives you've considered
Additional context
A simpler alternative for removing the upper bound (pydantic<2
) without moving to the new API: https://docs.pydantic.dev/2.0/migration/#continue-using-pydantic-v1-features
@anancarv are you open towards this solution?
@sigma67 I hope @anancarv is ok with that, but i forked and refactored entirely the current code to use pydantic2 and python 3.9+ features. Included all copyrights, of course.
Right now one test is failing (disabled) and i have 3 mypy errors that are mypy only, but pydantic passes ok.
Is here https://github.com/heliocastro/python-artifactory
Hey @sigma67 @heliocastro ,
Sorry for the delay. I don't mind for the fork @heliocastro . However, if you want to, I would be glad to integrate your changes in the current project. I've seen that you've closed your PR, you can re-open it and I'll review it. Just keep in mind that this is a breaking change, so it will probably released on the next major version 2.0.0
.
I made huge modifications top bottom, so when i finish i will come back to here and you decide how it goes.
Anyway, you can see all in my repo for now.
Thanks for answering @anancarv
@heliocastro do you have a working state on one of the earlier commits like heliocastro@bbbc6ad ? Perhaps we could merge that now to avoid one huge PR?
I basically done, with a single addition on download, the ability to flat download.
What i did:
- Limited to python 3.10+ otherwise will use old features in code
- Add proper licensing header on all files
- Entire refactor from the source structure to linting to github test workflow
- Removed objects.py and made individual files under object folders
- Adapt most of the things to Pydantic2
- Removed bandit and moved to Ruff, add tons of checks
- Moved the coverage report to coveralls
- Added more entries to pre-commit, including commitlint ( conventional-commits )
- Moved the the "list" functions to different naming due shadowing python builtins
- Removed all deprecated functions
- Changed master branch to main main
- Tagged v2.0.0 :-)
I had two days to make it work to my project in my company, so a took the YakShaving too seriously.
Up to you what to do. I really hope you. find some use of it
Here now: https://github.com/heliocastro/python-artifactory/actions/runs/6198530723
( ps. deploy workflow is disabled, i only deployed in my internal artifactory for our use)
Awesome, shall I submit a PR based on it? Feel free to do so yourself!
Released