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

Downgrade pydantic in dev env #355

Merged
merged 4 commits into from
Oct 15, 2024
Merged

Conversation

DevonFulcher
Copy link
Contributor

Description

This PR makes type-checking more consistent for local development. I have had an annoying issue with the type-checker reporting errors that weren't appearing in CI. Initially, I thought this was a problem with mypy, but actually the problem was that I have been using Pydantic 2, but the types in the codebase are only compatible with Pydantic 1. Specifically, I was getting a lot of errors for properties like extra_detail that don't have a default value:

class ValidationIssue(ABC, BaseModel):
    """The abstract base ValidationIssue class that the specific ValidationIssue classes are built from."""

    message: str
    context: Optional[ValidationContext] = None
    extra_detail: Optional[str]

Checklist

@@ -66,7 +65,8 @@ dependencies = [
"isort>=5.12,<6",
"black>=23.3,<24",
"ruff==0.0.260",
"mypy>=1.3,<2",
"mypy==1.6.1",
"pydantic>=1.10,<2", # The types in this codebase with mypy checker are only compatible with pydantic 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm I wonder if we should also restrict this in prod? Why only change dev?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a problem only with mypy and the type annotations. This problem doesn't impact the production release version.

@DevonFulcher DevonFulcher merged commit b5feed6 into main Oct 15, 2024
16 checks passed
@DevonFulcher DevonFulcher deleted the Downgrade_Pydantic_in_dev-env branch October 15, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants