Skip to content

Commit 56a8bb0

Browse files
committed
Convert most of project to mystmd
updates
1 parent de457da commit 56a8bb0

8 files changed

Lines changed: 177 additions & 170 deletions

File tree

.github/workflows/web_documentation.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ jobs:
4040
sphinx-book-theme \
4141
sphinx-toolbox \
4242
sphinx-copybutton \
43-
pyshtools
43+
myst-parser \
44+
pyshtools \
4445
4546
- name: Build ctplanet using pip
4647
shell: bash -l {0}
@@ -54,34 +55,8 @@ jobs:
5455
cd docs
5556
make html
5657
57-
- name: Upload artifact of the html output
58-
uses: actions/upload-artifact@v4
58+
- name: Deploy
59+
if: github.event_name != 'pull_request'
60+
uses: JamesIves/github-pages-deploy-action@v4
5961
with:
60-
name: gh-pages-documentation
61-
path: docs/_build/html/
62-
retention-days: 1
63-
64-
- name: Clean gh-pages branch
65-
shell: bash -l {0}
66-
run: |
67-
git switch gh-pages
68-
git clean -fd
69-
git config --local user.email "mark.wieczorek@ipgp.fr"
70-
git config --local user.name "GitHub Action"
71-
72-
- name: Download artifact
73-
uses: actions/download-artifact@v4
74-
with:
75-
name: gh-pages-documentation
76-
77-
- name: Commit changes
78-
shell: bash -l {0}
79-
run: |
80-
git add .
81-
git commit -m "Update gh-pages documenation" -a || true
82-
83-
- name: Push changes
84-
uses: ad-m/github-push-action@master
85-
with:
86-
branch: gh-pages
87-
github_token: ${{ secrets.GITHUB_TOKEN }}
62+
folder: docs/_build/html

docs/_static/custom.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
span.project-version {
2+
color: #999999;
3+
font-size: 0.8em;
4+
font-weight: 600;
5+
margin-left: 0px;
6+
}

docs/conf.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
import datetime
22
import ctplanet
3+
from packaging.version import Version
34

45
# Project information
56
year = datetime.date.today().year
67
project = 'ctplanet'
7-
copyright = "{}, The ctplanet developers".format(year)
8+
copyright = "{}".format(year)
89
author = 'the ctplanet developers'
9-
version = ctplanet.__version__.split(sep='-')[0] # use version of last tag
10-
release = version
10+
version = Version(ctplanet.__version__).base_version
1111

1212
# General configuration
13-
extensions = ['sphinx_copybutton',
14-
'sphinx.ext.autodoc',
15-
'sphinx.ext.autosummary',
16-
'sphinx.ext.mathjax',
17-
'sphinx.ext.napoleon',
18-
'sphinx_toolbox.collapse',
19-
]
13+
extensions = [
14+
'sphinx_copybutton',
15+
'sphinx.ext.autodoc',
16+
'sphinx.ext.autosummary',
17+
'sphinx.ext.mathjax',
18+
'sphinx.ext.napoleon',
19+
'sphinx_toolbox.collapse',
20+
'myst_parser',
21+
]
22+
myst_enable_extensions = [
23+
'attrs_block',
24+
'colon_fence',
25+
]
2026

2127
# Autosummary pages will be generated by sphinx-autogen instead of sphinx-build
2228
autosummary_generate = True
2329

2430
templates_path = ['_templates']
2531
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
26-
source_suffix = '.rst'
32+
source_suffix = ['.rst', '.md']
2733

2834
# Options for HTML output
2935
html_theme = 'sphinx_book_theme'
@@ -37,6 +43,10 @@
3743
"use_source_button": False,
3844
"use_issues_button": False,
3945
"use_download_button": False,
46+
"logo": {
47+
"text": f'<span class="project-version">{version}</span>'
48+
},
49+
"home_page_in_toc": False,
4050
}
4151
html_static_path = ['_static']
4252
html_show_sourcelink = False
@@ -45,6 +55,5 @@
4555
html_title = "ctplanet"
4656
html_short_title = "ctplanet"
4757
html_last_updated_fmt = "%b %d, %Y"
48-
49-
html_context = {
50-
}
58+
html_css_files = ["custom.css"]
59+
html_context = {}
Lines changed: 52 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,102 @@
1-
Examples
2-
========
1+
# Examples
32

