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

Add py.typed #4424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add py.typed #4424

wants to merge 1 commit into from

Conversation

rhelmot
Copy link

@rhelmot rhelmot commented Nov 15, 2023

This is neither a doc pr nor a code pr, but a packaging PR! Related to #1103, this makes the existing partially-complete type annotations usable for checking projects which import plotly.

Copy link

@jack-volantautonomy jack-volantautonomy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@@ -0,0 +1 @@
partial

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py.typed is just a marker file, per https://peps.python.org/pep-0561/#packaging-type-information

This marker applies recursively

It should be blank (e.g. just a file without any contents), so can you remove the text "partial"?


Are you interpreting the text partial to be like a signifier of partial typing? I don't think anyone actually consumes the content of this file, for example mypy just goes based on the file existing: https://github.com/python/mypy/blob/v1.14.1/mypy/modulefinder.py#L344-L345

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless of what mypy consumes, this is literally what the standard specifies should be done: https://peps.python.org/pep-0561/#partial-stub-packages

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I follow what you mean, thanks for sharing. TIL that partial means to first check a stub package, then fall back on the runtime package.

Though I still don't think partial should be here, as this is not a stub package, this is the actual runtime package. Does that make sense?

In other words, if this was an external stub package filled with .pyi, then you'd put partial. But that's not the case here, it's the runtime package with .py files, so py.typed should be blank

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants