You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using it in one of my projects and recently wanted to migrate it to type hinting with mypy. Unfortunately, I failed, because appdirs doesn't provide type hints.
Could you either add type hints to appdirs.py, or alternatively, add a appdirs.pyi type stub file?
Thank you :)
Reacted by Dominic Davis-Foster, Jeppe Klitgaard, Eisuke Kawashima, Raphael Nestler and Pieter Marsman
Inline typing might be a better fit, but, according to https://www.python.org/dev/peps/pep-0561/, you also would have to add the py.typed marker, which boils down to
convert the appdirs.py to an appdirs folder with a __init__.py
comment # type: ... everywhere
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 anymorepackage_data={"appdirs": ["py.typed"]},
packages=["appdirs"]
Activity
smessmer commentedon Sep 12, 2016
Added a pull request with a working type stub file: #75
What's then still missing is including it into setup.py so it's actually downloaded to library users. Apart from that, it should work.
cblegare commentedon Dec 21, 2019
Copying my comment from the PR
Inline typing might be a better fit, but, according to https://www.python.org/dev/peps/pep-0561/, you also would have to add the
py.typedmarker, which boils down toappdirs.pyto anappdirsfolder with a__init__.py# type: ...everywherepy.typedfile in theresee also https://mypy.readthedocs.io/en/latest/installed_packages.html