Skip to content
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

Mark package as including typehints #343

Merged
merged 1 commit into from
May 10, 2024

Conversation

intgr
Copy link
Contributor

@intgr intgr commented May 10, 2024

PEP 561 requires typehinted projects to include a py.typed file, for typecheckers to recognize the hints.

https://peps.python.org/pep-0561/#packaging-type-information

PEP 561 requires typehinted projects to include a `py.typed` file, for typecheckers to recognize the hints.
@alanjds
Copy link
Owner

alanjds commented May 10, 2024

This py.typed is new for me. Reading the docs, I felt that marking the stubs as "partial" can be beneficial. What do you think? https://peps.python.org/pep-0561/#partial-stub-packages

Many stub packages will only have part of the type interface for libraries completed, especially initially. For the benefit of type checking and code editors, packages can be “partial”.

If a stub package distribution is partial it MUST include partial\n in a py.typed file.

@intgr
Copy link
Contributor Author

intgr commented May 10, 2024

"Partial" is not relevant for us. I covered all modules in the rest_framework_nested package. Mypy's disallow_incomplete_defs and disallow_untyped_defs should ensure that untyped definitions can't be added.

Also I think it's for stub packages only (those that provide only .pyi files).

@alanjds alanjds merged commit f87e2e6 into alanjds:master May 10, 2024
5 checks passed
@alanjds
Copy link
Owner

alanjds commented May 10, 2024

FYI: Just released v0.94.1 on PyPI with the py.typed mark

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.

None yet

2 participants