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

👌 Improve calcfunction/workfunction typing #6077

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

chrisjsewell
Copy link
Member

Utilising PEP 612, this addition adds beautiful static completions for functions decorated with @calcfunction or @workfunction

Using the function normally still works as expected:
image

But now also the additional features of a process function work:
image


Unfortunately, PEP 612 was only introduced in Python 3.10, and so I haven't yet added a "fallback" for Python 3.9

@sphuber
Copy link
Contributor

sphuber commented Jul 7, 2023

Are you aware of work in progress on backporting this to Python 3.9 in a stand-alone package, or does it mean we will have to wait with this PR until Python 3.9 support is dropped? Which will be April 2024 at the earliest.

@chrisjsewell
Copy link
Member Author

Are you aware of work in progress on backporting this to Python 3.9 in a stand-alone package, or does it mean we will have to wait with this PR until Python 3.9 support is dropped?

https://typing-extensions.readthedocs.io/en/latest/#ParamSpec

@sphuber sphuber force-pushed the type-calcfunction branch 2 times, most recently from 3549ef6 to dc661e9 Compare September 13, 2023 12:10
@sphuber
Copy link
Contributor

sphuber commented Sep 13, 2023

@chrisjsewell Thanks for the PR. I have rebased it and addressed the outstanding problems for tests to pass. Not sure if you are still watching this space. Let me know if you want to have a look before I merge.

Add fallback of import of `ParamSpec` for Python 3.9
Also rename `R` to `R_co` since it is covariant and that is the standard
naming convention
@sphuber sphuber marked this pull request as ready for review September 13, 2023 12:24
@chrisjsewell
Copy link
Member Author

Yeh no worries dude, merge away

@sphuber sphuber merged commit a85af4f into aiidateam:main Sep 13, 2023
10 checks passed
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 participants