From 875f9703a1708f328e4e68f01ec1146c8bafa79c Mon Sep 17 00:00:00 2001 From: user <59329744+dilpath@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:21:00 +0100 Subject: [PATCH 1/3] fix upsetplot --- .github/workflows/ci.yml | 2 +- .readthedocs.yaml | 1 + petab_select/plot.py | 11 ++++++++++- pyproject.toml | 3 ++- requirements_upsetplot.txt | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 requirements_upsetplot.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c810e8b1..8f003b80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: libhdf5-serial-dev - name: Install Python dependencies - run: pip install -r requirements_dev.txt + run: pip install -r requirements_dev.txt -r requirements_upsetplot.txt - name: Run tox run: python -m tox diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 508900c4..e18c7579 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -17,6 +17,7 @@ python: path: . extra_requirements: - doc + requirements: requirements_upsetplot.txt build: os: "ubuntu-22.04" diff --git a/petab_select/plot.py b/petab_select/plot.py index 04b6e695..074acc6d 100644 --- a/petab_select/plot.py +++ b/petab_select/plot.py @@ -15,7 +15,11 @@ import matplotlib.ticker import networkx as nx import numpy as np -import upsetplot + +try: + import upsetplot +except ImportError: + upsetplot = None from . import analyze from .constants import Criterion @@ -218,6 +222,11 @@ def upset(plot_data: PlotData) -> dict[str, matplotlib.axes.Axes | None]: The plot axes (see documentation from the `upsetplot `__ package). """ + if upsetplot is None: + raise ImportError( + "Please install upsetplot, e.g. with the following command: " + "pip install git+https://github.com/jnothman/UpSetPlot.git@08f0648368122303075cbb2835ae7fea0f7f07df" + ) # Get delta criterion values values = np.array( plot_data.models.get_criterion( diff --git a/pyproject.toml b/pyproject.toml index 5462e7a1..ab056b73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,8 @@ dependencies = [ [project.optional-dependencies] plot = [ "matplotlib>=2.2.3", - "upsetplot", + # disabled with a manual install message until https://github.com/jnothman/UpSetPlot/issues/303 + # "upsetplot", ] test = [ "pytest >= 5.4.3", diff --git a/requirements_upsetplot.txt b/requirements_upsetplot.txt new file mode 100644 index 00000000..ae99831b --- /dev/null +++ b/requirements_upsetplot.txt @@ -0,0 +1 @@ +git+https://github.com/jnothman/UpSetPlot.git@08f0648368122303075cbb2835ae7fea0f7f07df From fc136f48fa8b9b42de2e06b12baa453a6e58cfb2 Mon Sep 17 00:00:00 2001 From: user <59329744+dilpath@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:24:36 +0100 Subject: [PATCH 2/3] fix rtd deps --- .readthedocs.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index e18c7579..17d9cb75 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -17,7 +17,8 @@ python: path: . extra_requirements: - doc - requirements: requirements_upsetplot.txt + # keep until upsetplot can be installed from pypi + - requirements: requirements_upsetplot.txt build: os: "ubuntu-22.04" From 68be413083052bfb29eb7a4a0975ec94be959390 Mon Sep 17 00:00:00 2001 From: user <59329744+dilpath@users.noreply.github.com> Date: Thu, 12 Mar 2026 17:38:49 +0100 Subject: [PATCH 3/3] fix code blocks; remove readthedocs ext from local builds --- doc/analysis.rst | 4 ++-- doc/conf.py | 1 - petab_select/analyze.py | 4 ++-- pyproject.toml | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/analysis.rst b/doc/analysis.rst index 888320c0..d09aa1ce 100644 --- a/doc/analysis.rst +++ b/doc/analysis.rst @@ -17,12 +17,12 @@ Model hashes are special objects in the library, that are generated from model-s This means you can reconstruct the model given some model hash. For example, with this model hash `M1-000`, you can reconstruct the :class:`petab_select.ModelHash` from a string, then reconstruct the :class:`petab_select.Model`. -.. code-block:: language +.. code-block:: python ModelHash.from_hash("M1-000").get_model(petab_select_problem) You can use this to get the uncalibrated version of a calibrated model. -.. code-block:: language +.. code-block:: python model.hash.get_model(petab_select_problem) diff --git a/doc/conf.py b/doc/conf.py index e21a5944..57249625 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -20,7 +20,6 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration extensions = [ - "readthedocs_ext.readthedocs", "sphinx.ext.napoleon", "sphinx.ext.autodoc", "sphinx.ext.intersphinx", diff --git a/petab_select/analyze.py b/petab_select/analyze.py index 77d44d15..7f0d2249 100644 --- a/petab_select/analyze.py +++ b/petab_select/analyze.py @@ -142,14 +142,14 @@ def get_best_by_iteration( *args, **kwargs, ) -> dict[int, Models]: - """Get the best model of each iteration. + r"""Get the best model of each iteration. See :func:``get_best`` for additional required arguments. Args: models: The models. - *args, **kwargs: + *args, \**kwargs: Forwarded to :func:``get_best``. Returns: diff --git a/pyproject.toml b/pyproject.toml index ab056b73..6d72fa00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,6 @@ doc = [ "nbconvert>=7.16.4", "ipykernel>= 6.23.1", "ipython>=7.21.0", - "readthedocs-sphinx-ext>=2.2.5", "sphinx-autodoc-typehints", "petab_select[plot]", ]