4-
.. note::
5-
In order to access the example files, it is necessary to download or clone the `ctplanet` repo from `GitHub <https://github.com/MarkWieczorek/ctplanet>`_. The files are located in the `examples` directory.
3+
:::{note}
4+
In order to access the example files, it is necessary to download or clone the [ctplanet repo](https://github.com/MarkWieczorek/ctplanet) from GitHub. The files are located in the `examples` directory.
5+
:::
66

7-
Moon
8-
----
7+
## Moon
98

10-
.. collapse:: <b>Moon-Crust.py</b>
11-
12-
.. literalinclude:: ../examples/Moon-Crust.py
9+
````{collapse} <b>Moon-Crust.py</b>
10+
```{literalinclude} ../examples/Moon-Crust.py
11+
```
12+
````
1313

1414
A script that demonstrates how to calculate the thickness of the lunar crust
1515
using either a constant or variable density crust. The latter can be used
1616
to reproduce the results presented in *Wieczorek et al.* (2013).
1717

18-
.. collapse:: <b>Moon-Core.py</b>
19-
20-
.. literalinclude:: ../examples/Moon-Core.py
18+
````{collapse} <b>Moon-Core.py</b>
19+
```{literalinclude} ../examples/Moon-Core.py
20+
```
21+
````
2122

2223
Calculate the hydrostatic relief of the lunar core accounting for the
2324
non-hydrostatic potential that comes from the lithosphere.
2425

25-
Mars
26-
----
27-
28-
.. collapse:: <b>Mars-Crust.py</b>
26+
## Mars
2927

30-
.. literalinclude:: ../examples/Mars-Crust.py
28+
````{collapse} <b>Mars-Crust.py</b>
29+
```{literalinclude} ../examples/Mars-Crust.py
30+
```
31+
````
3132

3233
A script that demonstrates how to calculate the thickness of the Martian
3334
crust using either a constant or variable density crust. For the variable
3435
density crust, the density is assumed to change discontinuously across the
3536
dichotomy boundary.
3637

37-
.. collapse:: <b>Mars-Crust-hydrostatic-tests.py</b>
38-
39-
.. literalinclude:: ../examples/Mars-Crust-hydrostatic-tests.py
38+
````{collapse} <b>Mars-Crust-hydrostatic-tests.py</b>
39+
```{literalinclude} ../examples/Mars-Crust-hydrostatic-tests.py
40+
```
41+
````
4042

4143
Create a crustal thickness map of Mars from gravity and topography and
4244
compare how results change if hydrostatic interfaces are not taken into
4345
account.
4446

45-
.. collapse:: <b>Mars-Crust-InSight.py</b>
46-
47-
.. literalinclude:: ../examples/Mars-Crust-InSight.py
47+
````{collapse} <b>Mars-Crust-InSight.py</b>
48+
```{literalinclude} ../examples/Mars-Crust-InSight.py
49+
```
50+
````
4851

4952
Create a crustal thickness map of Mars from gravity and topography, using
5053
the InSight crustal thickness constraint.
5154

52-
.. collapse:: <b>Mars-Crust-InSight-dichotomy.py</b>
53-
54-
.. literalinclude:: ../examples/Mars-Crust-InSight-dichotomy.py
55+
````{collapse} <b>Mars-Crust-InSight-dichotomy.py</b>
56+
```{literalinclude} ../examples/Mars-Crust-InSight-dichotomy.py
57+
```
58+
````
5559

5660
Create a crustal thickness map of Mars from gravity and topography, using
5761
the InSight crustal thickness constraint and different densities across
5862
the dichotomy boundary.
5963

60-
.. collapse:: <b>Mars-fcn.py</b>
61-
62-
.. literalinclude:: ../examples/Mars-fcn.py
64+
````{collapse} <b>Mars-fcn.py</b>
65+
```{literalinclude} ../examples/Mars-fcn.py
66+
```
67+
````
6368

6469
Compute the free core nutation period of Mars.
6570

66-
.. collapse:: <b>Mars-shape.py</b>
67-
68-
.. literalinclude:: ../examples/Mars-shape.py
71+
````{collapse} <b>Mars-shape.py</b>
72+
```{literalinclude} ../examples/Mars-shape.py
73+
```
74+
````
6975

7076
Create images related to Mars in *Wieczorek et al.* (2019).
7177

72-
.. collapse:: <b>Mars-j2.py</b>
73-
74-
.. literalinclude:: ../examples/Mars-j2.py
78+
````{collapse} <b>Mars-j2.py</b>
79+
```{literalinclude} ../examples/Mars-j2.py
80+
```
81+
````
7582

7683
Compute the contribution to the gravitational J2 of Mars from hydrostatic
7784
interfaces beneath the lithosphere.
7885

79-
Earth
80-
-----
86+
## Earth
8187

82-
.. collapse:: <b>Earth-shape.py</b>
83-
84-
.. literalinclude:: ../examples/Earth-shape.py
88+
````{collapse} <b>Earth-shape.py</b>
89+
```{literalinclude} ../examples/Earth-shape.py
90+
```
91+
````
8592

8693
Compute hydrostatic relief of Earth using PREM.
8794

88-
Ceres
89-
-----
90-
91-
.. collapse:: <b>Ceres-shape.py</b>
95+
## Ceres
9296

93-
.. literalinclude:: ../examples/Ceres-shape.py
97+
````{collapse} <b>Ceres-shape.py</b>
98+
```{literalinclude} ../examples/Ceres-shape.py
99+
```
100+
````
94101

95102
Calculate the hydrostatic shape of Ceres.

docs/index.rst renamed to docs/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
.. toctree::
2-
:maxdepth: 2
3-
:hidden:
4-
:caption: Getting Started
1+
```{toctree}
2+
:maxdepth: 2
3+
:hidden:
4+
:caption: Getting Started
55
6-
installation.rst
7-
examples.rst
8-
references.rst
6+
installation.md
7+
examples.md
8+
references.md
9+
```
910

10-
.. toctree::
11-
:maxdepth: 2
12-
:hidden:
13-
:caption: Reference Documentation
11+
```{toctree}
12+
:maxdepth: 2
13+
:hidden:
14+
:caption: Reference Documentation
1415
15-
source/api.rst
16+
source/api.rst
17+
```
1618

17-
18-
CTPLANET
19-
========
19+
# CTPLANET
2020

2121
**ctplanet** provides several functions for working with the gravitational field of planetary crusts and hydrostatic density interfaces in the mantle and core. With this python package, you can:
2222

docs/installation.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Installation
2+
3+
## Dependencies
4+
5+
The `ctplanet` package requires `pyshtools` (>=4.13.1), which can be installed using either `conda`
6+
7+
```
8+
conda install -c conda-forge pyshtools
9+
```
10+
11+
or `pip`
12+
13+
```
14+
pip install pyshtools
15+
```
16+
17+
## Install using pip
18+
19+
Install the `ctplanet` module using pip
20+
21+
```
22+
pip install ctplanet
23+
```
24+
25+
## Install from source
26+
27+
First, clone the repo on your computer and cd to the new directory
28+
29+
```
30+
git clone https://github.com/MarkWieczorek/ctplanet.git
31+
cd ctplanet
32+
```
33+
34+
To install `ctplanet` in the active Python environment lib folder, use
35+
36+
```
37+
pip install .
38+
```
39+
40+
To instead install the files in the current working directory and link them to the system Python directory, use
41+
42+
```
43+
pip install -e .
44+
```
45+
46+
The second method is preferred if you plan on modifying the `ctplanet` source code.
47+
48+
## Working with the example scripts
49+
50+
To access the example scripts, you must download the `ctplanet`
51+
repository from GitHub. The easiest way to do this is by cloning the repo
52+
53+
```
54+
git clone https://github.com/MarkWieczorek/ctplanet.git
55+
```
56+
57+
To execute a script, it is only necessary to enter the `examples` directory and run the file using the python command
58+
59+
```
60+
cd ctplanet/examples
61+
python Moon-Crust.py
62+
```
63+
64+
:::{note}
65+
Depending on how your system is set up, it might be necessary to use
66+
explicitly ``python3`` and ``pip3`` instead of ``python`` and ``pip`` in
67+
the above commands.
68+
:::

0 commit comments

Comments
 (0)