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

Declare typing support via py.typed file #433

Open
3 tasks
jwodder opened this issue May 1, 2024 · 1 comment · May be fixed by #434
Open
3 tasks

Declare typing support via py.typed file #433

jwodder opened this issue May 1, 2024 · 1 comment · May be fixed by #434
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jwodder
Copy link

jwodder commented May 1, 2024

Running mypy on code that uses the latest version of pypistats fails with the error message "module is installed, but missing library stubs or py.typed marker". A quick look at pypistats's source indicates that it is using type annotations, but because there is no py.typed file, mypy will not use the annotations when type-checking code that uses pypistats.

To resolve this, please do the following:

  • If not already, ensure that all public items in pypistats are type-annotated and validated by mypy.
  • Add an empty file named py.typed inside src/pypistats/.
  • Ensure that the pypistats/py.typed file is included in sdists & wheels built from the project. This may involve configuration specific to your build backend (hatch) that is beyond the scope of this comment.

Further references:

@hugovk hugovk linked a pull request May 2, 2024 that will close this issue
@hugovk
Copy link
Owner

hugovk commented May 2, 2024

Thanks for the suggestion!

I've made a start on it in #434, but likely won't be able to continue this month due to PyCon US and other travel.

Please feel free to take the branch and finish it off :)

@hugovk hugovk added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants