Skip to content

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