diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c810e8b..8f003b8 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 508900c..17d9cb7 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -17,6 +17,8 @@ python: path: . extra_requirements: - doc + # keep until upsetplot can be installed from pypi + - requirements: requirements_upsetplot.txt build: os: "ubuntu-22.04" diff --git a/doc/analysis.rst b/doc/analysis.rst index 888320c..d09aa1c 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 e21a594..5724962 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 77d44d1..7f0d224 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/petab_select/plot.py b/petab_select/plot.py index 04b6e69..074acc6 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 5462e7a..6d72fa0 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", @@ -50,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]", ] diff --git a/requirements_upsetplot.txt b/requirements_upsetplot.txt new file mode 100644 index 0000000..ae99831 --- /dev/null +++ b/requirements_upsetplot.txt @@ -0,0 +1 @@ +git+https://github.com/jnothman/UpSetPlot.git@08f0648368122303075cbb2835ae7fea0f7f07df