Skip to content

Commit 830ed3a

Browse files
committed
Merge remote-tracking branch 'upstream/v4-dev' into pixi-docs
2 parents 2cfb1a7 + 81cc43e commit 830ed3a

21 files changed

+339
-323
lines changed

.github/ISSUE_TEMPLATE/01_feature.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
name: 🔼 Parcels feature requests, and other enhancements
33
about: Suggest an improvement to the parcels codebase.
44
title: ""
5-
labels: ""
5+
labels: ["needs-triage"]
66
assignees: ""
77
---

.github/ISSUE_TEMPLATE/02_bug.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "🐛 Bug Report"
22
description: Describe a bug in the parcels codebase. For support related to your specific use case, please post in Q&A in our Discussions tab.
3-
labels: ["bug"]
3+
labels: ["bug", "needs-triage"]
44
body:
55
- type: "input"
66
attributes:

docs/community/contributing.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
The Parcels code, for which development started in 2015, is now one of the most widely used tools for Lagrangian Ocean Analysis. It's used by dozens of groups around the world - see [this list](https://oceanparcels.org/papers-citing-parcels#papers-citing-parcels) for a full list of the peer-reviewed articles using Parcels. Its flexibility for users to create new, custom 'behaviours' (i.e. let virtual particles be controlled by other mechanics than only the ocean flow) and its compatibility with many different types of hydrodynamic input data are the two key features.
88

