Skip to content

Commit 869f66c

Browse files
Merge branch 'v4-dev' into gsw_tutorial
2 parents a4e8425 + deee390 commit 869f66c

68 files changed

Lines changed: 143 additions & 171 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cache-pixi-lock.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
- uses: actions/checkout@v5
1818
with:
1919
fetch-depth: 0
20-
sparse-checkout: pixi.toml
2120
- name: Get current date
2221
id: date
2322
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
@@ -30,7 +29,7 @@ jobs:
3029
- uses: prefix-dev/setup-pixi@v0.9.0
3130
if: ${{ !steps.restore.outputs.cache-hit }}
3231
with:
33-
pixi-version: v0.49.0
32+
pixi-version: v0.56.0
3433
run-install: false
3534
- name: Run pixi lock
3635
if: ${{ !steps.restore.outputs.cache-hit }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Profile.prof
2020
.eggs/*
2121
parcels.egg-info/*
2222
dist/parcels*.egg
23-
parcels/_version_setup.py
23+
src/parcels/_version_setup.py
2424
.pytest_cache
2525
.hypothesis
2626
.coverage

docs/community/contributing.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ If you're having trouble using Parcels, feel free to create a discussion in our
4949

5050
In the [Projects panel](https://github.com/OceanParcels/parcels/projects?query=is%3Aopen), you'll see the "Parcels development" project. This is used by the core development team for project management, as well as drafting up new ideas for the codebase that aren't mature enough to be issues themselves. Everything in "backlog" is not being actively worked on and is fair game for open source contributions.
5151

52-
(editing-parcels-code)=
53-
5452
## Development
5553

5654
### Environment setup
@@ -77,7 +75,19 @@ Now you have a development installation of Parcels, as well as a bunch of develo
7775

7876
### Pixi workflows
7977

80-
You can use the following Pixi commands to run common development tasks.
78+
**Typical development workflow**
79+
80+
1. Make your code changes
81+
2. Run `pixi run lint` to ensure code formatting and style compliance
82+
3. Run `pixi run tests` to verify your changes don't break existing functionality
83+
4. If you've added new features, run `pixi run typing` to check type annotations
84+
5. If you've modified documentation, run `pixi run docs` to build and verify the docs
85+
86+
```{tip}
87+
You can run `pixi info` to see all available environments and `pixi task list` to see all available tasks across environments.
88+
```
89+
90+
See below for more Pixi commands relevant to development.
8191

8292
**Testing**
8393

@@ -99,21 +109,13 @@ You can use the following Pixi commands to run common development tasks.
99109

100110
Parcels supports testing against different environments (e.g., different Python versions) with different feature sets. In CI we test against these environments, and you can too locally. For example:
101111

102-
- `pixi run -e test-py311 tests` - Run tests using Python 3.11
103-
- `pixi run -e test-py312 tests` - Run tests using Python 3.12
112+
- `pixi run -e test-py311 tests` - Run tests in the environment containing Python 3.11
113+
- `pixi run -e test-py312 tests` - Run tests in the environment containing Python 3.12
104114

105115
The name of the workflow on GitHub contains the command you have to run locally to recreate the workflow - making it super easy to reproduce CI failures locally.
106116

107-
**Typical development workflow**
108-
109-
1. Make your code changes
110-
2. Run `pixi run lint` to ensure code formatting and style compliance
111-
3. Run `pixi run tests` to verify your changes don't break existing functionality
112-
4. If you've added new features, run `pixi run typing` to check type annotations
113-
5. If you've modified documentation, run `pixi run docs` to build and verify the docs
114-
115117
```{tip}
116-
You can run `pixi info` to see all available environments and `pixi task list` to see all available tasks across environments.
118+
For those familiar with Conda, you are used to activating an environment. With Pixi, you can do the same by doing `pixi shell <env-name>`. For example, `pixi shell test-latest` will drop you into a shell where you can run commands such as `pytest` like normal. You can exit the shell with `exit` or `Ctrl+D`.
117119
```
118120

119121
### Changing code

docs/community/v4-migration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat
1414
- The `time` argument in the Kernel signature has been removed in the Kernel API, so can't be used. Use `particle.time` instead.
1515
- The `particle` argument in the Kernel signature has been renamed to `particles`.
1616
- `math` functions should be replaced with array compatible equivalents (e.g., `math.sin` -> `np.sin`). Instead of `ParcelsRandom` you should use numpy's random functions.
17+
- `particle.depth` has been changed to `particles.z` to be consistent with the [CF conventions for trajectory data](https://cfconventions.org/cf-conventions/cf-conventions.html#trajectory-data), and to make Parcels also generalizable to atmospheric contexts.
1718

1819
## FieldSet
1920

pixi.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
77
[package]
88
name = "parcels"
99
version = "dynamic" # dynamic versioning needs better support in pixi https://github.com/prefix-dev/pixi/issues/2923#issuecomment-2598460666 . Putting `version = "dynamic"` here for now until pixi recommends something else.
10+
license = "MIT" # can remove this once https://github.com/prefix-dev/pixi-build-backends/issues/397 is resolved
1011

1112
[package.build]
12-
backend = { name = "pixi-build-python", version = "==0.3.2" }
13+
backend = { name = "pixi-build-python", version = "==0.4.0" }
1314

1415
[package.host-dependencies]
1516
setuptools = "*"
@@ -26,6 +27,7 @@ pre-commit = { features = ["pre-commit"], no-default-feature = true }
2627

2728
[dependencies] # keep section in sync with pyproject.toml dependencies
2829
python = ">=3.11,<3.13"
30+
parcels = { path = "." }
2931
netcdf4 = ">=1.1.9"
3032
numpy = ">=1.9.1"
3133
tqdm = "*"
@@ -92,4 +94,4 @@ lxml = "*" # in CI
9294
types-tqdm = "*"
9395

9496
[feature.typing.tasks]
95-
typing = "mypy parcels --install-types"
97+
typing = "mypy src/parcels --install-types"

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ Tracker = "https://github.com/OceanParcels/parcels/issues"
4242

4343

4444
[tool.setuptools]
45+
package-dir = { "" = "src" }
4546
packages = ["parcels"]
4647

4748
[tool.setuptools_scm]
48-
write_to = "parcels/_version_setup.py"
49+
write_to = "src/parcels/_version_setup.py"
4950
local_scheme = "no-local-version"
5051

5152
[tool.pytest.ini_options]

0 commit comments

Comments
 (0)