Skip to content

Commit 81df79c

Browse files
committed
Add pixi dev instructions
1 parent 8f0565e commit 81df79c

File tree

6 files changed

+95
-2
lines changed

6 files changed

+95
-2
lines changed

.gitattributes

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

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ dist/parcels*.egg
2828
parcels/_version_setup.py
2929
.pytest_cache
3030
.coverage
31+
32+
# pixi environments
33+
.pixi
34+
*.egg-info
35+
pixi.lock

docs/community/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ From there:
7474
- create a git branch, implement, commit, and push your changes
7575
- `create a pull request <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork>`_ (PR) into ``main`` of the original repo making sure to link to the issue that you are working on. Not yet finished with your feature but still want feedback on how you're going? Then mark it as "draft" and ``@ping`` a maintainer. See our `maintainer notes <maintainer.md>`_ to see our PR review workflow.
7676

77-
If you made changes to the documentation, and want to render a local version, you can run the command ``sphinx-autobuild --ignore "*.zip" docs docs/_build`` to create a server to automatically rebuild the documentation when you make changes.
77+
Look at the ``[tool.pixi.tasks]`` section of ``pyproject.toml`` for a list of tasks that are useful for development.
7878

7979
Code guidelines
8080
~~~~~~~~~~~~~~~

docs/installation.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ The steps below are the installation instructions for Linux, macOS and Windows.
5656
Installation for developers
5757
===========================
5858

59+
Using Miniconda
60+
---------------
61+
5962
If you would prefer to have a development installation of Parcels (i.e., where the code can be actively edited), you can do so by setting up Miniconda (as detailed in step 1 above), cloning the Parcels repo, installing dependencies using the environment file, and then installing Parcels in an editable mode such that changes to the cloned code can be tested during development.
6063

6164
**Step 1:** Same as `step 1 above`_.
@@ -74,3 +77,20 @@ If you would prefer to have a development installation of Parcels (i.e., where t
7477
7578
conda activate parcels-dev
7679
pip install --no-build-isolation --no-deps -e .
80+
81+
82+
Using Pixi
83+
----------
84+
For developers who want to use Pixi (a modern alternative to Anaconda - see `"Transitioning from the conda or mamba to pixi" <https://pixi.sh/latest/switching_from/conda/>`_) to manage their development environment, the following steps can be followed:
85+
86+
**Step 1:** `Install Pixi <https://pixi.sh/latest/>`_.
87+
88+
**Step 2:** Clone the Parcels repo and create a new environment with the development dependencies:
89+
90+
.. code-block:: bash
91+
92+
git clone https://github.com/OceanParcels/parcels.git
93+
cd parcels
94+
pixi install
95+
96+
Now you can use ``pixi run`` for a list of available tasks useful for development, such as running tests, checking code coverage, and building the documentation. You can also do ``pixi shell`` to "activate" the environment (and do ``exit`` to deactivate it). See `here <https://pixi.sh/latest/switching_from/conda/#key-differences-at-a-glance>`_ for a comparison between Pixi and Conda commands.

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: parcels
22
channels:
33
- conda-forge
4-
dependencies:
4+
dependencies: #! Keep in sync with [tool.pixi.dependencies] in pyproject.toml
55
- python>=3.10
66
- ffmpeg>=3.2.3
77
- jupyter

pyproject.toml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,72 @@ homepage = "https://oceanparcels.org/"
3939
repository = "https://github.com/OceanParcels/parcels"
4040
Tracker = "https://github.com/OceanParcels/parcels/issues"
4141

42+
[tool.pixi.project]
43+
channels = ["conda-forge"]
44+
name = "parcels-dev"
45+
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]
46+
47+
[tool.pixi.tasks]
48+
tests = "pytest"
49+
tests-notebooks = "pytest -v -s --nbval-lax -k 'not documentation and not tutorial_periodic_boundaries'" # TODO v4: Re-enable `tutorial_periodic_boundaries` notebook
50+
coverage = "coverage run -m pytest && coverage html"
51+
typing = "mypy parcels"
52+
pre-commit = "pre-commit run --all-files"
53+
docs = 'sphinx-autobuild --ignore "*.zip" docs docs/_build'
54+
55+
# TODO v4: Remove v4 specific tasks
56+
tests-short = "pytest tests/test_advection.py"
57+
tests-exclude-v4 = "pytest -m 'not v4alpha and not v4future and not v4remove'"
58+
59+
[tool.pixi.dependencies] #! Keep in sync with environment.yml
60+
python = ">=3.10"
61+
ffmpeg = ">=3.2.3"
62+
jupyter = "*"
63+
matplotlib-base = ">=2.0.2"
64+
netcdf4 = ">=1.1.9"
65+
numpy = ">=1.9.1"
66+
platformdirs = "*"
67+
psutil = "*"
68+
pymbolic = "*"
69+
scipy = ">=0.16.0"
70+
tqdm = "*"
71+
xarray = ">=0.10.8"
72+
cftime = ">=1.3.1"
73+
dask = ">=2.0"
74+
scikit-learn = "*"
75+
zarr = ">=2.11.0,!=2.18.0,<3"
76+
77+
# Notebooks
78+
trajan = "*"
79+
80+
# Testing
81+
nbval = "*"
82+
pytest = "*"
83+
pytest-html = "*"
84+
coverage = "*"
85+
86+
# Typing
87+
mypy = "*"
88+
types-tqdm = "*"
89+
types-psutil = "*"
90+
91+
# Linting
92+
pre_commit = "*"
93+
94+
# Docs
95+
ipython = "*"
96+
numpydoc = "*"
97+
nbsphinx = "*"
98+
sphinx = "*"
99+
pandoc = "*"
100+
pydata-sphinx-theme = "*"
101+
sphinx-autobuild = "*"
102+
myst-parser = "*"
103+
sphinxcontrib-mermaid = "*"
104+
105+
[tool.pixi.pypi-dependencies]
106+
parcels = { path = ".", editable = true }
107+
42108
[tool.setuptools]
43109
packages = ["parcels"]
44110

0 commit comments

Comments
 (0)