@@ -19,25 +19,47 @@ Clone the `sphinx-documentation-demo <https://github.com/bioteam/sphinx-document
19
19
20
20
2. Installing Sphinx
21
21
---------------------------------
22
- Sphinx, and extensions for Sphinx, are *python packages * that can be installed on your computer .
23
- The packages you need to install are in :code: `requirements.txt ` in the :code: `sphinx-documentation-demo ` repository.
22
+ Sphinx and its extensions are *python packages * that can be installed.
23
+ The packages you need to install are in :code: `pyproject.toml ` located in the :code: `sphinx-documentation-demo ` repository.
24
24
It's a good idea to install them in a **virtual environment **.
25
25
26
26
27
27
28
- 2a. Using :code: `venv ` to install
28
+ 2a. Using :code: `install.sh ` to install
29
29
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30
+ The :code: `install.sh ` script can be used to create a new python environment and install the scripts needed for Sphinx to function.
31
+ While in the :code: `sphinx-documentation-demo ` directory, run:
30
32
31
33
.. code-block :: bash
32
34
33
- python -m venv sphinx_venv
34
- source sphinx_venv/bin/activate
35
- pip install -r requirements.txt
35
+ bash install.sh
36
36
37
+ This will create a **hidden ** environment folder :code: `.env ` and install the packages located in :code: `pyproject.toml `.
37
38
39
+ 2b. Activating environment using :code: `source.sh `
40
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
+ After using :code: `install.sh `, or **whenever you open a new command terminal **, make sure that you **activate ** the environment by running the following command while in the :code: `sphinx-documentation-demo ` directory:
42
+ .. _My target :
38
43
39
- 3. Building Documentation
40
- -------------------------
44
+ .. code-block :: bash
45
+
46
+ source source.sh
47
+
48
+ If successful, you should have :code: `(.env) ` inserted at the beginning of your command prompt.
49
+
50
+
51
+ 3. Building Documentation on your Laptop
52
+ ----------------------------------------
53
+ The :code: `docs/ ` folder in the :code: `sphinx-documentation-demo ` project contains the .rst files that we will compile into a static webpage.
54
+ You can either run :code: `sphinx-build ` (see section 3a) or :code: `sphinx-autobuild ` (see section 3b).
55
+
56
+ .. warning ::
57
+
58
+ Make sure you have activated your python virtual environment before using either option.
59
+ See :ref: `2b. Activating environment using :code: `source.sh``
60
+
61
+ 3a. Using :code: `sphinx-build `
62
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
63
The documentation for the :code: `sphinx-documentation-demo ` is located in :code: `docs/ `.
42
64
While in the root project directory, do:
43
65
@@ -50,8 +72,11 @@ You can open the file :code:`docs/index.html` on your computer to view the HTML
50
72
51
73
52
74
53
- 3a . Using :code: `sphinx-autobuild `
75
+ 3b . Using :code: `sphinx-autobuild `
54
76
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77
+ .. tip ::
78
+
79
+ This option is probably the one you want.
55
80
The :code: `sphinx-autobuild ` extension allows us to build local documentation whenever we make changes.
56
81
It also refreshes the web browser so you can see the changes "live". This makes it **very convenient for rapid development **.
57
82
@@ -65,7 +90,49 @@ You can then point your web browser to: http://127.0.0.1:8000/
65
90
66
91
Remote Build on GitHub
67
92
======================
93
+ The :code: `_build ` directory **should not be pushed to GitHub **.
94
+ Instead we will use a GitHub Workflow to automatically build documentation that is pushed to the repository.
95
+ The built documentation will then be automatically served up on a webpage in :code: `GitHub Pages `
96
+
97
+ 1. Set up GitHub Pages
98
+ ----------------------
99
+ GitHub Pages allow users to view web pages generated by our documentation.
100
+ While there already a page set up for the :code`sphinx-documentation-demo` project, you will need to do the following steps for a new project:
101
+
102
+ 1a. Navigate to Page settings
103
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
+ .. figure :: images/guide_install_repo_settings.png
105
+ :class: sd-border-2
106
+
107
+ Click the Settings tab in the project you want to add to GitHub Pages.
108
+
109
+
110
+ .. figure :: images/guide_install_repo_page_tab.png
111
+ :class: sd-border-2
112
+
113
+ Click the Pages tab (in the left sidebar) in the Settings page.
114
+
115
+
116
+ 1b. Select branch to use with GitHub Pages
117
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118
+ .. warning ::
119
+
120
+ The GitHub repo must be **public ** in order for it to be accessible via GitHub Pages.
121
+
122
+ .. figure :: images/guide_install_page_branch.png
123
+ :class: sd-border-2
124
+
125
+ When documentation is successfully deployed, you will see a link that looks like :code: `A`. For a new repo, this will not be active.
126
+ You will need to set the branch (see :code: `B`).
127
+ This demo uses a separate branch called :code: `gh-pages` to deploy documentation.
128
+
129
+ 2. Using GitHub Workflow to Build Documentation
130
+ -----------------------------------------------
131
+ GitHub can automatically discover workflows located in the :code: `.github/workflows ` directory within the project directory.
132
+ We will be using a workflow to build documentation whenever a new commit is pushed to the repository.
68
133
69
- .. todo ::
134
+ 2a. Example Workflow
135
+ ~~~~~~~~~~~~~~~~~~~~
136
+ We will be reviewing the workflow that :code: `sphinx-documentation-demo ` uses.
137
+ You can find the workflow in :code: `sphinx-documentation-demo/.github/workflows/documentation.yml `
70
138
71
- Finish the guide for remote building on GitHub.
0 commit comments