ode2sbml
ode2sbml converts Python-defined ordinary differential equation systems into standards-compliant SBML and PEtab artifacts.
The package is centered on a small intermediate representation, ODEModel, and exposes converters for:
-
Python ODE functions
Parse scipy-style RHS functions into an SBML-ready model IR.
-
Dict-of-formulas models
Define species, parameters, ODE formulas, assignment rules, and events as Python dictionaries.
-
SymPy symbolic systems
Convert symbolic ODE maps directly into SBML rate rules.
-
PEtab bundles
Generate SBML, condition, observable, measurement, parameter, and YAML files.
Core idea
Keep scientific model definition in Python, but export interoperable artifacts for simulation, validation, parameter estimation, and exchange.
Main capabilities
- SBML Level 3 Version 2 XML generation.
- PEtab v1 bundle generation.
- libSBML-based validation.
- SymPy to SBML MathML conversion.
- CLI auto-detection for three Python model conventions.
- Pydantic model IR with JSON round-trip support.
Installation
For local development:
Documentation dependencies
For this documentation setup, install mkdocs-material, mkdocstrings[python], and mkdocs-autorefs.
Minimal CLI example
Minimal Python example
from ode2sbml import from_dict, to_sbml
model = {
"species": {"x": 1.0},
"parameters": {"k": 0.2},
"odes": {"x": "-k*x"},
}
ir = from_dict(model, model_id="decay", model_name="Exponential decay")
to_sbml(ir, "decay.xml")
Documentation map
Start with Architecture, then use CLI for command-line workflows or Usage for Python API workflows.