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

The package is typed but there is no py.typed file #47

Open
hatal175 opened this issue Apr 27, 2022 · 4 comments
Open

The package is typed but there is no py.typed file #47

hatal175 opened this issue Apr 27, 2022 · 4 comments

Comments

@hatal175
Copy link

You went through the trouble of typing your package - adding a py.typed file to it will help type analysis.

@IngoMeyer441
Copy link
Owner

Hey and thanks for the hint. I actually didn't know about the py.typed marker and thought that MyPy would pick up type hints automatically. So it is enough to create an empty py.typed file and include it in package_data in setup.py?

@hatal175
Copy link
Author

I think so

@hatal175 hatal175 changed the title The package is typed but there is py.typed file The package is typed but there is no py.typed file Apr 27, 2022
@IngoMeyer441
Copy link
Owner

IngoMeyer441 commented Apr 27, 2022

A py.typed marker is added in commit be7b3a9. However, this won't work at the moment. 😞 PEP561 mentions:

This PEP does not support distributing typing information as part of module-only distributions or single-file modules within namespace packages.

The single-file module should be refactored into a package and indicate that the package supports typing as described above.

So, as long as this project is a single-module project, no py.typed marker will be installed and thus, MyPy won't detect the typing support. I plan to restructure the project anyway to support Windows, so I can merge this change later...

@hatal175
Copy link
Author

hatal175 commented Apr 27, 2022 via email

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