Skip to content

Commit d20daf0

Browse files
Merge pull request #8 from fractal-analytics-platform/pixi
use pixi for managing the task env
2 parents 32c4da5 + bcbb49e commit d20daf0

File tree

6 files changed

+98
-50
lines changed

6 files changed

+98
-50
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/build_and_test.yml

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,12 @@ jobs:
2727
with:
2828
fetch-depth: 1
2929

30-
- uses: mamba-org/setup-micromamba@v1
30+
- uses: prefix-dev/setup-[email protected]
3131
with:
32-
# Using the newest version of micromamba
33-
# causes a weird bug in the manifest generation
34-
micromamba-version: '1.5.6-0' # any version from https://github.com/mamba-org/micromamba-releases
35-
environment-name: 'ilastik-tasks'
36-
create-args: >-
37-
--override-channels
38-
-c pytorch
39-
-c ilastik-forge
40-
-c conda-forge python=${{ matrix.python-version }} ilastik-core
41-
--no-channel-priority
32+
pixi-version: v0.44.0
4233

43-
post-cleanup: 'all'
44-
45-
- name: Install package
46-
run: micromamba run -n ilastik-tasks python -m pip install -e .[dev]
47-
48-
- name: Regenerate the manifest
49-
run: micromamba run -n ilastik-tasks python src/ilastik_tasks/dev/create_manifest.py
34+
- name: re-create manifest
35+
run: pixi run -e dev python src/ilastik_tasks/dev/create_manifest.py
5036

5137
- name: Check if manifest has changed
5238
run: |
@@ -57,8 +43,8 @@ jobs:
5743
echo "__FRACTAL_MANIFEST__.json has not changed."
5844
fi
5945
60-
- name: Test core library with pytest
61-
run: micromamba run -n ilastik-tasks python -m pytest tests
46+
- name: Run tests
47+
run: pixi run -e dev pytest
6248

6349
deploy:
6450
name: Deploy
@@ -83,17 +69,19 @@ jobs:
8369
with:
8470
python-version: "3.x"
8571

86-
- name: 👷 Build
72+
- name: Build
8773
run: |
88-
python -m pip install build
89-
python -m build
74+
python -m pip install hatch hatch-vcs
75+
hatch build
9076
91-
- name: 🚢 Publish to PyPI
92-
# TODO remove the "if: false" line when the package is ready for pypi release
93-
if: false
94-
uses: pypa/gh-action-pypi-publish@release/v1
77+
# This depends on conda packages not available on PyPI
78+
#- name: 🚢 Publish to PyPI
79+
# TODO remove the "if: false" line when the package is ready for pypi release
80+
# if: false
81+
# uses: pypa/gh-action-pypi-publish@release/v1
9582

96-
- uses: softprops/action-gh-release@v2
83+
- name: Release
84+
uses: softprops/action-gh-release@v2
9785
with:
9886
generate_release_notes: true
9987
files: './dist/*'

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,8 @@ ENV/
113113

114114
*.zarr
115115
# Test data loaded via pooch
116-
/tests/data/10_5281_zenodo_14883998
116+
/tests/data/10_5281_zenodo_14883998
117+
# pixi environments
118+
.pixi
119+
*.egg-info
120+
pixi.lock

README.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,15 @@ Collection of Fractal task to run Headless ilastik workflows.
99

1010
## Installation and Deployment
1111