9-
> **Note**
10-
>
11-
> Want to learn more about Lagrangian ocean analysis? Then look at [Lagrangian ocean analysis: Fundamentals and practices](https://www.sciencedirect.com/science/article/pii/S1463500317301853) for a review of the literature.
9+
```{note}
10+
Want to learn more about Lagrangian ocean analysis? Then look at [Lagrangian ocean analysis: Fundamentals and practices](https://www.sciencedirect.com/science/article/pii/S1463500317301853) for a review of the literature.
11+
```
1212

1313
---
1414

1515
There are two primary groups that contribute to Parcels; oceanographers who bring domain specific understanding about the physical processes and modelling approaches, as well as software developers who bring their experience working with code. **All contributions are welcome no matter your background or level of experience**.
1616

17-
> **Note**
18-
>
19-
> The first component of this documentation is geared to those new to open source. Already familiar with GitHub and open source? Skip ahead to the [Development](#development) section.
17+
```{note}
18+
The first component of this documentation is geared to those new to open source. Already familiar with GitHub and open source? Skip ahead to the [Development](#development) section.
19+
```
2020

2121
## What is open source?
2222

@@ -37,8 +37,8 @@ Exactly how to use Git and GitHub is beyond the scope of this documentation, and
3737
There are many ways that you can contribute to Parcels. You can:
3838

3939
- Participate in discussion about Parcels, either through the [issues](https://github.com/OceanParcels/parcels/issues) or [discussions](https://github.com/OceanParcels/parcels/discussions) tab
40-
- Suggest improvements to [tutorials](../documentation/index.rst)
41-
- Suggest improvements to [documentation](../index.rst)
40+
- Suggest improvements to [tutorials](../documentation/index.md)
41+
- Suggest improvements to [documentation](../index.md)
4242
- Write code (fix bugs, implement features, codebase improvements, etc)
4343

4444
All of these require you to [make an account on GitHub](https://github.com/signup), so that should be your first step.
@@ -53,9 +53,9 @@ In the [Projects panel](https://github.com/OceanParcels/parcels/projects?query=i
5353

5454
### Environment setup
5555

56-
> **Note**
57-
>
58-
> Parcels, alongside popular projects like [Xarray](https://github.com/pydata/xarray), uses [Pixi](https://pixi.sh) to manage environments and run developer tooling. Pixi is a modern alternative to Conda and also includes other powerful tooling useful for a project like Parcels ([read more](https://github.com/OceanParcels/Parcels/issues/2205)). It is our sole development workflow - we do not offer a Conda development workflow. Give Pixi a try, you won't regret it!
56+
```{note}
57+
Parcels, alongside popular projects like [Xarray](https://github.com/pydata/xarray), uses [Pixi](https://pixi.sh) to manage environments and run developer tooling. Pixi is a modern alternative to Conda and also includes other powerful tooling useful for a project like Parcels ([read more](https://github.com/OceanParcels/Parcels/issues/2205)). It is our sole development workflow - we do not offer a Conda development workflow. Give Pixi a try, you won't regret it!
58+
```
5959

6060
To get started contributing to Parcels:
6161

@@ -83,9 +83,9 @@ Now you have a development installation of Parcels, as well as a bunch of develo
8383
4. If you've added new features, run `pixi run typing` to check type annotations
8484
5. If you've modified documentation, run `pixi run docs` to build and verify the docs
8585

86-
> **Tip**
87-
>
88-
> You can run `pixi info` to see all available environments and `pixi task list` to see all available tasks across environments.
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+
```
8989

9090
See below for more Pixi commands relevant to development.
9191

@@ -114,9 +114,9 @@ Parcels supports testing against different environments (e.g., different Python
114114

115115
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.
116116

117-
> **Tip**
118-
>
119-
> 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`.
117+
```{tip}
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`.
119+
```
120120

121121
### Changing code
122122

@@ -127,9 +127,9 @@ From there:
127127

128128
### Code guidelines
129129

130-
> **Note**
131-
>
132-
> These guidelines are here to promote Python best practices, as well as standardise the Parcels code. If you're not sure what some of these guidelines mean, don't worry! Your contribution is still appreciated. When you create your pull request, maintainers can modify your code to comply with these guidelines.
130+
```{note}
131+
These guidelines are here to promote Python best practices, as well as standardise the Parcels code. If you're not sure what some of these guidelines mean, don't worry! Your contribution is still appreciated. When you create your pull request, maintainers can modify your code to comply with these guidelines.
132+
```
133133

134134
- Write clear commit messages that explain the changes you've made.
135135
- Include tests for any new code you write. Tests are implemented using pytest and are located in the `tests` directory.

docs/community/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Community
2+
3+
These sections contain documentation relevant to the Parcels community.
4+
See the sections in the primary sidebar and below to explore.
5+
6+
```{toctree}
7+
:caption: User documentation
8+
:maxdepth: 1
9+
10+
contributing
11+
Versioning Policy <policies>
12+
Release Notes <https://github.com/OceanParcels/Parcels/releases>
13+
Parcels v4.0 Migration Guide <v4-migration>
14+
```
15+
16+
```{toctree}
17+
:caption: Maintainer documentation
18+
:maxdepth: 1
19+
20+
maintainer
21+
```

docs/community/index.rst

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

docs/conf.py

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@
1414
import datetime
1515
import inspect
1616
import os
17-
import re
18-
import shutil
1917
import sys
20-
import tempfile
2118
import warnings
22-
from pathlib import Path
2319

2420
# If extensions (or modules to document with autodoc) are in another directory,
2521
# add these directories to sys.path here. If the directory is relative to the
@@ -51,8 +47,7 @@
5147

5248
# The suffix(es) of source filenames.
5349
# You can specify multiple suffix as a list of string:
54-
# source_suffix = ['.rst', '.md']
55-
source_suffix = ".rst"
50+
source_suffix = [".rst", ".md"]
5651

5752
# The encoding of source files.
5853
# source_encoding = 'utf-8-sig'
@@ -219,33 +214,6 @@
219214
}
220215

221216

222-
# Copy code examples to download directory
223-
downloads_folder = Path("_downloads")
224-
downloads_folder.mkdir(exist_ok=True)
225-
226-
227-
def make_filename_safe(filename: str, safe_char: str = "_") -> str:
228-
"""Make a filename safe for saving to disk."""
229-
# Replace any characters that are not allowed in a filename with the safe character
230-
safe_filename = re.sub(r'[\\/:*?"<>|]', safe_char, filename)
231-
return safe_filename
232-
233-
234-
with tempfile.TemporaryDirectory() as temp_dir:
235-
temp_dir = Path(temp_dir)
236-
237-
# Copy examples folder to temp directory (with a folder name matching parcels version)
238-
examples_folder = temp_dir / make_filename_safe(f"parcels_tutorials ({version})")
239-
shutil.copytree("examples", examples_folder)
240-
241-
# Zip contents of temp directory and save to _downloads folder
242-
shutil.make_archive(
243-
"_downloads/parcels_tutorials",
244-
"zip",
245-
temp_dir,
246-
)
247-
248-
249217
# based on pandas doc/source/conf.py
250218
def linkcode_resolve(domain, info):
251219
"""Determine the URL corresponding to Python object."""
@@ -384,6 +352,20 @@ def linkcode_resolve(domain, info):
384352
nbsphinx_execute = "never"
385353
# -- Options for LaTeX output ---------------------------------------------
386354

355+
BRANCH = (
356+
os.environ.get("READTHEDOCS_GIT_IDENTIFIER") # ReadTheDocs
357+
or "main" # fallback
358+
)
359+
360+
nbsphinx_prolog = f"""
361+
.. raw:: html
362+
363+
Run this notebook in the cloud <a href="https://mybinder.org/v2/gh/OceanParcels/Parcels/{BRANCH}?urlpath=lab/tree/docs/{{{{ env.doc2path(env.docname, base=None) }}}}" target="_blank"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg"></a>
364+
, or view it <a href="https://github.com/OceanParcels/Parcels/blob/{BRANCH}/docs/{{{{ env.doc2path(env.docname, base=None) }}}}" target="_blank">on GitHub</a>. Notebook version corresponds with {BRANCH}.
365+
366+
<p style="margin-bottom: 30px"></p>
367+
"""
368+
387369
latex_elements = {
388370
# The paper size ('letterpaper' or 'a4paper').
389371
# 'papersize': 'letterpaper',
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Python Example Scripts
2+
3+
## example_brownian.py
4+
5+
```{literalinclude} ../examples/example_brownian.py
6+
:language: python
7+
:linenos:
8+
```
9+
10+
## example_decaying_moving_eddy.py
11+
12+
```{literalinclude} ../examples/example_decaying_moving_eddy.py
13+
:language: python
14+
:linenos:
15+
```
16+
17+
## example_globcurrent.py
18+
19+
```{literalinclude} ../examples/example_globcurrent.py
20+
:language: python
21+
:linenos:
22+
```
23+
24+
## example_mitgcm.py
25+
26+
```{literalinclude} ../examples/example_mitgcm.py
27+
:language: python
28+
:linenos:
29+
```
30+
31+
## example_moving_eddies.py
32+
33+
```{literalinclude} ../examples/example_moving_eddies.py
34+
:language: python
35+
:linenos:
36+
```
37+
38+
## example_nemo_curvilinear.py
39+
40+
```{literalinclude} ../examples/example_nemo_curvilinear.py
41+
:language: python
42+
:linenos:
43+
```
44+
45+
## example_ofam.py
46+
47+
```{literalinclude} ../examples/example_ofam.py
48+
:language: python
49+
:linenos:
50+
```
51+
52+
## example_peninsula.py
53+
54+
```{literalinclude} ../examples/example_peninsula.py
55+
:language: python
56+
:linenos:
57+
```
58+
59+
## example_radial_rotation.py
60+
61+
```{literalinclude} ../examples/example_radial_rotation.py
62+
:language: python
63+
:linenos:
64+
```
65+
66+
## example_stommel.py
67+
68+
```{literalinclude} ../examples/example_stommel.py
69+
:language: python
70+
:linenos:
71+
```

docs/documentation/additional_examples.rst

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

0 commit comments

Comments
 (0)