-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Question: how to use pyre_extensions.ParameterSpecification
(PEP 612)
#855
Comments
Pyright doesn't know anything about pyre_extensions, which is specific to the pyre type checker. That explains why you're not seeing the behavior you're expecting. I did add support for ParameterSpecification in Pyright in anticipation of this functionality being included in Python 3.9. Unfortunately, it appears that PEP 612 has not yet been ratified, which means it's unlikely to make it into Python 3.9 and will need to wait until 3.10. That's why it hasn't yet appeared in the official typing.pyi in typeshed. The version of typing.pyi that currently ships with Pyright deviates slightly from the version that's checked into typeshed. It includes the following addition:
The version of typing.pyi that currently ships with Pylance does not contain this addition, since we're trying to stick with stock typehshed stubs for Pylance. I will likely remove the above code in an upcoming version of Pyright now that it has become clear that PEP 612 won't make it into Python 3.9. If you want to play with the ParameterSpecification support that's in Pyright today, you can hand-edit your typing.pyi file to include the above block. Just note that your modifications will get overwritten the next time Pyright or Pylance are updated. |
Thank you! |
Also note that the PEP was revised last month with the addition of |
Unfortunately, stubbing out Unfortunately, I don't understand how metaclasses work in Python, so I can't figure out how to adapt your snippet to be a type. Inheriting from Is there any backwards-compatible way to use Minimal (not) working example:
|
I can't tell what you're trying to do here. Perhaps you could post a more detailed question in the Discussions, and we'll try to help you out. |
For posterity's sake, the follow-up is here. |
typing.ParameterSpecification
is not available until 3.9. I'm trying to get it work with the library pyre_extensions which you seem to have covered here.pyright/client/typeshed-fallback/third_party/2and3/pyre_extensions.pyi
Lines 1 to 7 in 150971c
And it is tested here.
pyright/server/src/tests/samples/paramSpec3.py
Line 5 in 4ee7261
I don't understand why I get an error since you have already implementd PEP 612.
Did I miss anything?
I'm using coc-pyright with pyright 1.1.53
The text was updated successfully, but these errors were encountered: