Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow pydantic v2 usage #15

Merged
merged 2 commits into from
Jul 20, 2024
Merged

Conversation

cfbevan
Copy link
Contributor

@cfbevan cfbevan commented Jul 5, 2024

  • feat: start migration to pydantic v2
  • update tests for pydantic v2

Followed https://docs.pydantic.dev/latest/migration/#using-pydantic-v1-features-in-a-v1v2-environment

Note that current documentation references a CONTRIBUTING.md that does not exist. The GitHub Pages site encourages reaching out for instructions on contributing, but no contact information is listed. Please feel free to comment on any changes needed.

* feat: start migration to pydantic v2
* update tests for pydantic v2
Copy link
Owner

@nadobando nadobando left a comment

Choose a reason for hiding this comment

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

gr8 initiative @cfbevan

@@ -100,7 +100,7 @@ version = "0.2.1"
[tool.poetry.dependencies]
aioarango = "^1.0.0"
indexed = "^1.3.0"
pydantic = "==1.10.12"
pydantic = ">=1.10.17"
Copy link
Owner

Choose a reason for hiding this comment

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

maybe we can already set this to

Suggested change
pydantic = ">=1.10.17"
pydantic = "<2"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The documentation claims that the v1 modules were not added till 1.10.17. Another option is to update the imports to something like this:

try:
    from pydantic.v1.fields import ModelField
except ImportError:
    from pydantic.fields import ModelField 

@cfbevan
Copy link
Contributor Author

cfbevan commented Jul 15, 2024

I'm a bit confused by the CI checks. They ran locally fine. I will take a look at the errors and update as needed.

@cfbevan
Copy link
Contributor Author

cfbevan commented Jul 15, 2024

I see my issue. The CI/CD uses 3.9 and I was using 3.11 locally.

- Fix issues raised in ci/cd for nadobando#15 that came from testing with python
  3.11 locally instead of python 3.9
@cfbevan
Copy link
Contributor Author

cfbevan commented Jul 20, 2024

All tests passed. There is something wrong with the tokens.

@nadobando
Copy link
Owner

nadobando commented Jul 20, 2024

CI / Tests is failing because of the token permissions, I'll will merge and open an issue :)
thanks for you sharing

@nadobando nadobando merged commit 62d50a9 into nadobando:main Jul 20, 2024
3 of 4 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.

None yet

2 participants