-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add py.typed marker file #146
Comments
Hello @ymyzk , thank you for the suggestions! Type hints have up to this point been added as a forward-looking style convention and to simplify the built-in documentation (e.g. replacing The refactor/restructuring of the module into a package may be undertaken as a future project, but for now (FYI) we're holding off on authoring and reviewing bigger changes while we work on migrating this project to the new I'm going to leave this issue open so it doesn't get forgotten in the process and will cross-link the new issue when it's created in the new project. |
Thanks for the thoughtful answer, @Deconstrained! I can understand project's plan and wait for the type hints to be available to the pdpyras users in the future. It's also great to hear that this project can be moved to "pagerduty" on PyPI. 👍 |
Recorded as PagerDuty/python-pagerduty#26 |
Problem
#131 added type hints to the pdpyras library. However, users of pdpyras cannot use the type hints in their projects using pdpyras. Here's an example
This is because pdpyras does not have
py.typed
marker file in the packaged distribution. Reference: https://typing.readthedocs.io/en/latest/guides/libraries.htmlI'm not sure if this is intended by the maintainers of pdpyras. If the maintainers expect users to enjoy type hints in the pdpyras, it's nice to fix this problem.
Solution
It would be great if we can simply add the
py.typed
file to pdpyras, but it doesn't work becausepdpyras.py
, not a package.py.typed
is not supported for such top-level modules yet. Issue: Type stubs for single-file top-level modules python/typing#1333There are a few approaches we could fix the issue.
pdpyras.py
from a module to a package and putpy.typed
in the package. I've created a PoC for this: main...ymyzk:pdpyras:py-typed-pocI'm happy to create a PR for this issue, but I'd like to know what is the preferred solution by the maintainers first. Thanks!
The text was updated successfully, but these errors were encountered: