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

Use modern Python 3.10 syntax #207

Merged
merged 3 commits into from May 16, 2024
Merged

Conversation

JonathanPlasse
Copy link
Sponsor Contributor

@JonathanPlasse JonathanPlasse commented May 12, 2024

Purpose of the pull request

This pull-request modernize the syntax used in the generated pyi files.

Description about the pull request

  • PEP 585
  • PEP 604
  • PEP 695

@JonathanPlasse JonathanPlasse changed the title Update: use modern syntax Use modern Python syntax May 12, 2024
@JonathanPlasse JonathanPlasse changed the title Use modern Python syntax Use modern Python 3.10 syntax May 14, 2024
@JonathanPlasse JonathanPlasse marked this pull request as ready for review May 14, 2024 17:59
@JonathanPlasse
Copy link
Sponsor Contributor Author

I would like to keep PEP 695 for another PR.
Moving to PEP 695 would require tracking which classes are using the GenericType type variable to only add it where necessary.

@JonathanPlasse
Copy link
Sponsor Contributor Author

@nutti, this is ready for review.

Copy link
Owner

@nutti nutti 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 for your contribution!
I have a comment about PR.
Please check it.

@nutti
Copy link
Owner

nutti commented May 16, 2024

@JonathanPlasse

Thanks. The code looks good to me.
Should we change the document and pyproject file as well?

Python 3.8. Check your Python version is >= 3.8.

requires-python = ">=3.8"

@JonathanPlasse
Copy link
Sponsor Contributor Author

@nutti, no need, the modern syntax used in pyi files is never executed during runtime and is understood by MyPy and Pyright even with Python 3.8.

@nutti
Copy link
Owner

nutti commented May 16, 2024

@JonathanPlasse

OK, thank you.
BTW, does .pyi not depend on the Python version?
I'm not sure whether the Python version restriction can be removed or not.

@JonathanPlasse
Copy link
Sponsor Contributor Author

JonathanPlasse commented May 16, 2024

fake-bpy-module is a development only dependency only containing pyi files.
Older supported version of Blender use Python version below 3.8.
It would make sense to remove the python version constraints as it can be installed with on any version.

@nutti
Copy link
Owner

nutti commented May 16, 2024

@JonathanPlasse

Thank you.
Maybe we should remove this restriction in future.
But I think this is not the scope of this issue.

@nutti nutti merged commit 7ada276 into nutti:master May 16, 2024
33 checks passed
@JonathanPlasse JonathanPlasse deleted the modern-syntax branch May 16, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants