%global srcname sbmlode Name: python-%{srcname} Version: 0.3.1 Release: 1%{?dist} Summary: Write the ODEs of SBML models as Python, Julia and R code and as documents License: MIT URL: https://github.com/matthiaskoenig/sbmlode Source: %{pypi_source %{srcname}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # No python3dist() tag in Fedora for the PyPI name python-libsbml (see below). BuildRequires: python3-libsbml # %%check. Upstream's "test" extra also wants diffrax/JAX, typst and libroadrunner # pins; the cases that need an absent tool skip themselves, and the ones that # can run do: python code generation checked against roadrunner, units, symbols, # printers, events, safety and the SBML test-suite helpers. BuildRequires: python3-pytest BuildRequires: python3-numpy BuildRequires: python3-pandas BuildRequires: python3-scipy BuildRequires: python3-antimony BuildRequires: python3-roadrunner BuildRequires: python3-markdown-it-py %global _description %{expand: sbmlode reads an SBML model and writes its ordinary differential equations as ready-to-run code: Python (with a scipy `simulate`), diffrax on JAX, Julia and R, and as documents in LaTeX, typst and Markdown. It resolves assignment and initial-assignment rules, events, function definitions, units and the distrib sampling functions, and refuses models it cannot translate faithfully (delays, fast reactions, algebraic rules) instead of writing wrong code. It is the ODE export that sbmlutils re-exports as sbmlutils.converters.ode. The Python target needs numpy, pandas and scipy to run; the diffrax, Julia and R targets need their own runtimes and are optional.} %description %_description %package -n python3-%{srcname} Summary: %{summary} # Runtime dependency rpm cannot generate: Fedora's python3-libsbml carries no # python3dist() tag for the PyPI name python-libsbml. It belongs here and not # in the preamble -- this spec never builds a python-sbmlode package. Requires: python3-libsbml Recommends: python3-numpy Recommends: python3-pandas Recommends: python3-scipy %description -n python3-%{srcname} %_description %prep %autosetup -p1 -n %{srcname}-%{version} # python-libsbml has no dist tag in Fedora; declared by hand above. Upstream # floors it at 5.21.2, which rawhide carries; 43 to 45 are on 5.20.5. %%check # is what decides whether that matters on a given branch. grep -qP '^\t"python-libsbml>=5\.21\.2",$' pyproject.toml || { echo "python-libsbml dependency not found" >&2; exit 1; } sed -i '/^\t"python-libsbml>=5\.21\.2",$/d' pyproject.toml %generate_buildrequires # Runtime only: the extras (simulate, diffrax, test, dev) pull JAX, diffrax, # typst and tox, which Fedora does not carry and %%check does not need. %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{srcname} %check # sbmlode names libsbml.AST_DISTRIB_FUNCTION_* in analysis.py at import time, # so, like sbmlutils, it is unusable on a libsbml built without the distrib # package. Fedora's is (its %%cmake enables LAYOUT, QUAL, COMP, FBC, RENDER, # GROUPS and MULTI only). Diagnose that here instead of an AttributeError. %{python3} -c 'import libsbml, sys; sys.exit(0 if hasattr(libsbml, "AST_DISTRIB_FUNCTION_NORMAL") else 1)' || { \ echo "This libsbml has no distrib package; sbmlode cannot be imported." >&2; \ echo "Fedora's libsbml needs -DENABLE_DISTRIB=ON. See the changelog." >&2; \ exit 1; } # test_ode_docs imports scripts/docs_images.py, which upstream's sdist leaves # out (its hatch only-include lists src, tests, tox.ini and the docs files), and # needs typst. The julia, R and diffrax files need their runtimes and skip # themselves when those are missing; they are ignored here so a collection error # cannot hide behind a skip. The full SBML test-suite sweep is marked slow. %pytest -q -m 'not sbml_testsuite and not slow' \ --ignore=tests/test_ode_docs.py \ --ignore=tests/test_ode_diffrax.py \ --ignore=tests/test_ode_julia.py \ --ignore=tests/test_ode_r.py %files -n python3-%{srcname} -f %{pyproject_files} %doc README.md %license LICENSE %changelog * Fri Oct 23 2026 Morgan Hough - 0.3.1-1 - Initial package: sbmlode 0.3.1 (MIT, pure Python >= 3.12). Net-new to Fedora; required by sbmlutils >= 0.16. - NOT YET BUILDABLE ON ANY FEDORA BRANCH, for the reason sbmlutils is not: Fedora's libsbml is built without the distrib package, and sbmlode reads libsbml.AST_DISTRIB_FUNCTION_NORMAL..RAYLEIGH while importing. %%check diagnoses it. With PyPI's python-libsbml 5.21.2 and libroadrunner 2.11.0, which do enable distrib, the suite gives 2243 passed, 535 skipped (no JAX/diffrax, Julia, R or typst), 4 deselected, 0 failed, offline. - Only runtime dependencies are libsbml and jinja2; numpy, pandas and scipy are Recommends because the generated Python runs on them while sbmlode writes the code without.