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

Consider adding typehints into the codebase #19

Closed
Winterflower opened this issue Aug 1, 2019 · 5 comments · Fixed by #295
Closed

Consider adding typehints into the codebase #19

Winterflower opened this issue Aug 1, 2019 · 5 comments · Fixed by #295
Assignees
Labels
help wanted Solution is fleshed out and ready to be worked on
Milestone

Comments

@Winterflower
Copy link

Python has supported typehints since version 3.5 (see here https://docs.python.org/3/library/typing.html).
Might be good to investigate if adding typehints would make the codebase a bit easier to maintain in the future?

@stevedodson stevedodson added the help wanted Solution is fleshed out and ready to be worked on label Nov 14, 2019
@stevedodson
Copy link
Contributor

++ on doing this.

pandas has implemented this nicely:

https://github.com/pandas-dev/pandas/blob/master/pandas/_typing.py

pandas-dev/pandas#14468

If @viglia or others want to contribute, this could be a good starting point.

@sethmlarson sethmlarson added this to the v7.9.0 milestone Apr 9, 2020
@sethmlarson sethmlarson self-assigned this Apr 9, 2020
@V1NAY8
Copy link
Contributor

V1NAY8 commented Oct 19, 2020

@sethmlarson Since, we are incrementally doing this.
Are type hints required for tests?
Test methods would usually have return type None and pytest parameterized arguments are mostly List[int] or List[str] or List[bool]

@sethmlarson
Copy link
Contributor

Not required for tests, only non-tests. Need to add the py.typed marker too.

@V1NAY8
Copy link
Contributor

V1NAY8 commented Oct 19, 2020

What does py.typed do, or what does it contain ? :)

@sethmlarson
Copy link
Contributor

See this example project from PEP 561:

https://github.com/ethanhs/sample-typed-package

It's an empty file that signals to mypy, etc that type hints are included in the source/dist :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Solution is fleshed out and ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants