|
1 | | -# COMPAS-docs |
| 1 | +COMPAS online documentation |
| 2 | +=========================== |
| 3 | + |
| 4 | +The COMPAS online documentation is available at this URL: |
| 5 | + |
| 6 | + https://compas.science/docs |
| 7 | + |
| 8 | +which redirects to the underlying readthedocs page at: |
| 9 | + |
| 10 | + https://compas.readthedocs.io/en/latest/index.html |
| 11 | + |
| 12 | + |
| 13 | +The source files for the online documentation are in the 'docs' directory at: |
| 14 | + |
| 15 | + https://github.com/TeamCOMPAS/COMPAS |
| 16 | + |
| 17 | + |
| 18 | +The online documentation is provided via readthedocs. To learn more about readthedocs, visit: |
| 19 | + |
| 20 | + https://readthedocs.org/ |
| 21 | + |
| 22 | + |
| 23 | +readthedocs uses the Sphinx document generator. To learn more about Sphinx, visit: |
| 24 | + |
| 25 | +https://www.sphinx-doc.org/en/master/index.html |
| 26 | + |
| 27 | + |
| 28 | +The file 'requirements.txt', in the 'docs' directory, lists the software/python modules required |
| 29 | +to build the documentation. If you plan to build the documentation locally (either so you can |
| 30 | +test your changes before you push them to the repository, or just to view the documentation locally |
| 31 | +rather than online), you will need to install these requirements. |
| 32 | + |
| 33 | +The requirements.txt file informs readthedocs what dependencies need to be installed in order for |
| 34 | +readthedocs to build the online documentation. Some modules are commented ('#') in requirements.txt |
| 35 | +because readthedocs either doesn't require them, or installs them by default - you will need to install |
| 36 | +the commented modules to build the documentation locally. |
| 37 | + |
| 38 | +Python is required, so install that if it is not already installed. Then install 'sphinx', and the |
| 39 | +modules listed in requirements.txt (including the ones commented). |
| 40 | + |
| 41 | + |
| 42 | +Updating the documentation |
| 43 | +-------------------------- |
| 44 | + |
| 45 | +The documentation source file are ReST (Restructured text) files - similar to markdown. With readthedocs, |
| 46 | +eash .rst file is compiled into a .html file, so viewable with a web browser. The documentation source |
| 47 | +files (the .rst files) are in 'docs/online-docs' (only the 'requirements.txt' file is required by |
| 48 | +readthedocs to be in the 'docs' directory - if that file is not in the 'docs' directory, or top-level |
| 49 | +directory of the repo, readthedocs will not build the online documentation). |
| 50 | + |
| 51 | +The 'online-docs' directory contains files and sub-directories that are structured to match the structured |
| 52 | +of the online documentation. Find the .rst file you want to modify, and make the changes in your favourite |
| 53 | +text editor. If you need to add new .rst files, follow the existing structure, and make sure you link the |
| 54 | +files into an index (toctree) somewhere. |
| 55 | + |
| 56 | + |
| 57 | +Building the documentation locally |
| 58 | +---------------------------------- |
| 59 | + |
| 60 | +Once you have Sphinx and the dependencies (from 'requirements.txt') installed, navigate to the 'docs/online-docs' |
| 61 | +directory in you local COMPAS repo, and type: |
| 62 | + |
| 63 | + make clean |
| 64 | + make html |
| 65 | + |
| 66 | +If everything has been installed correctly this will first remove the existing .html files for the documentation |
| 67 | +(make clean), and then recreate them (make html). During the build process you may see some warnings that some |
| 68 | +documents (.rst files) are not included in any toctree - that's ok, not all our pages are accessible via a table |
| 69 | +of contents (toctree). |
| 70 | + |
| 71 | +If the build completes successfully, there will be .html files in the 'docs/online-docs/\_build/html' directory. |
| 72 | +To view the newly build documentation, open 'docs/online-docs/\_build/html/index.html' with your web browser |
| 73 | +(e.g. type 'file://path-to-compas/docs/online-docs/\_build/html/index.html' into your web browser address bar, |
| 74 | +where 'path-to-compas' is the path to your local COMPAS repo). |
| 75 | + |
| 76 | +Aside: the '\_build' directory is not required on the remote repo (and will only bloat the repo), so you should |
| 77 | +add it to your .gitignore. |
| 78 | + |
| 79 | + |
| 80 | +Pushing the changes online |
| 81 | +-------------------------- |
| 82 | + |
| 83 | +Once you are satisfied with your changes, push the updated source files to the COMPAS repo as you would any source |
| 84 | +changes. If things work properly, that's all you need to do: readthedocs has webhooks that will notice the change |
| 85 | +and automatically rebuild the online documentation. The process (noticing the change, rebuilding the documentation, |
| 86 | +then deploying the updated web pages) could take up to 15 minutes or so. If something goes wrong and the changes are |
| 87 | +not noticed by readthedocs, or you just don't want to wait 15 minutes for your changes to appear on the web, you can |
| 88 | +log into the readthedocs project and initiate a rebuild manually. |
| 89 | + |
| 90 | +The COMPAS readthedocs project name is 'compas', and the project page is: |
| 91 | + |
| 92 | + https://readthedocs.org/projects/compas/ |
| 93 | + |
| 94 | +You need to login to the readthedocs project to do anything other than look at the dashboard. Once you are logged in |
| 95 | +you can rebuild the project. To manually start the rebuild, make sure you are on the 'Overview' page (select the |
| 96 | +'Overview' button if you are not) and select the 'Build' button. The build may sometimes fail with an "environment" |
| 97 | +error - the solution is to wait a few minutes and try again (readthedocs has some concurrency and timing limits). |
| 98 | +Logon details can be found on the COMPAS slack workspace (devel\_compas\_documentation channel). |
| 99 | + |
0 commit comments