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 most recent Python Syntax in .pyi files #161

Open
5 of 8 tasks
JonathanPlasse opened this issue Dec 17, 2023 · 14 comments
Open
5 of 8 tasks

Use most recent Python Syntax in .pyi files #161

JonathanPlasse opened this issue Dec 17, 2023 · 14 comments
Assignees

Comments

@JonathanPlasse
Copy link
Sponsor Contributor

JonathanPlasse commented Dec 17, 2023

In .pyi files, the most recent syntax of python can be used, as it is only used for static analysis.

Therefore, these changes can be made:

I could work on this, to familiarize myself with the codebase.

@nutti
Copy link
Owner

nutti commented May 12, 2024

@JonathanPlasse

Yes, go ahead.
Currently, we use Python 3.9 for the generation which does not support these syntax.
You many need to change Python version as well.

@JonathanPlasse
Copy link
Sponsor Contributor Author

Ok, I will start working on it.

@nutti
Copy link
Owner

nutti commented May 16, 2024

@JonathanPlasse

#207 is merged now.
Will you also tackle the remain (PEP695) as wall?

@JonathanPlasse
Copy link
Sponsor Contributor Author

I will.

@Road-hog123
Copy link
Contributor

Can I suggest PEP 673's Self type as a related change?

Presently ID.evaluated_get() returns ID, but if this were changed to Self then I believe Object.evaluated_get() would correctly return Object instead of ID.

Unfortunately the documentation just lists the return type as ID, so I don't know if there's anything for the generation code to detect to make this change automatically.

@JonathanPlasse
Copy link
Sponsor Contributor Author

To avoid regression, we should use the plugin flake-pyi available in Ruff to check we use the modern syntax in the generated code.

@nutti
Copy link
Owner

nutti commented Jun 7, 2024

@JonathanPlasse

Should this issue be still opened?
I think some features have already merged.

@JonathanPlasse
Copy link
Sponsor Contributor Author

Can I suggest PEP 673's Self type as a related change?

Presently ID.evaluated_get() returns ID, but if this were changed to Self then I believe Object.evaluated_get() would correctly return Object instead of ID.

Unfortunately the documentation just lists the return type as ID, so I don't know if there's anything for the generation code to detect to make this change automatically.

This one would be interesting.

To avoid regression, we should use the plugin flake-pyi available in Ruff to check we use the modern syntax in the generated code.

This one would be cool to have.

Is it a problem for you if the issue remains open?
Should we open a specific issue for each remaining point instead?

@nutti
Copy link
Owner

nutti commented Jun 7, 2024

No, I just would like to know the current status and the future plan.
We welcome your contribution.

@JonathanPlasse
Copy link
Sponsor Contributor Author

I updated the initial comment.

@nutti
Copy link
Owner

nutti commented Jul 7, 2024

@JonathanPlasse

Ruff linter is now merged to the master branch.
You can tackle the remaining task now.

@nutti
Copy link
Owner

nutti commented Jul 20, 2024

@JonathanPlasse

Can I suggest PEP 673's Self type as a related change?

Presently ID.evaluated_get() returns ID, but if this were changed to Self then I believe Object.evaluated_get() would correctly return Object instead of ID.

Unfortunately the documentation just lists the return type as ID, so I don't know if there's anything for the generation code to detect to make this change automatically.

By solving this feature, I solved below item.

  • Use Self (PEP 673)

@nutti
Copy link
Owner

nutti commented Jul 20, 2024

@JonathanPlasse

I think below item seems to have already been resolved by the ruff linter introduced.

  • Add Ruff and enable linter rules to avoid regression we encountered

How do you think about it?

@JonathanPlasse
Copy link
Sponsor Contributor Author

Does it check that the generated code passes the rules of flake8-pyi?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants