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 hints #37

Closed
antazoey opened this issue Aug 2, 2023 · 5 comments
Closed

Add type hints #37

antazoey opened this issue Aug 2, 2023 · 5 comments

Comments

@antazoey
Copy link
Contributor

antazoey commented Aug 2, 2023

May be a simple as adding a py.typed marker, otherwise we have type ignore imports

@mikeshultz
Copy link
Owner

What's missing?

@antazoey
Copy link
Contributor Author

antazoey commented Aug 2, 2023

@mikeshultz
Copy link
Owner

I've seen these in other codebases before but didn't really know what they were for.

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing. This marker applies recursively: if a top-level package includes it, all its sub-packages MUST support type checking as well. To have this file installed with the package, maintainers can use existing packaging options such as package_data in distutils, shown below.

Ref: https://peps.python.org/pep-0561/#packaging-type-information

Packages with a py.typed marker file - if there is nothing overriding the installed package, and it opts into type checking, the types bundled with the package SHOULD be used (be they in .pyi type stub files or inline in .py files).

Ref: https://peps.python.org/pep-0561/#type-checker-module-resolution-order

So basically this just tells mypy (or whatever) that dependents should use the types in this package? Is this blocking for you?

@antazoey
Copy link
Contributor Author

antazoey commented Aug 2, 2023

Not blocking but will help prevent typing related bugs downstream

@mikeshultz
Copy link
Owner

Fixed in #40. Thanks @antazoey!

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

No branches or pull requests

2 participants