From 68ab640ead3364cb5d2e7a238b31a839fdbeaa75 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 20 Oct 2026 14:47:00 +0200 Subject: [PATCH] Use dependency groups for development dependencies Move development-only dependencies from extras to dependency groups (`test`, `doc`, `dev`), keep feature extras (`antimony`, `combine`, `reports`, `sciml`, `vis`) and add an `all` extra. * `dev` (`test` + `pre-commit`) is the default group for `uv sync`. * Merge the former `ci` group into `test`, since the test suite requires `petabtests` and `benchmark_models_petab`. * Use pysb from master via `tool.uv.sources`. * Relax the `Jinja2` pin in `reports`. * Drop the unused `sphinxcontrib-napoleon`. * Read the Docs: install via `uv sync --group doc`. * CI: fetch the BNGL test corpus without syncing the project. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci_tests.yml | 4 +-- .readthedocs.yaml | 17 ++++----- doc/development.rst | 2 +- pyproject.toml | 63 ++++++++++++++++++---------------- 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 44919375..a140c3ab 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -30,11 +30,11 @@ jobs: if: matrix.platform == 'ubuntu-latest' - name: Fetch BNGL test corpus - run: uv run python tests/v1/fetch_bngl_corpus.py + run: uv run --no-project python -P tests/v1/fetch_bngl_corpus.py - name: Unit tests run: | - uv sync --group ci + uv sync --no-default-groups --group test uv pip list uv run pytest --cov=petab --cov-report=xml --cov-append --durations=10 tests diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 51f9841e..132b6768 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -11,11 +11,12 @@ build: os: "ubuntu-24.04" tools: python: "3.12" - -python: - install: - - method: pip - path: . - extra_requirements: - - doc - - vis + jobs: + pre_create_environment: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + create_environment: + - uv venv "${READTHEDOCS_VIRTUALENV_PATH}" + install: + - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --no-default-groups --group doc diff --git a/doc/development.rst b/doc/development.rst index 71b44d51..cf829692 100644 --- a/doc/development.rst +++ b/doc/development.rst @@ -85,7 +85,7 @@ To build the documentation, run: .. code-block:: bash - uv sync --extra doc --extra vis + uv sync --group doc cd doc make html # then open `build/html/index.html` in a browser diff --git a/pyproject.toml b/pyproject.toml index f1683d93..482c30ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,48 +33,26 @@ maintainers = [ ] [project.optional-dependencies] -tests = [ - "antimony>=3.1.0", - "copasi-basico>=0.85", - "petab_sciml", - "pysb", - "pytest", - "pytest-cov", - "scipy", -] -quality = [ - "pre-commit", -] -reports = [ - # https://github.com/spatialaudio/nbsphinx/issues/641 - "Jinja2==3.1.6", -] antimony = [ "antimony>=2.14.0", ] combine = [ "python-libcombine>=0.2.6", ] -doc = [ - "sphinx>=3.5.3, !=5.1.0", - "sphinxcontrib-napoleon>=0.7", - "sphinx-markdown-tables>=0.0.15", - "sphinx-rtd-theme>=0.5.1", - "m2r2", - "myst-nb>=0.14.0", - # https://github.com/spatialaudio/nbsphinx/issues/687#issuecomment-1339271312 - "ipython>=7.21.0, !=8.7.0", - "pysb", - "antimony>=2.14.0", -] vis = [ "matplotlib>=3.6.0", "seaborn", "scipy" ] +reports = [ + "Jinja2", +] sciml = [ "petab_sciml", ] +all = [ + "petab[antimony,combine,reports,sciml,vis]", +] [project.scripts] petablint = "petab.petablint:main" @@ -85,19 +63,44 @@ Repository = "https://github.com/PEtab-dev/libpetab-python" Documentation = "https://petab.readthedocs.io/projects/libpetab-python/" [dependency-groups] -ci = [ - "petab[tests,reports,combine,vis]", +test = [ + "petab[all]", + "antimony>=3.1.0", + "copasi-basico>=0.85", + "pysb", + "pytest", + "pytest-cov", + "scipy", "petabtests @ git+https://github.com/PEtab-dev/petab_test_suite@main", "benchmark_models_petab @ git+https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab.git@master#subdirectory=src/python", ] +doc = [ + "petab[antimony,vis]", + "sphinx>=3.5.3, !=5.1.0", + "sphinx-markdown-tables>=0.0.15", + "sphinx-rtd-theme>=0.5.1", + "m2r2", + "myst-nb>=0.14.0", + # https://github.com/spatialaudio/nbsphinx/issues/687#issuecomment-1339271312 + "ipython>=7.21.0, !=8.7.0", + "pysb", +] +dev = [ + {include-group = "test"}, + "pre-commit", +] [tool.uv] +default-groups = ["dev"] # pysb<1.17 fails to build: its legacy `ez_setup.py` bootstrap downloads # setuptools from a defunct pypi.python.org URL. constraint-dependencies = ["pysb>=1.17.0"] # pysb pins an older sympy than we need; force a newer one. override-dependencies = ["sympy>=1.12.1"] +[tool.uv.sources] +pysb = { git = "https://github.com/pysb/pysb", branch = "master" } + [tool.setuptools.packages.find] include = ["petab", "petab.*"] namespaces = false