%global srcname cobra %global ghname cobrapy Name: python-%{srcname} Version: 0.32.1 Release: 2%{?dist} Summary: Constraint-based modelling of metabolic networks # LICENSE holds the GNU GPL v2 and the GNU LGPL v2 texts; the README says "released # under both the GPL and LGPL licenses version 2 or later. You may choose which # license you choose to use the software under", and setup.cfg says the same. License: GPL-2.0-or-later OR LGPL-2.0-or-later URL: https://opencobra.github.io/cobrapy # Not the sdist: PyPI's omits tests/. Source: https://github.com/opencobra/cobrapy/archive/%{version}/%{ghname}-%{version}.tar.gz # Rewrites tests/data/*.pickle for Python 3.15 (see %%prep). Source1: cobra-convert-test-pickles.py # pandas 3 no longer falls back to positional [0] on a string-indexed Series or # float()s a one-row Series. One library line, one test. Patch: cobra-0.32.1-pandas3-positional-getitem.patch 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 BuildRequires: python3-pytest BuildRequires: python3-pytest-benchmark BuildRequires: python3-pytest-mock BuildRequires: python3-scipy BuildRequires: python3-optlang BuildRequires: python3-swiglpk %global _description %{expand: COBRApy is a package for constraint-based reconstruction and analysis of metabolic networks. It builds and edits genome-scale models (reactions, metabolites, genes, compartments), reads and writes SBML with the FBC and groups packages, JSON, YAML and MATLAB, and runs flux balance analysis, flux variability analysis, parsimonious FBA, gene and reaction deletion screens, sampling and medium design on any solver optlang supports; GLPK is the one packaged here.} %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-cobra package. Requires: python3-libsbml # The "array" extra: used by sampling and by some model-to-matrix conversions. Recommends: python3-scipy %description -n python3-%{srcname} %_description %prep %autosetup -p1 -n %{ghname}-%{version} # python-libsbml has no dist tag in Fedora; declared by hand above. grep -q '^ python-libsbml ~=5.19$' setup.cfg || { echo "python-libsbml dependency not found" >&2; exit 1; } sed -i '/^ python-libsbml ~=5.19$/d' setup.cfg # "future" is declared but nothing under src/ imports it (checked: no # "from future", "import future", "from builtins" or "past."), it is unmaintained # and no longer in Fedora. grep -q '^ future$' setup.cfg || { echo "future dependency not found" >&2; exit 1; } sed -i '/^ future$/d' setup.cfg # pandas >=1.0,<3.0: Fedora 45 and rawhide ship pandas 3.0.x, which dnf cannot # match against the cap. The suite below runs on whatever pandas the chroot has. grep -q '^ pandas >=1.0,<3.0$' setup.cfg || { echo "pandas pin not found" >&2; exit 1; } sed -i 's/^ pandas >=1.0,<3.0$/ pandas >=1.0/' setup.cfg %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{srcname} %check # Python 3.15 made the ast node constructors require their fields, and the # pickles under tests/data hold ast.Name/BoolOp nodes saved by the older # protocol as Name() with no arguments, so loading them raised TypeError and # took down every fixture built on mini.pickle. Re-pickle them with a loader # that skips __init__. Only the test data changes; cobra itself pickles fine on # 3.15, whose ast reduce passes (None, None). if %{python3} -c 'import sys; sys.exit(0 if sys.version_info >= (3, 15) else 1)'; then %{py3_test_envvars} %{python3} %{SOURCE1} tests/data fi # Upstream's suite, minus the one case that downloads e_coli_core from BiGG. # The benchmark fixtures are skipped (--benchmark-skip), as upstream's own tox # does by default. %pytest -q tests --benchmark-skip \ --deselect "tests/test_io/test_web/test_load.py::test_remote_load" %files -n python3-%{srcname} -f %{pyproject_files} %doc README.rst INSTALL.rst %changelog * Sun Oct 25 2026 Morgan Hough - 0.32.1-2 - Fix the Fedora 45 and rawhide test failures (Python 3.15, pandas 3): re-pickle tests/data/*.pickle with a loader that skips ast __init__ (they held Name()/BoolOp() nodes the 3.15 constructors reject), and patch one positional Series[0] in medium/boundary_types.py plus one test that float()ed a Series. Locally on rawhide: 495 passed, 69 skipped, 9 xfailed, 0 failed (test_show_versions excluded, it needs cobra installed). * Fri Oct 23 2026 Morgan Hough - 0.32.1-1 - Initial package: COBRApy 0.32.1. Net-new to Fedora; pure Python. Licence is the choice of GPL-2.0-or-later or LGPL-2.0-or-later, as the LICENSE file (both texts), README and setup.cfg state. - Needs three packages that are also new here: python-optlang, python-swiglpk (the only compiled one) and python-depinfo. python-libsbml is declared by hand as in the other SBML specs; "future" is dropped, unused. - Source is the GitHub tag, not the sdist, which has no tests. - Offline on f44 (loopback up) with swiglpk 5.0.13 from PyPI: 500 passed, 66 skipped (CPLEX, Gurobi, HiGHS, CBC etc. not installed), 11 xfailed, 1 failed - the BiGG download, deselected. The bundled example models (iJO1366, salmonella, textbook, mini) state no licence in their files. - Drop the pandas <3 cap: the Fedora 45 and rawhide builds could not install pandas 3.