From 60e1a2c091c8c4c592632681a9e4c7471f948d74 Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Fri, 23 Oct 2026 21:25:19 -0400 Subject: [PATCH] Build a conda package with pixi-build and publish it on release Same setup as khanlab/zarrnii: the package is published to akhanf/khanlab by the khanlab pixi publish action when a GitHub release is published, and built without uploading on PRs that change the packaging. Run dependencies are listed explicitly rather than converted from [project.dependencies], to relax the SimpleITK==2.2.1 pin (it conflicts with packages needing newer SimpleITK) and leave out typing and pytest. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/push_conda.yml | 53 ++++++++++++++++++++++++++++++++ .gitignore | 5 +++ pyproject.toml | 43 ++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 .github/workflows/push_conda.yml diff --git a/.github/workflows/push_conda.yml b/.github/workflows/push_conda.yml new file mode 100644 index 0000000..36dde45 --- /dev/null +++ b/.github/workflows/push_conda.yml @@ -0,0 +1,53 @@ +name: Publish Conda package + +on: + release: + types: [published] + + # build the package (without uploading) when the packaging changes + pull_request: + paths: + - pyproject.toml + - .github/workflows/push_conda.yml + + workflow_dispatch: + inputs: + release_tag: + description: "Release tag to simulate, e.g. v1.4.0" + required: true + type: string + + upload: + description: "Actually upload package" + required: true + default: false + type: boolean + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout source + uses: actions/checkout@v6 + with: + ref: >- + ${{ github.event_name == 'release' + && github.event.release.tag_name + || github.ref }} + fetch-depth: 0 + + - name: Build and publish + uses: khanlab/actions/.github/actions/action-pixi_task-publish@df4211abe672b61c81f4177eef5b9516edf2944e + with: + release-tag: >- + ${{ github.event_name == 'release' + && github.event.release.tag_name + || github.event_name == 'pull_request' + && format('v0.0.0.dev{0}', github.run_number) + || inputs.release_tag }} + channel: akhanf/khanlab + api-key: ${{ secrets.PREFIX_API_KEY }} + upload: >- + ${{ github.event_name == 'release' + || inputs.upload == true }} diff --git a/.gitignore b/.gitignore index 7222c5c..8e478ad 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,8 @@ tests/test_results/ fireants/scripts/template/configs/test*.yaml fireants/**/*debug/ **/.DS_Store + +# pixi +.pixi/ +pixi.lock +*.conda diff --git a/pyproject.toml b/pyproject.toml index 018e299..d55e041 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,3 +27,46 @@ exclude = ["docker*", "notepad*", "fused_ops*", "tutorials*"] [tool.hatch.build.targets.wheel] packages = ["fireants"] + +# ---------------------------------------------------------------------- +# Conda package, built with pixi-build and published to akhanf/khanlab on +# release (.github/workflows/push_conda.yml). The run dependencies are listed +# here rather than converted from [project.dependencies], to relax the +# SimpleITK pin and leave out typing (stdlib) and pytest (tests only). +# ---------------------------------------------------------------------- + +[tool.pixi.workspace] +channels = ["conda-forge"] +platforms = ["linux-64"] +preview = ["pixi-build"] + +[tool.pixi.package] +name = "fireants" +# set from the release tag by the publish workflow +version = "0.0.0.dev0" +publish = true + +[tool.pixi.package.build.backend] +name = "pixi-build-python" +version = "*" +channels = ["conda-forge"] + +[tool.pixi.package.build.config] +ignore-pyproject-manifest = true + +[tool.pixi.package.host-dependencies] +hatchling = ">=1.21.0" + +[tool.pixi.package.run-dependencies] +python = ">=3.9" +pytorch = ">=2.3.0" +# the PyPI SimpleITK==2.2.1 pin is not needed, and conflicts with newer packages +simpleitk = ">=2.2.1" +nibabel = "*" +numpy = "*" +scipy = "*" +scikit-image = "*" +matplotlib-base = "*" +tqdm = "*" +pandas = "*" +hydra-core = "*"