Skip to content

Commit 005ab7c

Browse files
committed
Make more consistent with Foundations. Add missing steps for pre-commit hooks
1 parent 7dd1c87 commit 005ab7c

File tree

1 file changed

+59
-30
lines changed

1 file changed

+59
-30
lines changed

CONTRIBUTING.md

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,75 @@ Pythia structure, forking, repository cloning, branching, etc.).
1010

1111
The portal site is built with [Sphinx](https://www.sphinx-doc.org/).
1212

13-
When testing new content is important to build and view the site. Read the Docs automatically builds the site for you when each Pull Request is checked. You can also build it locally on your machine.
13+
When testing new content it is important to build and view the site. Read the Docs automatically builds the site for you when each Pull Request is checked. However, you can also build it locally on your machine following the instructions
14+
below.
1415

1516
### Building the site
1617

17-
- After checking out a local copy of the site, in your favorite terminal, navigate to the `content` directory of the source repository
18-
```bash
19-
cd projectpythia.github.io/content
20-
```
21-
- Use [conda](https://docs.conda.io/) to set up a build environment:
22-
```bash
23-
conda env create -f ../ci/environment.yml
24-
conda activate pythia
25-
```
26-
- Build the site locally using Sphinx (which you just installed in the `pythia` environment, along with all necessary dependencies):
27-
```bash
28-
make html
29-
```
30-
- The newly rendered site is now available in `content/_build/html/index.html`.
31-
Open with your web browser, or from the terminal:
32-
```bash
33-
open _build/html/index.html
34-
```
35-
- However, many of the links will not work. For all of the links
36-
found in the portal to work properly, you'll need to set up a local
37-
testing server. This can be done with Python's http.server by running
38-
the following command from within the content directory:
18+
After checking out a local copy of the site, in your favorite terminal, navigate to the `content` directory of the source repository
3919

20+
```bash
21+
cd projectpythia.github.io/content
4022
```
23+
24+
Use [conda](https://docs.conda.io/) to set up a build environment:
25+
26+
```bash
27+
conda env create -f ../ci/environment.yml
28+
```
29+
30+
This will create or update the dev environment (`pythia`).
31+
32+
#### Install `pre-commit` hooks
33+
34+
This repository includes `pre-commit` hooks (defined in
35+
`.pre-commit-config.yaml`). To activate/install these pre-commit
36+
hooks, run:
37+
38+
```bash
39+
conda activate pythia
40+
pre-commit install
41+
```
42+
43+
Setting up the environment is typically a one-time step.
44+
45+
_NOTE_: The `pre-commit` package is already installed via the `pythia` conda environment.
46+
47+
#### Building the book locally
48+
49+
Build the site locally using Sphinx (which you just installed in the `pythia` environment, along with all necessary dependencies):
50+
51+
```bash
52+
make html
53+
```
54+
55+
The newly rendered site is now available in `content/_build/html/index.html`.
56+
Open with your web browser, or from the terminal:
57+
58+
```bash
59+
open _build/html/index.html
60+
```
61+
62+
However, many of the links will not work. For all of the links
63+
found in the portal to work properly, you'll need to set up a local
64+
testing server. This can be done with Python's http.server by running
65+
the following command from within the content directory:
66+
67+
```bash
4168
python -m http.server --directory _build/html/
4269
```
4370

44-
- and then pointing your browser at the URL: localhost:8000.
71+
and then pointing your browser at the URL: localhost:8000.
72+
73+
More information on setting up a local test server is available from [here](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server)
4574

46-
- More information on setting up a local test server is available from [here](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server)
75+
When you're done, you can deactivate the dedicated build environment with
76+
77+
```bash
78+
conda deactivate
79+
```
4780

48-
- When you're done, you can deactivate the dedicated build environment with
49-
```bash
50-
conda deactivate
51-
```
52-
- You can re-activate the `pythia` conda environment at any time with `conda activate pythia`.
81+
You can re-activate the `pythia` conda environment at any time with `conda activate pythia`.
5382

5483
### To view the Read the Docs autobuild
5584

0 commit comments

Comments
 (0)