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

Completely drop Python 3.7 compatibility #1459

Merged
merged 4 commits into from
Apr 29, 2023

Conversation

intgr
Copy link
Collaborator

@intgr intgr commented Apr 27, 2023

Related issues

* Latest Django 4.2 no longer supports Python 3.7
* Our CI dependency `pre-commit` no longer supports Python 3.7
* Python 3.7 support ends in 2 months (https://endoflife.date/python)
* We can clean up a few type stubs
Tuple[str, _AttachmentContent]
| Tuple[Optional[str], _AttachmentContent, str]
| Tuple[str, _AttachmentContent, None]
tuple[str, _AttachmentContent] | tuple[str | None, _AttachmentContent, str] | tuple[str, _AttachmentContent, None]
Copy link
Collaborator Author

@intgr intgr Apr 27, 2023

Choose a reason for hiding this comment

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

Hrm? These comments were referencing Python 3.7, but I'm not sure whether this has anything to do with Python 3.7.

str | None or tuple[str] don't work on Python 3.8 runtime either.

But AFAIK it doesn't matter since .pyi files are only evaluated by mypy, not Python itself. Maybe I'm missing something.

Copy link
Member

Choose a reason for hiding this comment

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

These files are parsed by python, but not executed. I don't remember the origin of this comment, but I am happy that it is removed now :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These files are parsed by python, but not executed.

Genuinely interested, when does Python parse .pyi files?

Is this somehow related to the ast module (which used to be typed_ast but got merged into Python 3.8's ast)?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, exactly. mypy uses ast.parse to get the Python's AST and then mypy builds its own AST around it.

@intgr
Copy link
Collaborator Author

intgr commented Apr 29, 2023

Anyone who wants to review this?

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

@intgr
Copy link
Collaborator Author

intgr commented Apr 29, 2023

Ah thanks! You already mentioned it in typeddjango/djangorestframework-stubs#399 but I forgot.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you!

@intgr intgr merged commit 4d10414 into typeddjango:master Apr 29, 2023
@intgr intgr deleted the completely-drop-python-37 branch April 29, 2023 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants