-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add py.typed file to package for PEP-561 compliance #315
Conversation
This is another go at #299 but this time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
Please resolve conflicts. I'm also wondering if there are cases in which people already download directly, which will now break. Maybe there's a way to redirect? I'm not familiar with one, and believe it will result in a 301. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one small comment:
@jdufresne This PR appears nearly complete, just pinging you in case you still intend to land it. |
@jdufresne Looks like a recent merge introduced a rebase issue, could you handle that @jdufresne? |
Per PEP-561, packages that include type information that can be consumed by other libraries should distribute a py.typed file. This tells mypy and other tools to use type information shipped with the library. This requires moving distro from a single module file to a package so that it can ship data files. The original distro.py was not altered. Only the __init__.py and __main__.py were added to facilitate being used as a packages. By keeping distro.py unaltered, this allows projects to continue to vendor the file into their project without as before without any modifications. For details on PEP-561, see: https://www.python.org/dev/peps/pep-0561/ For details on mypy using py.typed, see: https://mypy.readthedocs.io/en/stable/installed_packages.html#creating-pep-561-compatible-packages
@sethmlarson No problem. Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @jdufresne!
https://build.opensuse.org/request/show/955104 by user sebix + dimstar_suse - remove shebang from distro.py - update to version 1.7.0: - BACKWARD COMPATIBILITY: - Dropped support for EOL Pythons 2.7, 3.4 and 3.5 [[#281](python-distro/distro#281)] - Dropped support for LSB and `uname` back-ends when `--root-dir` is specified [[#311](python-distro/distro#311)] - Moved `distro.py` to `src/distro/distro.py` [[#315](python-distro/distro#315)] - ENHANCEMENTS: - Documented that `distro.version()` can return an empty string on rolling releases [[#312](python-distro/distro#312)] - Documented support for Python 3.10 [[#316](python-distro/distro#316)] - Added official support for Rocky Linux distribution [[#318](https://github.com/python-distro/distr
Per PEP-561, packages that include type information that can be consumed
by other libraries should distribute a py.typed file. This tells mypy
and other tools to use type information shipped with the library.
This requires moving distro from a single module file to a package so
that it can ship data files. The original distro.py was not altered.
Only the
__init__.py
and__main__.py
were added to facilitate being usedas a package. By keeping distro.py unaltered, this allows projects to
continue to vendor the file into their project without as before without
any modifications.
For details on PEP-561, see:
https://www.python.org/dev/peps/pep-0561/
For details on mypy using py.typed, see:
https://mypy.readthedocs.io/en/stable/installed_packages.html#creating-pep-561-compatible-packages