Repository navigation
Add a py.typed marker and fix type errors against a typed fetchez - #200
Merged
Merged
Conversation
Type checkers only read a package's annotations when it carries this marker (PEP 561), so code that uses transformez can now be checked against them.
Gives the downloaded file names their own loop variable in the reference fetcher, rather than reusing it for the Path, and lets plot_grid() take a region string or list, as its docstring and code already do.
5 of 7 tasks
This was referenced Oct 20, 2026
matth-love
approved these changes
Oct 21, 2026
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.
Description
Adds an empty
src/transformez/py.typedfile. Under PEP 561, type checkers such as mypy only read an installed package's annotations when it carries this marker. Without it, they treat everything imported from transformez asAny, and downstream projects have to list transformez underignore_missing_importsin their mypy settings. With it, calls into transformez are checked against its annotations in the calling project's type check.This came out of a review of IVERT's CI (continuous-dems/ivert#220), which suggested marking fetchez, transformez and globato as typed, but only where the package itself is type-checked. transformez is: the "Type check" workflow runs mypy on every pull request.
The wheel and sdist pick up the file without any configuration change, since hatch includes everything under
src/transformez; I checked that a built wheel contains it. IVERT, which imports transformez, has no new type errors with the marker in place.fetchez is getting the same marker in continuous-dems/fetchez#501. Once that is released, this repository's "Type check" workflow, which installs the newest fetchez, will check how transformez calls it. Against that branch it found 16 errors. Half come from fetchez annotations that #501 tightens; this PR fixes the other 8, none of which change behavior:
reference/fetcher.pygives the downloaded file names their own loop variable, rather than reassigning the loop'sstrvariable to aPath(7 errors).api.plot_grid()is annotated to take a region string or list as well as aRegion, as its docstring and code already do;transformez build --previewpasses it a string (1 error).With both PRs in, the type check is clean. This PR should be merged before the fetchez release that carries #501, or the "Type check" workflow will fail on every PR here until it is.
Checklist
closes #1)CHANGELOG.mdupdatedIf needed, docs and/orn/aREADME.mdupdatedIf needed, unit tests addedn/a🔍 Docs preview: https://transformez--200.org.readthedocs.build/en/200/