Skip to content

Commit 7569ff6

Browse files
authored
Local deploy config (MetOffice#530)
1 parent ff06496 commit 7569ff6

File tree

4 files changed

+77
-37
lines changed

4 files changed

+77
-37
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = source
99
BUILDDIR = build
1010

11+
# For local deployment to ~/public_html/<repo>/<branch>
12+
REPO := $(notdir $(shell git rev-parse --show-toplevel))
13+
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
14+
DEPLOYDIR = $(HOME)/public_html
15+
1116
# Put it first so that "make" without argument is like "make help".
1217
help:
1318
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -17,4 +22,7 @@ help:
1722
# Catch-all target: route all unknown targets to Sphinx using the new
1823
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1924
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
25+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
26+
27+
deploy:
28+
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(DEPLOYDIR)/$(REPO)/$(BRANCH)" $(SPHINXOPTS) $(O)

README.md

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,93 @@
11
# Simulation Systems
22

3-
This repository contains documentation that is common across the many
3+
[![Docs](https://github.com/MetOffice/simulation-systems/actions/workflows/publish_wps.yaml/badge.svg)](https://github.com/MetOffice/simulation-systems/actions/workflows/publish_wps.yaml)
4+
5+
This repository contains the working practices documentation common to the
6+
various
47
[simulation and modelling repositories](https://github.com/MetOffice/simulation-systems/wiki)
58
owned by the Met Office.
69

7-
## Build the documentation
10+
The documentation in the repository can be compiled in different ways.
811

9-
A quick and clean way to get the package dependencies is via
10-
[uv](https://docs.astral.sh/uv/) package manager.
12+
> [!NOTE]
13+
> Optional system dependencies for PDF generation may require LaTeX
14+
> distributions and other third-party libraries.
1115
12-
Ps: Optional system dependencies for PDF generation may require LaTeX
13-
distributions and other third-party libraries.
16+
## Setup environment
1417

15-
### using uv
18+
You can set up the environment ro build and deploy the documentation using any
19+
of the following methods:
20+
21+
### 1. Using uv
22+
23+
A quick and clean way to get the package dependencies is via the
24+
[uv](https://docs.astral.sh/uv/) package manager.
1625

1726
```shell
1827
git clone https://github.com/MetOffice/simulation-systems
1928
cd simulation-systems
2029

2130
# Install dependencies (see pyproject.toml) in project .venv
2231
uv sync
23-
uv run make clean html
24-
25-
# Verify documentation
26-
firefox build/html/index.html
2732
```
2833

29-
### using pip
34+
### 2. Using pip
3035

31-
Alternatively, if your have Python-3.11 or higher installed (sphinx==8.2.3
32-
requirement), you can install the dependencies in a virtual environment via pip,
33-
and build the documentation like:
36+
If you have Python 3.11 or higher installed (`sphinx==8.2.3` required), you can
37+
use pip:
3438

3539
```shell
40+
git clone https://github.com/MetOffice/simulation-systems
3641
cd simulation-systems
3742

38-
</path/to/python3.11+> -m venv .venv
43+
<path/to/python3.11+> -m venv .venv
3944
source .venv/bin/activate
4045
pip install .
41-
make clean html
4246
```
4347

44-
### using conda
48+
### 3. Using conda
4549

4650
```shell
51+
git clone https://github.com/MetOffice/simulation-systems
52+
cd simulation-systems
53+
4754
conda env create -f env.yml
4855
conda activate sphinx_doc_env
56+
```
57+
58+
## Build documentation
59+
60+
```shell
61+
# For uv environment
62+
uv run make clean html
63+
64+
# For pip or conda environments
4965
make clean html
50-
firefox build/html/index.html
66+
```
67+
68+
After building, the HTML documentation can be found in the `build/html/`
69+
directory of your local repository. You can open the documentation in any web
70+
browser.
71+
72+
**Met Office users** can skip build step above and deploy the documentation
73+
directly to a predefined location:
74+
`~/public_html/simulation-systems/<branch-name>/html/`
75+
76+
```shell
77+
uv run make clean deploy # uv env
78+
# OR
79+
make clean deploy # pip or conda env
5180
```
5281

5382
## Contributing
5483

55-
The documentation is written in sphinx markup. To develop changes to this
56-
documentation first create an issue detailing the changes that are required.
57-
Then create a branch in a clone of this repository, linking it to your issue and
58-
regularly building your changes as described above.
84+
Please follow the project's [Code of Conduct](CONTRIBUTING.md)
85+
86+
The documentation is written in Sphinx markup. To propose changes:
87+
88+
1. Create an issue detailing the required changes.
89+
2. Create a branch in your clone of this repository, linking it to your issue.
90+
3. Regularly build your changes as described above.
5991

60-
Once happy with your development create a pull request and request a review from
92+
Once satisfied, create a pull request and request a review from
6193
[MetOffice/ssdteam](https://github.com/orgs/MetOffice/teams/ssdteam).

env.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sphinx_doc_env
22
dependencies:
3-
- python>=3
3+
- python>=3.11
44
- pip
55
- pip:
66
- -r .github/workflows/requirements.txt

source/conf.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
# -- Project information -----------------------------------------------------
2121

22-
project = 'Simulation Systems'
23-
copyright = 'Met Office'
24-
author = 'Simulation Systems and Deployment Team'
22+
project = "Simulation Systems"
23+
copyright = "Met Office"
24+
author = "Simulation Systems and Deployment Team"
2525

2626

2727
# -- General configuration ---------------------------------------------------
@@ -34,14 +34,14 @@
3434

3535
# Added to use dropdowns with command: pip install sphinx-design
3636
extensions = [
37-
'sphinx_design',
38-
'sphinx_copybutton',
39-
'sphinxcontrib.rsvgconverter',
40-
'sphinxcontrib.mermaid',
37+
"sphinx_design",
38+
"sphinx_copybutton",
39+
"sphinxcontrib.rsvgconverter",
40+
"sphinxcontrib.mermaid",
4141
]
4242

4343
# Add any paths that contain templates here, relative to this directory.
44-
templates_path = ['_templates']
44+
templates_path = ["_templates"]
4545

4646
# List of patterns, relative to source directory, that match files and
4747
# directories to ignore when looking for source files.
@@ -55,7 +55,7 @@
5555
# The theme to use for HTML and HTML Help pages. See the documentation for
5656
# a list of builtin themes.
5757
#
58-
html_theme = 'pydata_sphinx_theme'
58+
html_theme = "pydata_sphinx_theme"
5959

6060
html_theme_options = {
6161
"footer_start": ["crown-copyright"],
@@ -93,6 +93,6 @@
9393
# -- Options for linkcheck builder -------------------------------------------
9494
linkcheck_anchors = False
9595
linkcheck_ignore = [
96-
r'.*\.py$', # Ignores URLs ending with .py
97-
r'https://github.com/MetOffice/um*',
96+
r".*\.py$", # Ignores URLs ending with .py
97+
r"https://github.com/MetOffice/um*",
9898
]

0 commit comments

Comments
 (0)