Skip to content

Ship type information (py.typed + mypy CI) and make gpr_to_dnf public#22

Merged
edkerk merged 1 commit into
developfrom
chore/ship-types-and-public-gpr
Jun 9, 2026
Merged

Ship type information (py.typed + mypy CI) and make gpr_to_dnf public#22
edkerk merged 1 commit into
developfrom
chore/ship-types-and-public-gpr

Conversation

@edkerk

@edkerk edkerk commented Jun 9, 2026

Copy link
Copy Markdown
Member

What

Tier-1 of the raven-python review — "make the package's existing quality count":

  • py.typed marker (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 ships raven_python/py.typed.
  • mypy enforcementmypy added 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. It surfaced 36 real type issues (Path-vs-str slips, None-handling gaps, optlang .primal typing) — all fixed with type-only changes. mypy is now clean (81 source files); the full suite and ruff stay green.
  • gpr_to_dnf is now publicmanipulation.expand._gpr_to_dnf is promoted to a documented gpr_to_dnf (re-exported from raven_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

  • mypySuccess: no issues found in 81 source files
  • pytest → 618 passed (unchanged from baseline)
  • ruff check → clean
  • python -m build → wheel contains raven_python/py.typed

No runtime behaviour changes.

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.
@edkerk edkerk force-pushed the chore/ship-types-and-public-gpr branch from cbdb814 to dee7e4c Compare June 9, 2026 21:34
@edkerk edkerk merged commit 81d5f2d into develop Jun 9, 2026
6 checks passed
@edkerk edkerk deleted the chore/ship-types-and-public-gpr branch June 9, 2026 22:50
@edkerk edkerk mentioned this pull request 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant