Investigate Type Annotation
See original GitHub issueIs your feature request related to a problem? Please describe.
I just started exploring pyinfra and so far I like it a lot. I happen to use VSCode with the Pylance plugin. This appears to throw a ton of red squiggles on anything decorated with the @operation
decorator if Type Checking Mode
is set to basic
. The completion/help for any function arguments is also broken. I suspect the issue is related to https://github.com/microsoft/pyright/issues/774, but I’m not sure how to deal with how the @operation
decorator adds global arguments.
Describe the solution you’d like I suspect providing type annotations for the entire project is out of scope (for now… 😄 ), but it would be interesting to explore how to better support some basic type annotations. This may be more of a v2 problem though.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top GitHub Comments
Typing is now in! Not 100% but mypy is part of CI and types can gradually be introduced. The global operation args are typed.
I’ve found lack of types not that bad since there are decent docs and pyinfra seems well tested. But for my own custom deploys I’m more worried about messing them up. For anyone who wants to at least type their own deploys, you can use this trick:
Then stuff like this will be type checked:
You can also probably use it for typing some of pyinfra’s API on ad-hoc basis