Skip to content

Commit ba64bc5

Browse files
authored
migrate to pixi (#167)
* move the build system config below project config * replace setuptools with hatchling * initial pixi setup * configure the nightly env * configure the CI envs * configure the docs env * tasks for the docs env * configure a dev env * new syntax for ignoring in automatic release notes * use `pixi` in CI * use `pixi` on RTD * remove the old ci files * ignore pixi.lock * enable macos and windows for CI * add `pixi.lock` to accelerate CI * update `pixi.lock` * ignore the automatically created version file * ignore any `jupyter_execute` dirs * add `.gitattributes`
1 parent d4052f7 commit ba64bc5

File tree

12 files changed

+18071
-172
lines changed

12 files changed

+18071
-172
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/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
changelog:
22
exclude:
33
authors:
4-
- dependabot
5-
- pre-commit-ci
4+
- dependabot[bot]
5+
- pre-commit-ci[bot]

.github/workflows/ci.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,50 +33,43 @@ jobs:
3333
keyword: "[skip-ci]"
3434

3535
tests:
36-
name: ${{ matrix.os }} py${{ matrix.python-version }}
36+
name: ${{ matrix.os }} ${{ matrix.env }}
3737
runs-on: ${{ matrix.os }}
3838
needs: detect-ci-trigger
3939
if: needs.detect-ci-trigger.outputs.triggered == 'false'
4040
defaults:
4141
run:
42-
shell: bash -leo pipefail {0} {0}
42+
shell: bash -l {0}
4343

4444
strategy:
4545
fail-fast: false
4646

4747
matrix:
4848
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
49-
python-version: ["3.11", "3.12", "3.13"]
49+
env: ["ci-py311", "ci-py312", "ci-py313"]
5050

5151
steps:
5252
- name: Clone repository
5353
uses: actions/checkout@v5
5454
with:
5555
fetch-depth: 0 # Fetch all history for all branches and tags
5656

57-
- name: Setup environment
58-
run: >-
59-
echo "CONDA_ENV_FILE=ci/environment.yml" >> $GITHUB_ENV
60-
61-
- name: Setup micromamba
62-
uses: mamba-org/setup-micromamba@v2
57+
- name: setup environment
58+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293 # 0.9.0
6359
with:
64-
micromamba-version: "1.5.10-0"
65-
environment-file: ${{ env.CONDA_ENV_FILE }}
66-
environment-name: xdggs-tests
67-
cache-environment: true
68-
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
69-
create-args: >-
70-
python=${{matrix.python-version}}
60+
environments: "${{ matrix.env }}"
7161

72-
- name: Install xdggs
62+
- name: investigate env variables
7363
run: |
74-
python -m pip install --no-deps -e .
64+
echo PYTHON_VERSION=$(pixi run -e ${{ matrix.env }} python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') >> $GITHUB_ENV
65+
echo RUNNER_OS="${{ matrix.os }}"
7566
7667
- name: Import xdggs
7768
run: |
78-
python -c "import xdggs"
69+
pixi run -e ${{ matrix.env }} python -c "import xdggs"
7970
80-
- name: Run tests
71+
- name: run tests
72+
if: success()
73+
id: status
8174
run: |
82-
python -m pytest
75+
pixi run -e ${{ matrix.env }} tests --cov=xdggs

.github/workflows/nightly.yml

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@ jobs:
4545
4646
defaults:
4747
run:
48-
shell: bash -leo pipefail {0} {0}
49-
50-
strategy:
51-
fail-fast: false
52-
53-
matrix:
54-
python-version: ["3.12"]
48+
shell: bash -l {0}
5549

5650
permissions:
5751
issues: write
@@ -62,34 +56,24 @@ jobs:
6256
with:
6357
fetch-depth: 0 # Fetch all history for all branches and tags
6458

65-
- name: Setup micromamba
66-
uses: mamba-org/setup-micromamba@v2
67-
with:
68-
environment-file: ci/environment.yml
69-
environment-name: xdggs-tests
70-
cache-environment: false
71-
create-args: >-
72-
python=${{matrix.python-version}}
73-
pytest-reportlog
74-
conda
75-
76-
- name: Install upstream versions
59+
- name: remove lockfile
7760
run: |
78-
bash ci/install-upstream-wheels.sh
61+
rm pixi.lock
7962
80-
- name: Install xdggs
81-
run: |
82-
python -m pip install --no-deps -e .
63+
- name: setup environment
64+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293 # 0.9.0
65+
with:
66+
environments: "nightly"
8367

8468
- name: Import xdggs
8569
run: |
86-
python -c "import xdggs"
70+
pixi run -e nightly python -c "import xdggs"
8771
88-
- name: Run tests
72+
- name: run tests
8973
if: success()
90-
id: run-tests
74+
id: status
9175
run: |
92-
python -m pytest --report-log output-${{ matrix.python-version }}-log.jsonl
76+
pixi run -e nightly tests -rf --report-log=pytest-log.jsonl
9377
9478
- name: Generate and publish a failure report
9579
if: |
@@ -99,4 +83,4 @@ jobs:
9983
&& github.repository_owner == 'xarray-contrib'
10084
uses: xarray-contrib/issue-from-pytest-log@v1
10185
with:
102-
log-path: output-${{ matrix.python-version }}-log.jsonl
86+
log-path: pytest-log.jsonl

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ share/python-wheels/
2525
.installed.cfg
2626
*.egg
2727
MANIFEST
28+
/xdggs/_version.py
2829

2930
# PyInstaller
3031
# Usually these files are written by a python script from a template
@@ -71,6 +72,7 @@ instance/
7172
# Sphinx documentation
7273
docs/_build/
7374
docs/**/generated/
75+
jupyter_execute/
7476

7577
# PyBuilder
7678
.pybuilder/
@@ -167,3 +169,7 @@ cython_debug/
167169
# bibtex
168170
.auctex-auto
169171
*.bib.untidy
172+
173+
# pixi environments
174+
.pixi/*
175+
!.pixi/config.toml

.readthedocs.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ version: 2
33
build:
44
os: ubuntu-lts-latest
55
tools:
6-
python: mambaforge-latest
6+
# just so RTD stops complaining
7+
python: "latest"
78
jobs:
89
post_checkout:
910
- (git --no-pager log --pretty="tformat:%s" -1 | grep -vqF "[skip-rtd]") || exit 183
1011
- git fetch --unshallow || true
12+
create_environment:
13+
- asdf plugin add pixi
14+
- asdf install pixi latest
15+
- asdf global pixi latest
1116
pre_install:
12-
- git update-index --assume-unchanged docs/conf.py ci/docs.yml
13-
14-
conda:
15-
environment: ci/docs.yml
17+
- git update-index --assume-unchanged docs/conf.py
18+
install:
19+
- pixi install -e docs
20+
build:
21+
html:
22+
- pixi run -e docs build-docs-rtd
1623

1724
sphinx:
18-
fail_on_warning: true
1925
configuration: docs/conf.py
20-
21-
formats: []

ci/docs.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

ci/environment.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

ci/install-upstream-wheels.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)