From 10f825dbf471d929db96d0b99a3a4fd528353a86 Mon Sep 17 00:00:00 2001 From: Ilia Kats Date: Mon, 30 Nov 2026 11:34:35 +0100 Subject: [PATCH 1/8] Use the Git versions of all data structure packages If there is a breaking change in AnnData that requires its dependents to adapt, these changes may not be released until just before the corresponding AnnData release. So all packages that depend on AnnData and one of its affected dependents will use incompatible versions, causing the integration tests to fail. --- .github/workflows/integration-test.yml | 2 +- overrides-pre.txt | 1 + overrides.txt | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 overrides-pre.txt diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 906f7ba..0d46327 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -108,7 +108,7 @@ jobs: EXTRAS="test" fi fi - uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" git+https://github.com/scverse/anndata -c ../integration-testing/constraints.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides.txt' || ''}} $GROUP -v + uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt --override ../integration-testing/overrides.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v working-directory: ${{ matrix.package.name }} - name: Set failure type for install diff --git a/overrides-pre.txt b/overrides-pre.txt new file mode 100644 index 0000000..fccd884 --- /dev/null +++ b/overrides-pre.txt @@ -0,0 +1 @@ +pandas>=3 diff --git a/overrides.txt b/overrides.txt index 789f724..1f91cb4 100644 --- a/overrides.txt +++ b/overrides.txt @@ -1 +1,3 @@ -pandas>=3 \ No newline at end of file +anndata @ git+https://github.com/scverse/anndata@main +mudata @ git+https://github.com/scverse/mudata@main +spatialdata @ git+https://github.com/scverse/spatialdata@main From 080e7302384699ef733379f0a69bb0656c45f421 Mon Sep 17 00:00:00 2001 From: Ilia Kats Date: Mon, 30 Nov 2026 11:44:03 +0100 Subject: [PATCH 2/8] exclude current package from overrides --- .github/workflows/integration-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 0d46327..289b367 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -108,7 +108,8 @@ jobs: EXTRAS="test" fi fi - uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt --override ../integration-testing/overrides.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v + grep -v '^${{ matrix.package.name }} ' ../integration-testing/overrides.txt > ../integration-testing/.overrides.txt + uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt --override ../integration-testing/.overrides.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v working-directory: ${{ matrix.package.name }} - name: Set failure type for install From 04d47d8819b445b93a5bb038a165ddb922dd7d14 Mon Sep 17 00:00:00 2001 From: Ilia Kats Date: Tue, 1 Dec 2026 15:26:09 +0100 Subject: [PATCH 3/8] when testing pre-releases, use git versions of all scverse packages --- .github/workflows/integration-test.yml | 60 +++++++++++++++----------- packages.json | 15 +++++++ 2 files changed, 50 insertions(+), 25 deletions(-) create mode 100644 packages.json diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 289b367..66a9144 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -13,28 +13,29 @@ concurrency: cancel-in-progress: true jobs: + get-packages: + runs-on: ubuntu-slim + outputs: + packages: ${{ steps.get-packages.outputs.packages }} + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + filter: blob:none + - name: Get packages to tes + id: get-packages + run: | + PKGS=$(cat packages.json | jq -c) + echo "packages=$PKGS" | tee $GITHUB_OUTPUT + test: + needs: get-packages strategy: fail-fast: false matrix: python: ["3.13", "3.14"] is_pre: [true, false] - package: - # extras should be a comma seperated list of strings, like `extras: "lazy,accelerated"` - # The 'test' extra is always installed - - {name: "mudata", extras: ""} - - {name: "spatialdata", extras: ""} - - {name: "scirpy", extras: ""} - - {name: "muon", extras: ""} - - {name: "scanpy", extras: "scanpy2"} - - {name: "squidpy", extras: ""} - - {name: "scvi-tools", extras: "optional"} - - {name: "pertpy", extras: "de,tcoda"} - - {name: "decoupler", extras: ""} - - {name: "SnapATAC2", extras: ""} - - {name: "rapids-singlecell", extras: "rapids-cu13", gpu: true} - - {name: "liana", extras: "extras"} - - {name: "PyDESeq2", extras: ""} + package: ${{ fromJSON(needs.get-packages.outputs.packages) }} exclude: - { python: "3.13", is_pre: true } @@ -90,26 +91,35 @@ jobs: run: | uv pip install --system toml-cli - - name: Install AnnData and scverse package + - name: Install scverse package and dependencies env: UV_EXTRA_INDEX_URL: ${{ matrix.package.gpu && 'https://pypi.nvidia.com' || '' }} run: | - EXTRAS="" + EXTRAS="${{ join(matrix.package.extras, ',') }}" GROUP="" + if toml get 'dependency-groups.test' --toml-path pyproject.toml > /dev/null; then GROUP="--group test" - if [ -n "${{ matrix.package.extras }}" ]; then - EXTRAS="${{ matrix.package.extras }}" - fi else - if [ -n "${{ matrix.package.extras }}" ]; then - EXTRAS="test,${{ matrix.package.extras }}" + if [ -n "EXTRAS" ]; then + EXTRAS="test,$EXTRAS" else EXTRAS="test" fi fi - grep -v '^${{ matrix.package.name }} ' ../integration-testing/overrides.txt > ../integration-testing/.overrides.txt - uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt --override ../integration-testing/.overrides.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v + grep -v '^${{ matrix.package.name }} ' ../integration-testing/overrides.txt > $RUNNER_TEMP/overrides.txt + + if ${{ matrix.is_pre }} ; then + uv pip install --dry-run --no-progress --system --prerelease allow .[$EXTRAS] -c ../integration-testing/constraints.txt --override $RUNNER_TEMP/overrides.txt --override ../integration-testing/overrides-pre.txt $GROUP 2>&1 > /dev/null | grep '^ + ' | sed -E 's/^ \+ ([^ =]+)/\1/' > $RUNNER_TEMP/requirements.txt + cat $RUNNER_TEMP/requirements.txt + + for pkg in $(cat ../integration-testing/packages.json | jq -r '.[] | .name' | sort) ; do + sed -iE "s%^${pkg}[\s=]+.+$%${pkg} @ git+https://github.com/scverse/${pkg}@main%" $RUNNER_TEMP/requirements.txt + done + uv pip install --compile --system -r $RUNNER_TEMP/requirements.txt -v + else + uv pip install --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt --override $RUNNER_TEMP/overrides.txt $GROUP -v + fi working-directory: ${{ matrix.package.name }} - name: Set failure type for install diff --git a/packages.json b/packages.json new file mode 100644 index 0000000..934591d --- /dev/null +++ b/packages.json @@ -0,0 +1,15 @@ +[ + {"name": "mudata"}, + {"name": "spatialdata"}, + {"name": "scirpy"}, + {"name": "muon"}, + {"name": "scanpy", "extras": ["scanpy2"]}, + {"name": "squidpy"}, + {"name": "scvi-tools", "extras": ["optional"]}, + {"name": "pertpy", "extras": ["de", "tcoda"]}, + {"name": "decoupler"}, + {"name": "SnapATAC2"}, + {"name": "rapids-singlecell", "extras": ["rapids-cu13"], "gpu": true}, + {"name": "liana", "extras": ["extras"]}, + {"name": "PyDESeq2"} +] From 3230816ad166a5768e433f5a356760bae5f6c0a3 Mon Sep 17 00:00:00 2001 From: Ilia Kats Date: Tue, 1 Dec 2026 17:49:11 +0100 Subject: [PATCH 4/8] use constraints --- .github/workflows/integration-test.yml | 15 ++++++--------- overrides.txt => constraints-scverse.txt | 0 2 files changed, 6 insertions(+), 9 deletions(-) rename overrides.txt => constraints-scverse.txt (100%) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 66a9144..dd7e5dd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -107,19 +107,16 @@ jobs: EXTRAS="test" fi fi - grep -v '^${{ matrix.package.name }} ' ../integration-testing/overrides.txt > $RUNNER_TEMP/overrides.txt + grep -v '^${{ matrix.package.name }} ' ../integration-testing/constraints-scverse.txt > $RUNNER_TEMP/constraints.txt if ${{ matrix.is_pre }} ; then - uv pip install --dry-run --no-progress --system --prerelease allow .[$EXTRAS] -c ../integration-testing/constraints.txt --override $RUNNER_TEMP/overrides.txt --override ../integration-testing/overrides-pre.txt $GROUP 2>&1 > /dev/null | grep '^ + ' | sed -E 's/^ \+ ([^ =]+)/\1/' > $RUNNER_TEMP/requirements.txt - cat $RUNNER_TEMP/requirements.txt - - for pkg in $(cat ../integration-testing/packages.json | jq -r '.[] | .name' | sort) ; do - sed -iE "s%^${pkg}[\s=]+.+$%${pkg} @ git+https://github.com/scverse/${pkg}@main%" $RUNNER_TEMP/requirements.txt + for pkg in $(cat ../integration-testing/packages.json | jq -r '.[] | .name') ; do + if [ "${pkg}" != ${{ matrix.package.name }} ] ; then + echo "${pkg} @ git+https://github.com/scverse/${pkg}@main" >> $RUNNER_TEMP/constraints.txt + fi done - uv pip install --compile --system -r $RUNNER_TEMP/requirements.txt -v - else - uv pip install --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt --override $RUNNER_TEMP/overrides.txt $GROUP -v fi + uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt -c $RUNNER_TEMP/constraints.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v working-directory: ${{ matrix.package.name }} - name: Set failure type for install diff --git a/overrides.txt b/constraints-scverse.txt similarity index 100% rename from overrides.txt rename to constraints-scverse.txt From 879099c065438eb3645af3299aa71ac6c8bcb093 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 3 Dec 2026 09:28:02 +0100 Subject: [PATCH 5/8] simplify --- .github/workflows/integration-test-r.yml | 4 ++++ .github/workflows/integration-test.yml | 17 +++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/integration-test-r.yml b/.github/workflows/integration-test-r.yml index 6cbb97d..0603c77 100644 --- a/.github/workflows/integration-test-r.yml +++ b/.github/workflows/integration-test-r.yml @@ -15,6 +15,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +defaults: + run: + shell: bash + jobs: test: strategy: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index dd7e5dd..11014fd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -12,6 +12,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +defaults: + run: + shell: bash + jobs: get-packages: runs-on: ubuntu-slim @@ -39,10 +43,6 @@ jobs: exclude: - { python: "3.13", is_pre: true } - defaults: - run: - shell: bash -leo pipefail {0} - runs-on: ${{ matrix.package.gpu && format('cirun-aws-gpu--{0}', github.run_id) || 'ubuntu-latest' }} steps: @@ -110,11 +110,9 @@ jobs: grep -v '^${{ matrix.package.name }} ' ../integration-testing/constraints-scverse.txt > $RUNNER_TEMP/constraints.txt if ${{ matrix.is_pre }} ; then - for pkg in $(cat ../integration-testing/packages.json | jq -r '.[] | .name') ; do - if [ "${pkg}" != ${{ matrix.package.name }} ] ; then - echo "${pkg} @ git+https://github.com/scverse/${pkg}@main" >> $RUNNER_TEMP/constraints.txt - fi - done + jq -r --arg self '${{ matrix.package.name }}' \ + '.[].name | select(. != $self) | "\(.) @ git+https://github.com/scverse/\(.)@main"' \ + ../integration-testing/packages.json >> $RUNNER_TEMP/constraints.txt fi uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt -c $RUNNER_TEMP/constraints.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v working-directory: ${{ matrix.package.name }} @@ -170,7 +168,6 @@ jobs: - name: Re-enable workflow env: GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN || github.token }} - shell: sh run: | for WORKFLOW in integration-test.yml integration-test-r.yml; do gh api --verbose -X PUT "repos/${GITHUB_REPOSITORY}/actions/workflows/${WORKFLOW}/enable" From ba9290af70773b8dcfbf5723abc85cd5d9718ea2 Mon Sep 17 00:00:00 2001 From: Ilia Kats Date: Thu, 3 Dec 2026 09:34:45 +0100 Subject: [PATCH 6/8] fix extras check --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 11014fd..074c9ca 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -101,7 +101,7 @@ jobs: if toml get 'dependency-groups.test' --toml-path pyproject.toml > /dev/null; then GROUP="--group test" else - if [ -n "EXTRAS" ]; then + if [ -n "$EXTRAS" ]; then EXTRAS="test,$EXTRAS" else EXTRAS="test" From 02f68f652a8c58286286ce7584178f373716704f Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 3 Dec 2026 09:35:11 +0100 Subject: [PATCH 7/8] python --- .github/workflows/integration-test.yml | 29 ++------------ scripts/install.py | 52 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 scripts/install.py diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 074c9ca..fecc0fd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -87,34 +87,13 @@ jobs: with: workspaces: ${{ matrix.package.name }} - - name: Install toml parsers - run: | - uv pip install --system toml-cli - - name: Install scverse package and dependencies env: UV_EXTRA_INDEX_URL: ${{ matrix.package.gpu && 'https://pypi.nvidia.com' || '' }} - run: | - EXTRAS="${{ join(matrix.package.extras, ',') }}" - GROUP="" - - if toml get 'dependency-groups.test' --toml-path pyproject.toml > /dev/null; then - GROUP="--group test" - else - if [ -n "$EXTRAS" ]; then - EXTRAS="test,$EXTRAS" - else - EXTRAS="test" - fi - fi - grep -v '^${{ matrix.package.name }} ' ../integration-testing/constraints-scverse.txt > $RUNNER_TEMP/constraints.txt - - if ${{ matrix.is_pre }} ; then - jq -r --arg self '${{ matrix.package.name }}' \ - '.[].name | select(. != $self) | "\(.) @ git+https://github.com/scverse/\(.)@main"' \ - ../integration-testing/packages.json >> $RUNNER_TEMP/constraints.txt - fi - uv pip install ${{ matrix.is_pre && '--prerelease allow' || '' }} --compile --system ".[$EXTRAS]" -c ../integration-testing/constraints.txt -c $RUNNER_TEMP/constraints.txt ${{ matrix.is_pre && '--override ../integration-testing/overrides-pre.txt' || ''}} $GROUP -v + PACKAGE: ${{ matrix.package.name }} + EXTRAS: ${{ toJSON(matrix.package.extras) }} + IS_PRE: ${{ matrix.is_pre }} + run: python ../integration-testing/scripts/install.py working-directory: ${{ matrix.package.name }} - name: Set failure type for install diff --git a/scripts/install.py b/scripts/install.py new file mode 100644 index 0000000..6995109 --- /dev/null +++ b/scripts/install.py @@ -0,0 +1,52 @@ +"""Install the scverse package checked out in the current directory, with its test dependencies. + +Inputs (environment variables): +- ``PACKAGE``: the package's name, as in ``packages.json`` +- ``EXTRAS``: JSON list of extras to install (or ``null``) +- ``IS_PRE``: ``true`` to test against pre-releases and the scverse packages' ``main`` branches +""" + +import json +import os +import subprocess +import sys +import tomllib +from pathlib import Path +from tempfile import NamedTemporaryFile + +ROOT = Path(__file__).parent.parent + +package = os.environ["PACKAGE"] +extras: list[str] = json.loads(os.environ.get("EXTRAS") or "null") or [] +is_pre = os.environ.get("IS_PRE") == "true" + +pyproject = tomllib.loads(Path("pyproject.toml").read_text()) +has_test_group = "test" in pyproject.get("dependency-groups", {}) +if not has_test_group: + extras = ["test", *extras] + +# the package under test comes from its checkout, so don't constrain it +constraints = [ + line + for line in (ROOT / "constraints-scverse.txt").read_text().splitlines() + if not line.startswith(f"{package} ") +] +if is_pre: + constraints += [ + f"{name} @ git+https://github.com/scverse/{name}@main" + for p in json.loads((ROOT / "packages.json").read_text()) + if (name := p["name"]) != package + ] + +with NamedTemporaryFile("w", suffix=".txt") as constraints_file: + constraints_file.write("\n".join(dict.fromkeys(constraints)) + "\n") + constraints_file.flush() + cmd = [ + *("uv", "pip", "install", "--compile", "--system", "-v"), + f".[{','.join(extras)}]" if extras else ".", + *("-c", ROOT / "constraints.txt", "-c", constraints_file.name), + *(("--group", "test") if has_test_group else ()), + *(("--prerelease", "allow", "--override", ROOT / "overrides-pre.txt") if is_pre else ()), + ] + print(*cmd, flush=True) + sys.exit(subprocess.run(cmd, check=False).returncode) From cb711b1e6faad2600a101e5c15cc6ac876d807cf Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Thu, 3 Dec 2026 09:39:56 +0100 Subject: [PATCH 8/8] fewer files --- constraints-scverse.txt | 3 --- overrides-pre.txt | 1 - scripts/install.py | 49 ++++++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 27 deletions(-) delete mode 100644 constraints-scverse.txt delete mode 100644 overrides-pre.txt diff --git a/constraints-scverse.txt b/constraints-scverse.txt deleted file mode 100644 index 1f91cb4..0000000 --- a/constraints-scverse.txt +++ /dev/null @@ -1,3 +0,0 @@ -anndata @ git+https://github.com/scverse/anndata@main -mudata @ git+https://github.com/scverse/mudata@main -spatialdata @ git+https://github.com/scverse/spatialdata@main diff --git a/overrides-pre.txt b/overrides-pre.txt deleted file mode 100644 index fccd884..0000000 --- a/overrides-pre.txt +++ /dev/null @@ -1 +0,0 @@ -pandas>=3 diff --git a/scripts/install.py b/scripts/install.py index 6995109..ecd5cec 100644 --- a/scripts/install.py +++ b/scripts/install.py @@ -12,41 +12,44 @@ import sys import tomllib from pathlib import Path -from tempfile import NamedTemporaryFile +from tempfile import TemporaryDirectory ROOT = Path(__file__).parent.parent +# always installed from their main branch +DATASTRUCTURES = ("anndata", "mudata", "spatialdata") +# overrides when testing pre-releases +OVERRIDES_PRE = ("pandas>=3",) + package = os.environ["PACKAGE"] -extras: list[str] = json.loads(os.environ.get("EXTRAS") or "null") or [] +extras_matrix: tuple[str, ...] = tuple(json.loads(os.environ.get("EXTRAS") or "null") or ()) is_pre = os.environ.get("IS_PRE") == "true" pyproject = tomllib.loads(Path("pyproject.toml").read_text()) has_test_group = "test" in pyproject.get("dependency-groups", {}) -if not has_test_group: - extras = ["test", *extras] +extras = extras_matrix if has_test_group else ("test", *extras_matrix) +from_git = ( + *DATASTRUCTURES, + *(p["name"] for p in json.loads((ROOT / "packages.json").read_text()) if is_pre), +) # the package under test comes from its checkout, so don't constrain it -constraints = [ - line - for line in (ROOT / "constraints-scverse.txt").read_text().splitlines() - if not line.startswith(f"{package} ") -] -if is_pre: - constraints += [ - f"{name} @ git+https://github.com/scverse/{name}@main" - for p in json.loads((ROOT / "packages.json").read_text()) - if (name := p["name"]) != package - ] - -with NamedTemporaryFile("w", suffix=".txt") as constraints_file: - constraints_file.write("\n".join(dict.fromkeys(constraints)) + "\n") - constraints_file.flush() - cmd = [ +constraints = tuple( + f"{name} @ git+https://github.com/scverse/{name}@main" + for name in dict.fromkeys(from_git) + if name != package +) + +with TemporaryDirectory() as tmp: + constraints_file, overrides_file = Path(tmp, "constraints.txt"), Path(tmp, "overrides.txt") + constraints_file.write_text("\n".join(constraints) + "\n") + overrides_file.write_text("\n".join(OVERRIDES_PRE) + "\n") + cmd = ( *("uv", "pip", "install", "--compile", "--system", "-v"), f".[{','.join(extras)}]" if extras else ".", - *("-c", ROOT / "constraints.txt", "-c", constraints_file.name), + *("-c", ROOT / "constraints.txt", "-c", constraints_file), *(("--group", "test") if has_test_group else ()), - *(("--prerelease", "allow", "--override", ROOT / "overrides-pre.txt") if is_pre else ()), - ] + *(("--prerelease", "allow", "--override", overrides_file) if is_pre else ()), + ) print(*cmd, flush=True) sys.exit(subprocess.run(cmd, check=False).returncode)