%global srcname sbmlutils Name: python-%{srcname} Version: 0.17.0 Release: 2%{?dist} Summary: Python utilities for creating, reading, annotating and reporting SBML models License: MIT URL: https://github.com/matthiaskoenig/sbmlutils Source: %{pypi_source %{srcname}} # Snapshot of the identifiers.org registry (resolutionApi/getResolverDataset, # 865 namespaces, fetched 2026-09-25 through pymetadata), CC BY 4.0 per # https://docs.identifiers.org/pages/terms_of_use.html. Test data only: it is # not installed. See %%check. Source1: identifiers_registry-2026-09-25.json BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # No python3dist() tag in Fedora for the PyPI name python-libsbml (see %%prep). BuildRequires: python3-libsbml # %%check: conftest.py imports matplotlib to force the Agg backend, and the # example and roundtrip tests simulate with roadrunner. Both are upstream # "examples" extras rather than runtime dependencies of the library. BuildRequires: python3-pytest BuildRequires: python3-matplotlib BuildRequires: python3-roadrunner %global _description %{expand: sbmlutils is Matthias Konig's toolbox for SBML: a factory that builds models from plain Python objects and writes valid SBML, a validator that reports libsbml's findings readably, HTML model reports, annotation of models from spreadsheets, and converters to and from Antimony, XPP and ODE code. It covers the L3 packages -- comp, fbc, distrib, layout -- rather than the core alone. It is the model-authoring counterpart to the simulation stack: build and annotate here, simulate with roadrunner or COPASI.} %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-sbmlutils package, so a # preamble Requires ships on nothing. Requires: python3-libsbml %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 is what Fedora rawhide carries; 43 to 45 are on # 5.20.5. %%check is what decides whether that matters on a given branch: the # suite either passes against the libsbml the chroot has or the build fails # there, which is the intended signal. 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 # Three more floors are the versions current on upstream's release day rather # than an API requirement. Fedora 44 carries pint 0.25.2 and xmltodict 0.14.2, # and certifi 2026.01.04. What sbmlutils uses of each: UnitRegistry and # UndefinedUnitError from pint; xmltodict.parse; and of certifi nothing at all, # it is requests' CA bundle, floored for GHSA-6q48-6c7w-9gw2 (the emSign roots), # and Fedora's python3-certifi serves the system bundle that ca-certificates # keeps current. All of the API predates these floors by years. for d in 'pint>=0.25.3:pint>=0.25' 'xmltodict>=1.0.2:xmltodict>=0.14' \ 'certifi>=2026.10.19:certifi>=2025'; do old=${d%%:*}; new=${d#*:} grep -qP "^\t\"$old\",\$" pyproject.toml || { echo "runtime floor '$old' not found" >&2; exit 1; } sed -i "s/^\t\"$old\",\$/\t\"$new\",/" pyproject.toml done %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{srcname} %check # Fedora's libsbml is built with the seven stable L3 packages -- LAYOUT, QUAL, # COMP, FBC, RENDER, GROUPS, MULTI -- and not DISTRIB, although libsbml's own # CMakeLists lists distrib among its stable packages (see the %%cmake line in # Fedora's libsbml.spec). sbmlutils reads # libsbml.DISTRIB_UNCERTTYPE_* at class-definition time in factory.py, so # without DISTRIB the module cannot even be imported. Diagnose that here rather # than leaving 19 files erroring at collection with an AttributeError. %{python3} -c 'import libsbml, sys; sys.exit(0 if hasattr(libsbml, "DISTRIB_UNCERTTYPE_COEFFIENTOFVARIATION") else 1)' || { \ echo "This libsbml has no distrib package; sbmlutils cannot be imported." >&2; \ echo "Fedora's libsbml needs -DENABLE_DISTRIB=ON. See the changelog." >&2; \ exit 1; } # Upstream's suite, minus two things it cannot read from a release artifact. # tests/test_roundtrip.py reads the vendored SBML Test Suite 3.4.0 models and # test_sbml_testsuite.py sweeps them; upstream's own [tool.hatch.build] exclude # keeps those 56 MB out of both the sdist and the wheel, so they exist only in # a git checkout. Against a distrib-enabled libsbml 5.21.2 the rest is green: # 0.17.0 gives 1456 passed, 75 skipped, offline with loopback up. # Two more cases read docs/ (interpolation.md, api/factory.md), which the sdist # also leaves out. # pymetadata downloads the identifiers.org registry at first use and caches it # in ~/.cache/pymetadata; Copr and Koji builds are offline, so 119 tests and 10 # fixtures failed on f43 and f44 without it. pymetadata falls back to an # outdated cached copy when the download fails, so seed one in a scratch HOME. export HOME=$PWD/test-home mkdir -p $HOME/.cache/pymetadata cp %{SOURCE1} $HOME/.cache/pymetadata/identifiers_registry.json # Deselected, on 0.17.0 against Fedora's libsbml: # - tests/examples/test_example_scripts.py runs the examples in a subprocess # with PYTHONPATH replaced by the source tree, which hides the installed # package; the same examples run in-process in test_examples.py. # - test_read_sbml_reads_a_file_without_an_xml_declaration expects libsbml to # report BadXMLDecl; Fedora's libsbml does not (cause not diagnosed). # - test_demo_annotation uses Model.parameters, which Fedora's libsbml bindings # lack (AttributeError); the PyPI wheel passed it in the earlier venv run. %pytest -q -m 'not sbml_testsuite' --ignore=tests/test_roundtrip.py \ --ignore=tests/examples/test_example_scripts.py \ --deselect 'tests/io/test_sbml.py::test_read_sbml_reads_a_file_without_an_xml_declaration' \ --deselect tests/metadata/test_annotator.py::test_demo_annotation \ --deselect tests/interpolation/test_interpolation_docs.py::test_guide_code_blocks_run \ --deselect tests/test_factory_facade.py::test_api_reference_lists_the_classes_and_functions %files -n python3-%{srcname} -f %{pyproject_files} %doc README.md %license LICENSE %changelog * Mon Oct 26 2026 Morgan Hough - 0.17.0-2 - %%check seeds pymetadata's identifiers.org registry cache from a bundled snapshot (CC BY 4.0, test data only): the offline builders failed 119 tests and 10 fixtures on f43/f44 without it. Deselect four environment-dependent tests (see %%check). The f45 segfaults were not sbmlutils: the f45 libsbml here was 5.21.2 against Fedora's 5.20.5, which antimony was built for. * Fri Oct 23 2026 Morgan Hough - 0.17.0-1 - Update to 0.17.0. New runtime dependency sbmlode >= 0.2.0 (python-sbmlode, added to this repo) for the ODE export; pymetadata >= 0.8.0 and antimony >= 3.1.3 are met by python-pymetadata 0.8.2 and python3-antimony 3.2.0. - Runtime floors: pydantic is no longer a dependency, so that relaxation goes. pint, xmltodict and certifi are relaxed (pint 0.25.2, xmltodict 0.14.2 and certifi 2026.01.04 are what Fedora 44 has); the rest are met as they stand. - Still not buildable on any Fedora branch: libsbml has no distrib package. Verified against PyPI's python-libsbml 5.21.2 and libroadrunner 2.11.0 in a venv: 1456 passed, 75 skipped, 0 failed, offline with loopback up. %%check skips two cases that read docs/, which the sdist omits (the same reason the full docs tree is absent), plus the roundtrip file as before. * Fri Sep 25 2026 Morgan Hough - 0.12.2-1 - Initial package: sbmlutils 0.12.2. Net-new to Fedora. - NOT YET BUILDABLE ON ANY FEDORA BRANCH, and not for a version reason. Fedora's libsbml enables LAYOUT, QUAL, COMP, FBC, RENDER, GROUPS and MULTI and not DISTRIB, on 44 and on rawhide alike (checked in the shipped libsbml.py of both python3-libsbml-5.20.5-12.fc44 and python3-libsbml-5.21.2-1.fc46). sbmlutils names libsbml's DISTRIB_UNCERTTYPE constants while defining a class in factory.py, so the module is unimportable without them and 19 test files error at collection. The fix is one flag in Fedora's libsbml spec, -DENABLE_DISTRIB=ON; the source tarball already carries src/sbml/packages/distrib. %%check diagnoses the condition rather than letting it surface as an AttributeError. - Verified that DISTRIB is the only blocker: with PyPI's python-libsbml 5.21.2, which does enable it, the suite gives 899 passed, 76 skipped, 57 failed, and every one of the 57 is tests/test_roundtrip.py reading an SBML Test Suite model that upstream's hatch config excludes from the sdist and the wheel. That file and the sbml_testsuite sweep are the only things %%check skips. - Seven runtime floors relaxed or dropped: python-libsbml has no dist tag in Fedora and is declared by hand, and six others (pydantic, pint, rich, markdown-it-py, xmltodict, requests) track upstream's release date rather than any API sbmlutils uses.