Skip to content

support pydantic 2 in elementary#1426

Merged
ellakz merged 4 commits into
masterfrom
ELE-1696-support-pydantic-2
Feb 25, 2024
Merged

support pydantic 2 in elementary#1426
ellakz merged 4 commits into
masterfrom
ELE-1696-support-pydantic-2

Conversation

@ellakz
Copy link
Copy Markdown
Contributor

@ellakz ellakz commented Feb 22, 2024

No description provided.

@linear
Copy link
Copy Markdown

linear Bot commented Feb 22, 2024

@github-actions
Copy link
Copy Markdown
Contributor

👋 @ellakz
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

@@ -0,0 +1,32 @@
"""
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is the main interesting change

Comment thread pyproject.toml
pytest-parametrization = ">=2022.2.1"
pydantic = "<2.0"

pydantic = "<3.0"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

now we can also run with pydantic 2 but we actually use the pydantic 1 from it

Comment thread mypy.ini Outdated
[mypy-posthog]
ignore_missing_imports = True

[mypy-pydantic]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure if there was another way to overcome mypy issues (it was angry at whichever version wasn't installed for my when I ran it)

@ellakz ellakz force-pushed the ELE-1696-support-pydantic-2 branch from 4d1f163 to b44b07e Compare February 22, 2024 19:37
# NormalizedArtifactSchema must be first in the inheritance order
class NormalizedModelSchema(NormalizedArtifactSchema, ModelSchema):
artifact_type: str = Field("model", const=True)
artifact_type: str = Field("model", const=True) # type: ignore # noqa
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

unfortunately Field in pydantic 2 doesn't have a "const" field and that causes mypy to error. ignoring until we migrate to pydantic 2 for real

@ellakz ellakz merged commit b403f3a into master Feb 25, 2024
@ellakz ellakz deleted the ELE-1696-support-pydantic-2 branch February 25, 2024 13:30
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.

2 participants