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

Add back Python 3.8 support #249

Merged
merged 1 commit into from
Dec 20, 2024
Merged

Add back Python 3.8 support #249

merged 1 commit into from
Dec 20, 2024

Conversation

Viicos
Copy link
Member

@Viicos Viicos commented Dec 16, 2024

Fixes #248

@@ -107,9 +107,9 @@ class SomeModel(BaseModel):
us_number: USNumberType
"""

default_region: Optional[str] = None
default_region: str | None = None

Choose a reason for hiding this comment

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

I am not a maintainer but went into this PR from the referenced issue.

As far as I know | can be used as Union or Optional alternative only from python 3.10, see Union Type and corresponding note at the end:

Added in version 3.10.

Copy link
Member Author

Choose a reason for hiding this comment

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

PEP 563 is used here.

Choose a reason for hiding this comment

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

Yeah, but | was proposed in PEP 604, I don't see it in PEP 563

Copy link
Member Author

Choose a reason for hiding this comment

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

The PEP 563 future statement stringifies type annotations by default. See the note in https://typing.readthedocs.io/en/latest/guides/modernizing.html#introduction explaining what it enables

@Viicos Viicos merged commit 6a08c3a into main Dec 20, 2024
10 checks passed
@Viicos Viicos deleted the 3.8 branch December 20, 2024 09:08
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.10.1 is not Python3.8 Compatible
3 participants