Skip to content

Commit 51b33c7

Browse files
Merge branch 'v4-dev' into bugfix/2239-oob-spatialhash
2 parents cfc84ac + 7708aac commit 51b33c7

23 files changed

+823
-389
lines changed

.github/actions/install-parcels/action.yml

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

.github/ci/min-core-deps.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ dependencies:
1414
# (see https://github.com/Unidata/netcdf4-python/issues/1090)
1515
- netcdf4=1.6
1616
- numpy=1.23
17-
- psutil=5.9
18-
- pymbolic=2022.1
1917
- pytest=7.1
2018
- scipy=1.9
2119
- tqdm=4.64

.github/ci/recipe.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ requirements:
3535
- netcdf4 >=1.1.9
3636
- numpy >=1.11
3737
- platformdirs
38-
- psutil
39-
- pymbolic
4038
- pytest
4139
- scipy >=0.16.0
4240
- trajan

.github/workflows/additional.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,14 @@ jobs:
2929
python .github/ci/min_deps_check.py .github/ci/min-core-deps.yml
3030
3131
linkcheck:
32-
name: Sphinx linkcheck
32+
name: pixi run docs-linkcheck
3333
runs-on: "ubuntu-latest"
3434
defaults:
3535
run:
3636
shell: bash -l {0}
3737

3838
steps:
3939
- uses: actions/checkout@v4
40-
- name: Setup parcels
41-
uses: ./.github/actions/install-parcels
42-
with:
43-
environment-file: environment.yml
44-
- run: sphinx-build -b linkcheck docs/ _build/linkcheck
40+
- uses: actions/checkout@v4
41+
- uses: prefix-dev/[email protected]
42+
- run: pixi run docs-linkcheck
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Generate and cache Pixi lockfile
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
cache-id:
7+
description: "The lock file contents"
8+
value: ${{ jobs.cache-pixi-lock.outputs.cache-id }}
9+
10+
jobs:
11+
cache-pixi-lock:
12+
name: Generate output
13+
runs-on: ubuntu-latest
14+
outputs:
15+
cache-id: ${{ steps.restore.outputs.cache-primary-key }}
16+
steps:
17+
- uses: actions/checkout@v5
18+
with:
19+
fetch-depth: 0
20+
sparse-checkout: pixi.toml
21+
- name: Get current date
22+
id: date
23+
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
24+
- uses: actions/cache/restore@v4
25+
id: restore
26+
with:
27+
path: |
28+
pixi.lock
29+
key: ${{ steps.date.outputs.date }}_${{hashFiles('pixi.toml')}}
30+
- uses: prefix-dev/[email protected]
31+
if: ${{ !steps.restore.outputs.cache-hit }}
32+
with:
33+
pixi-version: v0.49.0
34+
run-install: false
35+
- name: Run pixi lock
36+
if: ${{ !steps.restore.outputs.cache-hit }}
37+
run: pixi lock
38+
- uses: actions/cache/save@v4
39+
if: ${{ !steps.restore.outputs.cache-hit }}
40+
id: cache
41+
with:
42+
path: |
43+
pixi.lock
44+
key: ${{ steps.restore.outputs.cache-primary-key }}
45+
- name: Upload pixi.lock
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: pixi-lock
49+
path: pixi.lock

.github/workflows/ci.yml

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,38 @@ defaults:
1717
shell: bash -el {0}
1818

