Ship type information (py.typed + mypy CI) and make gpr_to_dnf public#22
Merged
Conversation
Three related "make the package's contracts real" changes: - Add the PEP 561 py.typed marker so the package's extensive type hints are visible to downstream type checkers (geckopy included). The hatchling wheel ships raven_python/py.typed. - Add mypy to the dev extra, a lenient [tool.mypy] config (ignore_missing_imports for the un-stubbed cobra/optlang/scipy/ruamel), and a mypy CI job. Fix the 36 type errors this surfaced -- all type-only (Path vs str annotations, None-guards that match existing behaviour, optlang Variable typing, isinstance/cast narrowing). No runtime behaviour changes; the full test suite stays green. - Promote manipulation.expand._gpr_to_dnf to a public gpr_to_dnf (re-exported from raven_python.manipulation). geckopy's call sites switch to it in lockstep (separate PR), so no deprecated alias is kept.
cbdb814 to
dee7e4c
Compare
This was referenced Jun 9, 2026
edkerk
added a commit
to SysBioChalmers/geckopy
that referenced
this pull request
Jun 10, 2026
* Use the public gpr_to_dnf from raven-python raven-python promoted manipulation.expand._gpr_to_dnf to a public gpr_to_dnf and keeps no deprecated alias (SysBioChalmers/raven-python#22). Switch geckopy's three references to the public name: - src/geckopy/ec_model/pipeline/populate_ec.py - src/geckopy/utilities/add_new_rxns_to_ec.py - tests/test_expand.py Import-only change; no behaviour change. * tests: align test_doc_top_level_keys with cobra-aligned YAML (id nested under metaData, not top-level)
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.
What
Tier-1 of the raven-python review — "make the package's existing quality count":
py.typedmarker (PEP 561). The package is already comprehensively typed, but without this marker downstream type checkers (including geckopy) silently ignore every hint. Verified the hatchling wheel shipsraven_python/py.typed.mypyadded to thedevextra, a lenient[tool.mypy]config (ignore_missing_importsfor the un-stubbed cobra/optlang/scipy/ruamel), and amypyCI job. It surfaced 36 real type issues (Path-vs-str slips,None-handling gaps, optlang.primaltyping) — all fixed with type-only changes.mypyis now clean (81 source files); the full suite and ruff stay green.gpr_to_dnfis now public —manipulation.expand._gpr_to_dnfis promoted to a documentedgpr_to_dnf(re-exported fromraven_python.manipulation). No back-compat alias is kept (geckopy isn't in production); geckopy's three call sites switch to it in lockstep — Use the public gpr_to_dnf from raven-python geckopy#26, merge that right after this.Verification
mypy→Success: no issues found in 81 source filespytest→ 618 passed (unchanged from baseline)ruff check→ cleanpython -m build→ wheel containsraven_python/py.typedNo runtime behaviour changes.