12-
* Install the `mamba` package manager
13-
14-
* Download the installation script from this repository
12+
* Install `pixi` package manager [instructions](https://pixi.sh/latest/installation/)
13+
* run the task:
1514

1615
```bash
17-
curl -O https://raw.githubusercontent.com/fractal-analytics-platform/fractal-ilastik-tasks/main/create_env_script.sh
16+
pixi run python some_script.py
1817
```
1918

20-
* The scrip might require some small modifications.
21-
22-
```bash
23-
VERSION="v0.2.0" # Version of the package to install (by default the latest version)
24-
COMMMAND="mamba" # Command to use to create the environment (mamba or conda)
25-
# Location of the environment
26-
# If ENVPREFIX is not NULL, the environment will be created with the prefix $ENVPREFIX/$ENVNAME
27-
# If ENVPREFIX is NULL, the environment will be created in the default location
28-
ENVPREFIX="NULL"
29-
```
19+
if you need to use the `dev` version of the package, you can run:
3020

31-
* Install the package using the installation script
32-
3321
```bash
34-
bash create_env_script.sh
22+
pixi run -e dev python some_script.py
3523
```
36-
37-
The installation script will create a conda environment with the name `fractal-ilastik-tasks` and install the package in the environment. It will also download the correct `__FRACTAL_MANIFEST__.json` file.
38-
39-
* In the fractal web interface add the task to the workflow as a "local env" task.

legacy_instructions.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Installation and Deployment
2+
3+
* Install the `mamba` package manager
4+
5+
* Download the installation script from this repository
6+
7+
```bash
8+
curl -O https://raw.githubusercontent.com/fractal-analytics-platform/fractal-ilastik-tasks/main/create_env_script.sh
9+
```
10+
11+
* The scrip might require some small modifications.
12+
13+
```bash
14+
VERSION="v0.2.0" # Version of the package to install (by default the latest version)
15+
COMMMAND="mamba" # Command to use to create the environment (mamba or conda)
16+
# Location of the environment
17+
# If ENVPREFIX is not NULL, the environment will be created with the prefix $ENVPREFIX/$ENVNAME
18+
# If ENVPREFIX is NULL, the environment will be created in the default location
19+
ENVPREFIX="NULL"
20+
```
21+
22+
* Install the package using the installation script
23+
24+
```bash
25+
bash create_env_script.sh
26+
```
27+
28+
The installation script will create a conda environment with the name `fractal-ilastik-tasks` and install the package in the environment. It will also download the correct `__FRACTAL_MANIFEST__.json` file.
29+
30+
* In the fractal web interface add the task to the workflow as a "local env" task.

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ source = "vcs"
1212
[tool.hatch.build.targets.wheel]
1313
packages = ["src/ilastik_tasks"]
1414

15+
# Clean up the source distribution to avoid big tag.gz files
16+
[tool.hatch.build.targets.sdist]
17+
exclude = [
18+
# Pixi lock excluded by default see https://github.com/fractal-analytics-platform/fractal-server/issues/2624
19+
"pixi.lock",
20+
# Exclude tests from the source distribution
21+
"tests",
22+
# Exclude typically large files and directories that are not needed
23+
# This might not exists or be named differently in your project
24+
# TBD if we want to include these or not
25+
"docs",
26+
"data",
27+
"examples",
28+
"notebooks",
29+
".github",
30+
# Remove all jupyter notebook and checkpoints
31+
"**/*.ipynb_checkpoints",
32+
"**/*.ipynb",
33+
# NB all things in .gitignore are excluded by default of hatchling
34+
]
35+
1536

1637
# Project metadata (see https://peps.python.org/pep-0621)
1738
[project]
@@ -77,3 +98,22 @@ ignore = [
7798
docstring-code-format = true
7899
docstring-code-line-length = 89
79100
skip-magic-trailing-comma = false # default is false
101+
102+
[tool.pixi.workspace]
103+
channels = ["conda-forge", "ilastik-forge"]
104+
platforms = ["osx-arm64", "linux-64"]
105+
106+
[tool.pixi.pypi-dependencies]
107+
ilastik-tasks = { path = ".", editable = true }
108+
109+
[tool.pixi.environments]
110+
default = { solve-group = "default" }
111+
dev = { features = ["dev"], solve-group = "default" }
112+
113+
[tool.pixi.tasks]
114+
115+
[tool.pixi.dependencies]
116+
pydantic = "==2.8.2"
117+
docstring_parser = "==0.15"
118+
ilastik-core = ">=1.4.2a1,<2"
119+
vigra = ">=1.12.1,<2"

0 commit comments

Comments
 (0)