Repository navigation
Ship type hints (py.typed), test on Python 3.13/3.14; bump to 1.2.1 - #21
Merged
Merged
Conversation
Coverage Report for CI Build 37524288265Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.3%) to 91.322%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions14 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
iskandr
force-pushed
the
faster-pickle-and-decode
branch
from
October 6, 2026 16:56
64891f0 to
5f0f0f0
Compare
iskandr
force-pushed
the
types-and-ci
branch
2 times, most recently
from
October 6, 2026 19:48
36e2dc4 to
a970445
Compare
iskandr
force-pushed
the
faster-pickle-and-decode
branch
2 times, most recently
from
October 6, 2026 19:52
57cc43f to
c1d173b
Compare
- Annotate the public API. from_dict / from_json / read_json_file are typed to return the subclass they're called on, so mypy and pyright infer Genome.from_json(...) as Genome. Ship a py.typed marker. - Run mypy in lint.sh and CI. lint.sh uses the first of the active virtualenv, .venv or python3 that has mypy, since the active environment may not be this project's (e.g. in a git hook). mypy 2 can't target 3.9, but the annotations are never evaluated at runtime, so checking as 3.10 is equivalent. - Use Optional/Union rather than `X | Y` so typing.get_type_hints works on Python 3.9; this also fixes get_type_hints on DataclassSerializable subclasses, which failed on 3.9 before. Tested by test_typing.py. - Add Python 3.13 and 3.14 to the CI matrix and classifiers. No runtime behavior changes. Claude-Session: https://claude.ai/code/session_01JRDMg3F5kNKmnjv5jvQBgr
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.
Stacked on #20. No runtime behavior changes.
py.typedmarker.from_dict,from_jsonandread_json_fileare typed to return the subclass they're called on. I installed the built wheel into a clean venv: mypy and pyright both inferGenome.from_json(...)asGenome, andDataclassSerializablesubclasses work the same way.lint.shand CI (default strictness, clean).from __future__ import annotations), sopython_version = "3.10"in[tool.mypy]covers 3.9.lint.shuses the first of the active virtualenv,.venvorpython3that has mypy, since the active environment may not be this project's (e.g. in a git hook). It still fails if none of them has mypy.Optional/Unionrather thanX | Y, sotyping.get_type_hints()works on 3.9. This also fixesget_type_hints()onDataclassSerializablesubclasses, which already failed on 3.9.tests/test_typing.pycovers every annotated class, method and helper; ruff'sUP045is now ignored for the same reasonUP007already was.Typing :: Typedclassifier. The suite passes locally on 3.9, 3.13 and 3.14.https://claude.ai/code/session_01JRDMg3F5kNKmnjv5jvQBgr