Skip to content

Defer ODE input validation until ProtWise runtime#70

Merged
bibymaths merged 2 commits into
globalfrom
codex/fix-import-time-issues-with-empty-config.toml
Jun 18, 2026
Merged

Defer ODE input validation until ProtWise runtime#70
bibymaths merged 2 commits into
globalfrom
codex/fix-import-time-issues-with-empty-config.toml

Conversation

@bibymaths

Copy link
Copy Markdown
Owner

Motivation

  • Prevent import-time validation of [ode.inputs] so generic imports, logging, networkmodel imports, and pytest collection don't require ProtWise ODE inputs to be present.
  • Preserve strict validation semantics for the actual ProtWise/ODE run so missing inputs still raise clear errors at runtime.

Description

  • Replaced import-time required ODE path access in config/constants.py with import-safe defaults by returning an empty string when an ODE input is absent and added validate_ode_inputs() to perform strict checks on demand.
  • Added _validate_path_value() helper in config/constants.py to centralize required-key and optional-existence checks and exposed validate_ode_inputs(config, require_existing) for runtime validation.
  • Made INPUT_EXCEL_* constants default-safe ("") for generic imports in config/constants.py and updated config/config.py so defaults do not fabricate placeholder input paths when [ode.inputs] is absent.
  • Wired runtime validation into protwise/runner/main.py by calling validate_ode_inputs(config) before the pipeline reads input files, so missing inputs produce errors only when running ProtWise.

Testing

  • Attempted to run the project task pixi install -e dev and pixi run -e dev coverage-all but pixi is not available in this environment so those could not be executed.
  • Ran python -m pytest -q, which progressed past the previous import-time KeyError for [ode.inputs] and instead failed during collection due to missing external test dependencies (ModuleNotFoundError: No module named 'numpy', jax, nbformat, etc.), indicating import-time ODE input validation no longer blocks collection.
  • Verified modified Python files parse cleanly with ast.parse to ensure syntax correctness after edits.

Files changed and rationale:

  • config/constants.py: make ODE input constants import-safe, add validate_ode_inputs() and path validation helper so required checks are deferred to runtime.
  • config/config.py: stop fabricating default ODE input paths when inputs are absent so CLI/runtime reflects missing inputs rather than invented paths.
  • protwise/runner/main.py: call validate_ode_inputs(config) prior to reading input files so ProtWise execution still enforces required inputs.

Codex Task

@bibymaths bibymaths self-assigned this Jun 18, 2026
@bibymaths bibymaths added documentation Improvements or additions to documentation python Pull requests that update python code techstack Modification to techstack labels Jun 18, 2026
@bibymaths bibymaths merged commit 9649ebe into global Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex documentation Improvements or additions to documentation python Pull requests that update python code techstack Modification to techstack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant