|
37 | 37 | - PERF: Performance improvement
|
38 | 38 | - CLN: Code cleanup
|
39 | 39 |
|
40 |
| -### To push the docs in a fancy way |
| 40 | +## Documentation update |
| 41 | + |
| 42 | +The documentation is created using the [Sphinx documentation framework](https://www.sphinx-doc.org/en/master/) and the [Sphinx Gallery extension](https://sphinx-gallery.github.io/stable/index.html), which builds the documentation on basis of the repository code and the added examples. The documentation includes the tutorials and example models, which are part of the main repository, as well as additional external files. |
| 43 | + |
| 44 | +Also, opposed to the standard approach with GitHub Actions, the documentation is created offline, to avoid an unnecessary bloating of the repository and to reduce downtimes during update. |
| 45 | + |
| 46 | +Creating an update of the documentation can therefore be quite involved (depending on the level of changes). Please follow the steps below carefully. |
| 47 | + |
| 48 | +### General case: using a fork |
| 49 | + |
| 50 | +#### Create fork and perform changes |
| 51 | + |
| 52 | +- If you don't already have one, create a fork of the main GemPy repository to your own GitHub account. Make sure to tick the box to fork _all_ branches (not only the _main_ branch). |
| 53 | +- Clone the repository to your local computer. |
| 54 | +- Create a new branch of the `main` repository for the subsequent pull request. |
| 55 | +- Perform the changes, e.g.: |
| 56 | + - Update text in the documentation |
| 57 | + - Update examples (and/ or add new ones) |
| 58 | + - Perform changes in code and/ or function docstrings |
| 59 | + - etc. |
| 60 | +- If you have performed changes before, then you can also copy these changes into the branch (Note: if you have changes in a separate branch, then they can also be copied with `git restore` or `git checkout` - please see git documentation for details). |
| 61 | + |
| 62 | +#### Update documentation using Sphinx |
| 63 | + |
| 64 | +- Update the documentation using sphinx in the branch where the changes were made (`main` branch or new branch based on `main`): |
| 65 | + - Check that you have `sphinx` and `sphinx-gallery` installed; |
| 66 | + - Change to folder with documentation from main repo with `cd docs`; |
| 67 | + - Run update with `make html`; |
| 68 | + - Wait... (can take some hours when run for the first time) |
| 69 | +- The updated documentation is now in the subfolder `build/html`. Preview the generated documentation locally: open `build/html/index.html` in a web browser. |
| 70 | + |
| 71 | +#### Add updated documentation to branch `gh-pages` |
| 72 | + |
| 73 | + |
| 74 | +- If everything is fine, first commit all changes that were made in the main repo: |
| 75 | + - `git add .` |
| 76 | + - `git commit -m "update message"` |
| 77 | +- Copy updated documentation to a temporary directory,for example `/tmp/docs-html` with: |
| 78 | + - `mkdir /tmp/docs-html` |
| 79 | + - `cp -R docs/build/html/* /tmp/docs-html/` |
| 80 | +- checkout the documentation branch: `git checkout gh-pages` |
| 81 | +- Copy the updated files into the main folder of the `gh-pages` branch: `cp -R /tmp/docs-html/* .` |
| 82 | +- To be sure: check updated documentation, open `index.html`, now in the main folder of the repository. |
| 83 | +- Commit all changes: |
| 84 | + - `git add .` |
| 85 | + - `git commit -m "Updated documentation in gh-pages branch` |
| 86 | + |
| 87 | +#### Contribute updates back to main repository |
| 88 | + |
| 89 | +- Push _both_ branches `main` and `gh-pages` back to your own remote GitHub profile |
| 90 | +- Create a pull request for both branches (make sure to create the pull request for the `gh-pages` branch also to the `gh-pages` branch of the original gempy repository) |
| 91 | +- Please include meaningful descriptions about your changes (both, in the main repo, as well as in the documnetation). |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +### Special case: documentation update for maintainers with repository write rights |
41 | 96 |
|
42 | 97 | - `git worktree add ../gempy_docs gh-pages` This will create a new folder called `gempy_docs` in the parent directory of the current repo. This folder will contain the `gh-pages` branch of the repo. This is where the docs will be pushed to.
|
43 | 98 | - `cp -r --force ./docs/build/html/* ../gempy_docs/` This will copy the contents of the `docs/build/html` folder to the `VisualBayesicDocs` folder.
|
|
0 commit comments