Skip to content

Add type stubs file #75

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

smessmer
Copy link

Add type stubs file (PEP484)

Add type stubs file (PEP484)
@smessmer smessmer mentioned this pull request Sep 12, 2016
@pradyunsg
Copy link

I think it would be preferable to have inline comments instead. Also, xyz: str = None fails on newer mypy versions since the type should be Optional[str].

@keturn keturn mentioned this pull request Dec 14, 2019
@cblegare
Copy link

cblegare commented Dec 21, 2019

Adding on top of what @pradyunsg said

According to https://www.python.org/dev/peps/pep-0561/

You also would have to add the py.typed marker, which boils to

  • convert the appdirs.py to an appdirs folder with a __init__.py
  • add a py.typed file in there
  • make sure that file is bundled within your wheel with some setuptools incantation, i.e
# py_modules=["appdirs"], # no need for this anymore
package_data={"appdirs": ["py.typed"]},
packages=["appdirs"]

see also https://mypy.readthedocs.io/en/latest/installed_packages.html

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.

3 participants