Skip to content

Commit

Permalink
docs fixes (incl. rel->abs links in PyPI metadata) (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
slayoo authored Nov 5, 2024
1 parent ca1b264 commit 8b7a497
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
32 changes: 7 additions & 25 deletions docs/markdown/pympdata_landing.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ with arguments suiting the problem at hand, e.g.:

<details>
<summary>Julia code (click to expand)</summary>

```Julia
using Pkg
Pkg.add("PyCall")
Expand All @@ -83,16 +82,12 @@ options = Options(n_iters=2)

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
Options = py.importlib.import_module('PyMPDATA').Options;
options = Options(pyargs('n_iters', 2));
```
</details>

<details open>
<summary>Python code (click to expand)</summary>

<details>
<summary>Rust code (click to expand)</summary>
```Rust
Expand All @@ -106,6 +101,8 @@ fn main() -> PyResult<()> {
```
</details>

<details open>
<summary>Python code (click to expand)</summary>
```Python
from PyMPDATA import Options
options = Options(n_iters=2)
Expand All @@ -130,7 +127,6 @@ The schematic of the employed grid/domain layout in two dimensions is given belo

<details>
<summary>Python code (click to expand)</summary>

```Python
import numpy as np
from matplotlib import pyplot
Expand Down Expand Up @@ -189,7 +185,6 @@ conditions and with an initial Gaussian signal in the scalar field

<details>
<summary>Julia code (click to expand)</summary>

```Julia
ScalarField = pyimport("PyMPDATA").ScalarField
VectorField = pyimport("PyMPDATA").VectorField
Expand All @@ -214,9 +209,9 @@ advector = VectorField(
)
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
ScalarField = py.importlib.import_module('PyMPDATA').ScalarField;
VectorField = py.importlib.import_module('PyMPDATA').VectorField;
Expand Down Expand Up @@ -290,7 +285,6 @@ data = (np.full((nx + 1, ny), Cx), np.full((nx, ny + 1), Cy))

<details open>
<summary>Python code (click to expand)</summary>

```Python
from PyMPDATA import ScalarField
from PyMPDATA import VectorField
Expand Down Expand Up @@ -338,7 +332,6 @@ When instantiating the [``Stepper``](https://open-atmos.github.io/PyMPDATA/PyMPD
of either supplying just the number of dimensions or specialising the stepper for a given grid:
<details>
<summary>Julia code (click to expand)</summary>

```Julia
Stepper = pyimport("PyMPDATA").Stepper

Expand All @@ -347,7 +340,6 @@ stepper = Stepper(options=options, n_dims=2)
</details>
<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
Stepper = py.importlib.import_module('PyMPDATA').Stepper;
Expand All @@ -361,7 +353,6 @@ stepper = Stepper(pyargs(...

<details>
<summary>Rust code (click to expand)</summary>

```Rust
let n_dims: i32 = 2;
let stepper_arg = PyDict::new_bound(py);
Expand All @@ -371,7 +362,6 @@ let _ = PyDictMethods::set_item(&stepper_arg, "n_dims", &n_dims);
</details>

<summary>Python code (click to expand)</summary>

```Python
from PyMPDATA import Stepper

Expand All @@ -381,14 +371,13 @@ stepper = Stepper(options=options, n_dims=2)
or
<details>
<summary>Julia code (click to expand)</summary>

```Julia
stepper = Stepper(options=options, grid=(nx, ny))
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
stepper = Stepper(pyargs(...
'options', options, ...
Expand All @@ -399,7 +388,6 @@ stepper = Stepper(pyargs(...

<details>
<summary>Rust code (click to expand)</summary>

```Rust
let _stepper_arg_alternative = vec![("options", &options), ("grid", &PyTuple::new_bound(py, nx_ny).into_any())].into_py_dict_bound(py);
let stepper_ = py.import_bound("PyMPDATA")?.getattr("Stepper")?;
Expand All @@ -409,7 +397,6 @@ stepper = Stepper(pyargs(...

<details open>
<summary>Python code (click to expand)</summary>

```Python
stepper = Stepper(options=options, grid=(nx, ny))
```
Expand Down Expand Up @@ -463,17 +450,16 @@ Continuing with the above code snippets, instantiating
a solver and making 75 integration steps looks as follows:
<details>
<summary>Julia code (click to expand)</summary>

```Julia
Solver = pyimport("PyMPDATA").Solver
solver = Solver(stepper=stepper, advectee=advectee, advector=advector)
solver.advance(n_steps=75)
state = solver.advectee.get()
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
Solver = py.importlib.import_module('PyMPDATA').Solver;
solver = Solver(pyargs('stepper', stepper, 'advectee', advectee, 'advector', advector));
Expand All @@ -484,7 +470,6 @@ state = solver.advectee.get();

<details>
<summary>Rust code (click to expand)</summary>

```Rust
let solver_ = py.import_bound("PyMPDATA")?.getattr("Solver")?;
let solver = solver_.call((), Some(&vec![("stepper", stepper), ("advectee", advectee), ("advector", advector)].into_py_dict_bound(py)))?;
Expand All @@ -499,7 +484,6 @@ state = solver.advectee.get();

<details open>
<summary>Python code (click to expand)</summary>

```Python
from PyMPDATA import Solver

Expand All @@ -513,7 +497,6 @@ state = solver.advectee.get()
Now let's plot the results using `matplotlib` roughly as in Fig.&nbsp;5 in [Arabas et al. 2014](https://doi.org/10.3233/SPR-140379):
<details>
<summary>Python code (click to expand)</summary>

```Python
def plot(psi, zlim, norm=None):
xi, yi = np.indices(psi.shape)
Expand Down Expand Up @@ -558,21 +541,20 @@ interactive debugging, one way of enabling it is by setting the
following environment variable before importing PyMPDATA:
<details>
<summary>Julia code (click to expand)</summary>

```Julia
ENV["NUMBA_DISABLE_JIT"] = "1"
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
setenv('NUMBA_DISABLE_JIT', '1');
```
</details>

<details open>
<summary>Python code (click to expand)</summary>

```Python
import os
os.environ["NUMBA_DISABLE_JIT"] = "1"
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/index.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<tr>
<td>
<ul>
<li><a href="https://open-atmos.github.io/PyMPDATA/PyMPDATA.html">docs</a></li>
<li><a href="https://open-atmos.github.io/PyMPDATA/PyMPDATA.html">docs (<b>incl. tutorial</b>)</a></li>
<li><a href="https://pypi.org/p/PyMPDATA">pypi</a></li>
</ul>
</td>
Expand Down
5 changes: 4 additions & 1 deletion examples/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def get_long_description():
pdoc_links = re.compile(
r"(`)([\w\d_-]*).([\w\d_-]*)(`)", re.MULTILINE | re.UNICODE
)
return pdoc_links.sub(r'<a href="\2/\3.html">\3</a>', file.read())
return pdoc_links.sub(
r'<a href="https://open-atmos.github.io/PyMPDATA/\2/\3.html">\3</a>',
file.read(),
)


CI = "CI" in os.environ
Expand Down

0 comments on commit 8b7a497

Please sign in to comment.