chore: ship PEP 561 py.typed marker#431
Open
denrou wants to merge 1 commit into
Open
Conversation
Add an empty `src/timesfm/py.typed` marker and include it in the wheel
via `[tool.setuptools.package-data]` so that downstream type checkers
(mypy, pyright, pylance) honor the existing inline type annotations
instead of treating everything imported from `timesfm` as `Any`.
The package already carries partial type annotations throughout
`configs.py`, `timesfm_2p5/*.py`, `torch/*.py`, and `flax/*.py`. PEP 561
explicitly supports partially typed packages, so no annotation changes
are needed alongside the marker.
Verified the marker lands in the built wheel:
$ python -m build --wheel
$ unzip -l dist/timesfm-2.0.0-py3-none-any.whl | grep py.typed
0 ... timesfm/py.typed
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an empty
src/timesfm/py.typedmarker file (PEP 561) and includesit in the built wheel via
[tool.setuptools.package-data].Why
Without the marker, downstream type checkers (mypy, pyright, pylance)
treat every symbol imported from
timesfmasAny— ignoring theinline annotations that are already present throughout
configs.py,timesfm_2p5/*.py,torch/*.py, andflax/*.py. Shipping the markerlets users get type information from
timesfmin their typedcodebases.
PEP 561 explicitly allows partially-typed packages, so no annotation
work is required alongside this change — symbols that are unannotated
will continue to be inferred as
Any, exactly as they are today forthe package's own internal type-checking.
Verification
Built the wheel locally and confirmed the marker is included:
Test plan
python -m build --wheelsucceedspy.typedis present in the wheel undertimesfm/.github/workflows/main.yml) passes