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 py.typed marker for type checking #27

Merged
merged 1 commit into from
May 7, 2024
Merged

Conversation

facutuesca
Copy link
Contributor

Currently, when using a generated package as a library in another Python package and trying to run mypy for type checking, there is an error related to not being able to find neither library stubs or the py.typed marker.

# test.py
from my_cookiecutter_generated_package import x
$ mypy test.py
a.py:1: error: Skipping analyzing "my_cookiecutter_generated_package": module is installed, but missing library stubs or py.typed marker  [import-untyped]
a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

This PR adds an empty py.typed file to signal mypy that the generated package does provide type information (see docs here)

cc @woodruffw

@facutuesca facutuesca requested a review from woodruffw May 7, 2024 13:01
@woodruffw woodruffw merged commit 9e3fe06 into main May 7, 2024
4 checks passed
@woodruffw
Copy link
Member

Thanks @facutuesca!

@woodruffw woodruffw deleted the pep561-typed-marker branch May 7, 2024 14:03
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

Successfully merging this pull request may close these issues.

2 participants