From 24292f868543285091b5782b124254dbb6fb08e0 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Tue, 25 Aug 2026 18:29:52 +0200 Subject: [PATCH 1/4] chore: test against conda-forge using pixi in place of tox-conda --- .github/workflows/tests.yml | 52 ++++---------------- .gitignore | 1 + build_utils/create_environment_yml.sh | 15 ------ build_utils/pyproject_toml_to_yaml.py | 31 ------------ pixi.toml | 70 +++++++++++++++++++++++++++ tox.ini | 8 --- 6 files changed, 80 insertions(+), 97 deletions(-) delete mode 100644 build_utils/create_environment_yml.sh delete mode 100644 build_utils/pyproject_toml_to_yaml.py create mode 100644 pixi.toml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ac045c0d7..4b7c4defd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -197,16 +197,15 @@ jobs: needs: download_data steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v4.0.1 + - uses: prefix-dev/setup-pixi@v0.10.1 with: - miniforge-version: latest - use-mamba: true - channels: conda-forge - channel-priority: strict - python-version: "3.12" + environments: "test-py313-pyside6" - - uses: tlambert03/setup-qt-libs@v1 + - name: Setup headless display + uses: pyvista/setup-headless-display-action@5bc8de3bc71fcda7a96439571287a554901541a0 # v4.3 + with: + qt: true + wm: herbstluftwm - name: Download test data uses: actions/download-artifact@v8 @@ -214,41 +213,8 @@ jobs: name: test_data path: test_data - - name: Use mamba solver - shell: "bash -el {0}" - run: | - conda install -n base conda-libmamba-solver - conda config --set solver libmamba - - - name: Install dependencies - shell: "bash -el {0}" - run: | - mamba install -y "tox-conda>=0.10.0" - - - name: List environment packages - shell: "bash -el {0}" - run: conda list - - - name: create environment - shell: "bash -el {0}" - run: bash build_utils/create_environment_yml.sh - - - name: Upload environment file - uses: actions/upload-artifact@v7 - with: - name: environment - path: environment.yml - retention-days: 5 - - - name: patch tox.ini - shell: "bash -el {0}" - run: sed -e "s/{sys_platform}/{platform}/g" tox.ini -i - - - name: Test with tox - uses: aganders3/headless-gui@v2 - with: - run: conda run -n test --no-capture-output tox -e py312-PySide2-conda - timeout-minutes: 60 + - name: Run tests + run: pixi run -e py313-pyside6-conda test check-package: name: Build & inspect our package. diff --git a/.gitignore b/.gitignore index b9f66fd5c..f5cb6b550 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +pixi.lock report-*.json environment.yml minimum-constrains.txt diff --git a/build_utils/create_environment_yml.sh b/build_utils/create_environment_yml.sh deleted file mode 100644 index c003ef38f..000000000 --- a/build_utils/create_environment_yml.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -dependencies=$(python build_utils/pyproject_toml_to_yaml.py) - -cat < environment.yml -name: test -channels: - - conda-forge -dependencies: -$dependencies - - pyqt - - python=3.12 -EOF diff --git a/build_utils/pyproject_toml_to_yaml.py b/build_utils/pyproject_toml_to_yaml.py deleted file mode 100644 index 9edbbea78..000000000 --- a/build_utils/pyproject_toml_to_yaml.py +++ /dev/null @@ -1,31 +0,0 @@ -from pathlib import Path - -import tomllib - -base_dir = Path(__file__).parent.parent -pyproject_toml = base_dir / "pyproject.toml" - - -def drop_line(line): - if "python_version < '3.10'" in line: - return False - - if "python_version < '3.11'" in line: # noqa: SIM103 - return False - - return True - - -def remove_specifier(line: str): - if ";" in line: - return line.split(";", maxsplit=1)[0] - return line - - -with pyproject_toml.open("rb") as f: - data = tomllib.load(f) -dependencies = data["project"]["dependencies"] -dependencies = map(remove_specifier, filter(drop_line, dependencies)) -dependencies_str = "\n".join([f" - {v}" for v in dependencies]) -dependencies_str = dependencies_str.replace("qtconsole", "qtconsole-base") -print(dependencies_str) diff --git a/pixi.toml b/pixi.toml new file mode 100644 index 000000000..dc01b9638 --- /dev/null +++ b/pixi.toml @@ -0,0 +1,70 @@ +[workspace] +authors = ["Grzegorz Bokota"] +channels = ["https://prefix.dev/conda-forge"] +platforms = ["win-64", "linux-64", "osx-arm64"] # Mac Intel support is not available +preview = ["pixi-build"] + +[package] +version = "0.17.1" # keep in sync with `pyproject.toml` +build = { + backend.name = "pixi-build-python", + config.ignore-pypi-mapping = false, +} + +[dependencies] +napari = ">=0.7.0" + +[feature.py311.dependencies] +python = "3.11.*" + +[feature.py312.dependencies] +python = "3.12.*" + +[feature.py313.dependencies] +python = "3.13.*" + +[feature.py314.dependencies] +python = "3.14.*" + +[feature.pyqt6.dependencies] +PartSeg = { path = ".", extras = ["pyqt6"] } + +[feature.pyside6.dependencies] +PartSeg = { path = ".", extras = ["pyside6"] } + +[feature.test.dependencies] +pytest = "*" +pytest-qt = "*" +pytest-timeout = "*" +scikit-image = "*" +lxml = "*" + + + +# there is no automatic mapping from `optional-dependencies`/`dependency-groups` +# to `package.extra-dependencies`/`dependencies` yet, +# ref. https://github.com/prefix-dev/pixi/issues/4764#issuecomment-4781239118 +[package.extra-dependencies.pyqt6] +pyqt6 = ">=6.10" + +[package.extra-dependencies.pyside6] +pyside6 = ">=6.10" + + + + +[feature.test.tasks] +test = "python -m pytest package/tests" + +[environments] +default = { features = ["py312", "pyside6", "test"] } + +# Standard python x backend (pyqt5 across all Pythons for the comprehensive base) +test-py311-pyqt6 = ["py311", "pyqt6", "test"] +test-py312-pyqt6 = ["py312", "pyqt6", "test"] +test-py313-pyqt6 = ["py313", "pyqt6", "test"] +test-py314-pyqt6 = ["py314", "pyqt6", "test"] +test-py311-pyside6 = ["py311", "pyside6", "test"] +test-py312-pyside6 = ["py312", "pyside6", "test"] +test-py313-pyside6 = ["py313", "pyside6", "test"] +test-py314-pyside6 = ["py314", "pyside6", "test"] diff --git a/tox.ini b/tox.ini index e618bf690..b9cd15164 100644 --- a/tox.ini +++ b/tox.ini @@ -67,14 +67,6 @@ extras = commands = python -m pytest --json-report --json-report-file={toxinidir}/report-{envname}-{sys_platform}.json {posargs} -[testenv:py312-PySide2-conda] -conda_env=environment.yml -deps= - pytest - pytest-json-report - lxml_html_clean - - [testenv:py{310,311,312,313,314,315}-{PyQt5,PySide2,PyQt6,PySide6}-napari_{62,70}] deps = {[testenv]deps} From 185593ffe256b09d4a8fcfb48e36c49bb2846e07 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Tue, 25 Aug 2026 19:31:20 +0200 Subject: [PATCH 2/4] fix names and pinning --- .github/workflows/tests.yml | 6 +++--- pixi.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4b7c4defd..25b9f102d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -197,7 +197,7 @@ jobs: needs: download_data steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: prefix-dev/setup-pixi@v0.10.1 + - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 with: environments: "test-py313-pyside6" @@ -208,13 +208,13 @@ jobs: wm: herbstluftwm - name: Download test data - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: test_data path: test_data - name: Run tests - run: pixi run -e py313-pyside6-conda test + run: pixi run -e test-py313-pyside6 test check-package: name: Build & inspect our package. diff --git a/pixi.toml b/pixi.toml index dc01b9638..850c66006 100644 --- a/pixi.toml +++ b/pixi.toml @@ -59,7 +59,7 @@ test = "python -m pytest package/tests" [environments] default = { features = ["py312", "pyside6", "test"] } -# Standard python x backend (pyqt5 across all Pythons for the comprehensive base) +# Standard python x backend test-py311-pyqt6 = ["py311", "pyqt6", "test"] test-py312-pyqt6 = ["py312", "pyqt6", "test"] test-py313-pyqt6 = ["py313", "pyqt6", "test"] From 157c40c8fcee358b6b02b1177fd406efe2b5227b Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Tue, 25 Aug 2026 19:33:55 +0200 Subject: [PATCH 3/4] fix manifest --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 32976046d..9a5d865b7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -47,3 +47,4 @@ exclude runtime.txt exclude .sourcery.yaml exclude survey_url.txt exclude .typos.toml +exclude pixi.toml From 1a477f02b4f59c755b331ab7e85196835d2f3f63 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Tue, 25 Aug 2026 19:36:37 +0200 Subject: [PATCH 4/4] use other table formating --- pixi.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pixi.toml b/pixi.toml index 850c66006..0e966dc8c 100644 --- a/pixi.toml +++ b/pixi.toml @@ -6,10 +6,10 @@ preview = ["pixi-build"] [package] version = "0.17.1" # keep in sync with `pyproject.toml` -build = { - backend.name = "pixi-build-python", - config.ignore-pypi-mapping = false, -} + +[package.build] +backend.name = "pixi-build-python" +config.ignore-pypi-mapping = false [dependencies] napari = ">=0.7.0"