1919
jobs:
20+
cache-pixi-lock:
21+
uses: ./.github/workflows/cache-pixi-lock.yml
2022
unit-test:
21-
name: "py${{ matrix.python-version }} | ${{ matrix.os }} | unit tests"
23+
name: "Unit tests: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests"
2224
runs-on: ${{ matrix.os }}-latest
25+
needs: [cache-pixi-lock]
26+
env:
27+
COVERAGE_REPORT: "${{ matrix.os }}_${{ matrix.pixi-environment }}_unit_test_report.html"
2328
strategy:
2429
fail-fast: false
2530
matrix:
2631
os: [ubuntu] #, mac, windows] # TODO v4: Re-enable windows and mac
27-
python-version: ["3.12"]
32+
pixi-environment: [test-latest]
2833
include:
2934
- os: ubuntu
30-
python-version: "3.11"
35+
pixi-environment: "test-py311"
3136
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
- name: Setup Conda and parcels
35-
uses: ./.github/actions/install-parcels
37+
- uses: actions/checkout@v4
38+
- name: Restore cached pixi lockfile
39+
uses: actions/cache/restore@v4
40+
id: restore-pixi-lock
41+
with:
42+
path: |
43+
pixi.lock
44+
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
45+
- uses: prefix-dev/[email protected]
3646
with:
37-
environment-file: environment.yml
38-
python-version: ${{ matrix.python-version }}
47+
cache: true
48+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
3949
- name: Unit test
4050
run: |
41-
coverage run -m pytest -v -s --html=${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html --self-contained-html
42-
coverage xml
51+
pixi run -e ${{ matrix.pixi-environment }} tests -v -s --cov=parcels --cov-report=xml --html="${{ env.COVERAGE_REPORT }}" --self-contained-html
4352
- name: Codecov
4453
uses: codecov/[email protected]
4554
env:
@@ -50,13 +59,16 @@ jobs:
5059
if: ${{ always() }} # Always run this step, even if tests fail
5160
uses: actions/upload-artifact@v4
5261
with:
53-
name: Unittest report ${{ matrix.os }}-${{ matrix.python-version }}
54-
path: ${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html
62+
name: Unittest report ${{ matrix.os }}-${{ matrix.pixi-environment }}
63+
path: ${{ env.COVERAGE_REPORT }}
5564
integration-test:
5665
# TODO v4: Re-enable the workflow once development has stabilized and we want to run integration tests again
5766
if: false
58-
name: "py${{ matrix.python-version }} | ${{ matrix.os }} | integration tests"
67+
name: "Integration: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests-notebooks"
5968
runs-on: ${{ matrix.os }}-latest
69+
needs: [cache-pixi-lock]
70+
env:
71+
COVERAGE_REPORT: "${{ matrix.os }}_${{ matrix.pixi-environment }}_integration_test_report.html"
6072
strategy:
6173
fail-fast: false
6274
matrix:
@@ -66,22 +78,21 @@ jobs:
6678
- os: ubuntu
6779
python-version: "3.11"
6880
steps:
69-
- name: Checkout
70-
uses: actions/checkout@v4
71-
- name: Setup Conda and parcels
72-
uses: ./.github/actions/install-parcels
81+
- uses: actions/checkout@v4
82+
- name: Restore cached pixi lockfile
83+
uses: actions/cache/restore@v4
84+
id: restore-pixi-lock
7385
with:
74-
environment-file: environment.yml
86+
path: |
87+
pixi.lock
88+
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
89+
- uses: prefix-dev/[email protected]
90+
with:
91+
cache: true
92+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
7593
- name: Integration test
76-
# TODO v4: Re-enable `tutorial_periodic_boundaries`
77-
# TODO v4: Re-enable `tutorial_timevaryingdepthdimensions`
78-
# TODO v4: Re-enable `tutorial_particle_field_interaction`
79-
# TODO v4: Re-enable `tutorial_croco_3D`
80-
# TODO v4: Re-enable `tutorial_nemo_3D` (https://github.com/OceanParcels/Parcels/pull/1936#issuecomment-2717666705)
81-
# TODO v4: Re-enable `tutorial_analyticaladvection`
8294
run: |
83-
coverage run -m pytest -v -s --nbval-lax -k "not documentation and not tutorial_periodic_boundaries and not tutorial_timevaryingdepthdimensions and not tutorial_particle_field_interaction and not tutorial_croco_3D and not tutorial_nemo_3D and not tutorial_analyticaladvection" --html="${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html" --self-contained-html docs/examples
84-
coverage xml
95+
pixi run test-notebooks -v -s --html="${{ env.COVERAGE_REPORT }}" --self-contained-html --cov=parcels --cov-report=xml
8596
- name: Codecov
8697
uses: codecov/[email protected]
8798
env:
@@ -92,8 +103,8 @@ jobs:
92103
if: ${{ always() }} # Always run this step, even if tests fail
93104
uses: actions/upload-artifact@v4
94105
with:
95-
name: Integration test report ${{ matrix.os }}-${{ matrix.python-version }}
96-
path: ${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html
106+
name: Integration test report ${{ matrix.os }}-${{ matrix.pixi-environment }}
107+
path: ${{ env.COVERAGE_REPORT }}
97108
merge-test-artifacts:
98109
runs-on: ubuntu-latest
99110
needs:
@@ -107,21 +118,28 @@ jobs:
107118
name: Testing reports
108119
pattern: "* report *"
109120
typechecking:
110-
name: mypy
121+
name: "TypeChecking: pixi run typing"
111122
# TODO v4: Enable typechecking again
112123
if: false
113124
runs-on: ubuntu-latest
125+
needs: [cache-pixi-lock]
114126
steps:
115127
- name: Checkout
116128
uses: actions/checkout@v4
117-
- name: Setup Conda and parcels
118-
uses: ./.github/actions/install-parcels
129+
- name: Restore cached pixi lockfile
130+
uses: actions/cache/restore@v4
131+
id: restore-pixi-lock
132+
with:
133+
path: |
134+
pixi.lock
135+
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
136+
- uses: prefix-dev/[email protected]
119137
with:
120-
environment-file: environment.yml
121-
- run: conda install lxml # dep for report generation
138+
cache: true
139+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'v4-dev' }} # TODO: Update v4-dev to main when v4 is released
122140
- name: Typechecking
123141
run: |
124-
mypy --install-types --non-interactive parcels --html-report mypy-report
142+
pixi run typing --non-interactive --html-report mypy-report
125143
- name: Upload test results
126144
if: ${{ always() }} # Upload even on mypy error
127145
uses: actions/upload-artifact@v4

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,14 @@ repos:
4343
rev: 0.8.1
4444
hooks:
4545
- id: nbstripout
46+
- repo: https://github.com/ComPWA/taplo-pre-commit
47+
rev: v0.9.3
48+
hooks:
49+
- id: taplo-format
50+
args:
51+
[
52+
"--option",
53+
"array_auto_collapse=false",
54+
"--option",
55+
"align_comments=false",
56+
]

.readthedocs.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
version: 2
22
build:
3-
os: ubuntu-22.04
3+
os: ubuntu-lts-latest
44
tools:
5-
python: mambaforge-22.9
5+
# just so RTD stops complaining
6+
python: "latest"
67
jobs:
7-
post_create_environment:
8-
- pip install -e .
8+
create_environment:
9+
- asdf plugin add pixi
10+
- asdf install pixi latest
11+
- asdf global pixi latest
12+
install:
13+
- pixi install -e docs
14+
build:
15+
html:
16+
- pixi run -e docs sphinx-build -T -b html docs $READTHEDOCS_OUTPUT/html
917
sphinx:
1018
configuration: docs/conf.py
11-
12-
conda:
13-
environment: environment.yml

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Parcels
22

3+
[![Pixi Badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json)](https://pixi.sh)
34
[![Anaconda-release](https://anaconda.org/conda-forge/parcels/badges/version.svg)](https://anaconda.org/conda-forge/parcels/)
45
[![Anaconda-date](https://anaconda.org/conda-forge/parcels/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/parcels/)
56
[![Zenodo](https://zenodo.org/badge/DOI/10.5281/zenodo.823561.svg)](https://doi.org/10.5281/zenodo.823561)

docs/community/v4-migration.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat
1919

2020
- `interp_method` has to be an Interpolation function, instead of a string.
2121

22+
## Particle
23+
24+
- `Particle.add_variables()` has been replaced by `Particle.add_variable()`, which now also takes a list of `Variables`.
25+
2226
## ParticleSet
2327

2428
- `repeatdt` and `lonlatdepth_dtype` have been removed from the ParticleSet.
@@ -28,3 +32,4 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat
2832
## ParticleFile
2933

3034
- Particlefiles should be created by `ParticleFile(...)` instead of `pset.ParticleFile(...)`
35+
- The `name` argument in `ParticleFile` has been replaced by `store` and can now be a string, a Path or a zarr store.

0 commit comments

Comments
 (0)