Skip to content

Robustness and polish fixes#25

Merged
edkerk merged 1 commit into
developfrom
fix/tier4-polish
Jun 10, 2026
Merged

Robustness and polish fixes#25
edkerk merged 1 commit into
developfrom
fix/tier4-polish

Conversation

@edkerk

@edkerk edkerk commented Jun 9, 2026

Copy link
Copy Markdown
Member

Tier 4 of the raven-python review: small, targeted robustness / polish fixes — no
behaviour change on valid inputs.

Fixes

  • gapfilling/fill.py — the connectivity gap-fill MILP used each template
    reaction's bound directly as the big-M (flux <= ub * y). A template reaction with
    an infinite bound therefore put an infinite coefficient into the problem, breaking
    the solver. The big-M is now clamped to the largest finite bound magnitude in the
    model (>= any flux the reaction can carry).
  • reconstruction/kegg/download.py — a malformed or unreadable ~/.netrc raised a
    raw NetrcParseError / OSError out of _resolve_auth. It now raises a ValueError
    explaining how to fix the file, matching the other credential errors there.
  • io/excel.py — the METS-sheet exporter dropped a metabolite's formula (the
    COMPOSITION column) whenever an InChI was present. It now always writes the formula,
    so nothing is silently lost in the RAVEN Excel export.
  • visualization/ — the empty stub package now raises a clear NotImplementedError
    (with a roadmap pointer) on any attribute access, via a PEP 562 module __getattr__,
    instead of a bare AttributeError.

Tests

One regression test per fix: gap-fill with an inf-bounded template, malformed-.netrc
error, formula-kept-when-InChI-present (the existing test that asserted the drop is
updated accordingly), and the visualization-stub error.

Deliberately not changed

The plan also suggested pinning a pytest-cov floor in the dev extra. That edits the
same dev = [...] block as #22 (which adds mypy) for marginal value, so it is deferred
to avoid a needless merge conflict.

Verification

pytest (621 passed) and ruff check are green. mypy flags only pre-existing
errors in fill.py / download.py / excel.py (untyped optlang / notes access),
all within #22's type-fix scope — the lines added here introduce none (verified against
the develop baseline by diffing error counts). raven-python's CI gains its mypy job
with #22.

Tier 4 of the review: small, targeted hardening, no behaviour change on valid input.

- gapfilling/fill.py: clamp the connectivity gap-fill big-M to the largest finite
  bound magnitude, so a template reaction with an infinite bound no longer puts an
  infinite coefficient into the MILP (which broke the solver).
- reconstruction/kegg/download.py: a malformed or unreadable .netrc now raises a
  ValueError explaining how to fix it, instead of a raw NetrcParseError/OSError.
- io/excel.py: always write the metabolite formula to the METS COMPOSITION column;
  it was dropped whenever an InChI was present.
- visualization: the empty stub package raises a clear NotImplementedError (with a
  roadmap pointer) on attribute access, via a PEP 562 module __getattr__.

A regression test per fix.
@edkerk edkerk merged commit a4a9c3c into develop Jun 10, 2026
6 checks passed
@edkerk edkerk deleted the fix/tier4-polish branch June 10, 2026 07:42
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