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

Add type annotations #340

Open
sumezulike opened this issue Jun 1, 2024 · 4 comments
Open

Add type annotations #340

sumezulike opened this issue Jun 1, 2024 · 4 comments
Labels
maintenance issues related to making the project usable or testable

Comments

@sumezulike
Copy link

Adding typehints would greatly improve usability.

Without type annotations, IDE support is very limited and I often have to search through the code to figure out the exact types of a given attribute. Also static typechecking is obviously not possible, which I think is also pretty important for consistent code quality.

If that's an effort that would be appreciated, I would start by type-hinting the modules I currently use the most.

@tomato42 tomato42 added the maintenance issues related to making the project usable or testable label Jun 1, 2024
@tomato42 tomato42 added this to the someday/future milestone Jun 1, 2024
@tomato42
Copy link
Member

tomato42 commented Jun 1, 2024

Python 2.6 and 2.7 are still very much supported by this project, and will remain so for at least the next year or so.
As such, you'll need to add the type hints as comments, not inline. If that will help with your IDE: sure, go ahead. You can provide patches even on a function to function basis, as you work through them. Don't need to tackle the whole (public) API at once.

@sumezulike
Copy link
Author

Could type stubs then be a better solution? Those shouldn't interfere with the old pythons afaik.

@tomato42
Copy link
Member

tomato42 commented Jun 1, 2024

the issue is that you do have to remember to edit them and keep them updated... when type information is in a single file, then it's obvious and easy to do, when it's in separate file then it's easy to forget...

and if I do accept something into the repo, I generally intend to maintain it, can't realistically do it with this solution 🫤

@sumezulike
Copy link
Author

Yeah, understandable... I'm not a huge fan of type stubs either. I'll figure out how much type comments help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance issues related to making the project usable or testable
Projects
None yet
Development

No branches or pull requests

2 participants