You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/contribute/mkdocs_venv.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,19 +9,19 @@ tags:
9
9
- documentation
10
10
---
11
11
12
-
# MkDocs (Python Virtual Enviroment)
12
+
# MkDocs (Python Virtual Environment)
13
13
14
14
## Introduction
15
15
16
-
One of the aspects of the process of creating documentation for Rocky Linux is verifying that your new document displays correctly prior to publication.
16
+
One of the aspects of the process of creating documentation for Rocky Linux is verifying that your new document displays correctly before publication.
17
17
18
-
The purpose of this guide is to give some suggestions for performing this task in a local python environment dedicated solely for this purpose.
18
+
The purpose of this guide is to give some suggestions for performing this task in a local python environment dedicated solely to this purpose.
19
19
20
-
The documentation for Rocky Linux is written using the Markdown language, a language generally converted to other formats. Markdown is clean in syntax and particularly well suited for writing technical documentation.
20
+
The documentation for Rocky Linux is written using the Markdown language, generally converted to other formats. Markdown is clean in syntax and particularly well suited for writing technical documentation.
21
21
22
22
In our case, the documentation is converted to `HTML` using a python application that takes care of building the static site. The application used by the developers is [MkDocs](https://www.mkdocs.org/).
23
23
24
-
One problem that arises during the development of a python application is achieving isolation of the python instance used for development from the system interpreter. The isolation is to prevent any incompatibilities between the modules needed to install the python application and the modules installed on the host system. Any incompatibilities would result in visualization errors or malfunctions of your local site.
24
+
One problem that arises during the development of a python application is achieving isolation of the python instance used for development from the system interpreter. The isolation prevents incompatibilities between the modules needed to install the Python application and those installed on the host system.
25
25
26
26
There are already excellent guides that use **containers** for isolating the python interpreter. These guides, however, imply a knowledge of the various containerization techniques.
27
27
@@ -44,7 +44,7 @@ First, create the folder that will contain everything else, and contextually, al
44
44
mkdir -p ~/lab/rockydocs/env
45
45
```
46
46
47
-
### Python Virtual Environment
47
+
### Python virtual environment
48
48
49
49
To create your copy of Python where MkDocs will run, use the module specially developed for this purpose, the python `venv` module. This allows the creation of a virtual environment, derived from the one installed on the system, totally isolated and independent.
50
50
@@ -86,7 +86,7 @@ As you can see, the python interpreter used by the virtual environment is still
86
86
87
87
Among the files listed in the structure, there are several files named **activate** that serve this purpose. The suffix of each file indicates the related *shell*.
88
88
89
-
Activation separates this instance of python from the system instance and allows us to perform documentation development without interference. To activate it, go to the *env* folder and run the command:
89
+
Activation separates this python instance from the system python instance and allows us to perform documentation development without interference. To activate it, go to the *env* folder and run the command:
@@ -128,13 +128,13 @@ To exit the virtual environment, use the *deactivate* command:
128
128
[rocky_user@rl9 env]$
129
129
```
130
130
131
-
As you can see, the terminal *prompt*after deactivation has reverted to the system one. You should always check the prompt carefully before running *MkDocs* installation and subsequent commands. Checking this will prevent unnecessary and unwanted global application installations and missed runs of `mkdocs serve`.
131
+
As you can see, the terminal *prompt* has reverted to the system one after deactivation. You should always check the prompt carefully before running *MkDocs* installation and subsequent commands. Checking this will prevent unnecessary and unwanted global application installations and missed runs of `mkdocs serve`.
132
132
133
133
### Downloading the repositories
134
134
135
135
Now that you have seen how to create your virtual environment and how to manage it, you can move on to preparing everything needed.
136
136
137
-
Two repositories are required for the implementation of a local version of the Rocky Linux documentation: the documentation repository [documentation](https://github.com/rocky-linux/documentation), and the site structure repository [docs.rockylinux.org](https://github.com/rocky-linux/docs.rockylinux.org). Downloading these is done from the Rocky Linux GitHub.
137
+
Two repositories are required to implement a local version of the Rocky Linux documentation: the documentation repository [documentation](https://github.com/rocky-linux/documentation), and the site structure repository [docs.rockylinux.org](https://github.com/rocky-linux/docs.rockylinux.org). Downloading these is done from the Rocky Linux GitHub.
138
138
139
139
Start with the site structure repository, which you will clone into the **rockydocs** folder:
140
140
@@ -210,7 +210,7 @@ If everything has worked as planned, you can exit the virtual environment and st
210
210
211
211
### Linking documentation
212
212
213
-
Now that everything needed is available, you just need to link the documentation repository within the *docs.rockylinux.org* container site. Following the setup defined in *mkdocs.yml*:
213
+
Now that everything is available, you must link the documentation repository within the *docs.rockylinux.org* container site. Following the setup defined in *mkdocs.yml*:
214
214
215
215
```yaml
216
216
docs_dir: 'docs/docs'
@@ -225,11 +225,11 @@ cd docs/
225
225
ln -s ../../documentation/docs/ docs
226
226
```
227
227
228
-
## Starting Local Documentation
228
+
## Starting local documentation
229
229
230
-
At this point you are ready to start the local copy of the Rocky Linux documentation. First you need to start the python virtual environment and then initialize your MkDocs instance with the settings defined in **docs.rockylinux.org/mkdocs.yml**.
230
+
You are ready to start the local copy of the Rocky Linux documentation. First you need to start the python virtual environment and then initialize your MkDocs instance with the settings defined in **docs.rockylinux.org/mkdocs.yml**.
231
231
232
-
This file has all the settings necessary for localization, feature management, and theme management.
232
+
This file has all the settings for localization, feature, and theme management.
233
233
234
234
The developers for the site's UI chose the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme, which provides many additional features and customizations over the default MkDocs theme.
235
235
@@ -259,13 +259,13 @@ INFO - [11:46:50] Watching paths for changes:
259
259
INFO - [11:46:50] Serving on http://127.0.0.1:8000/
260
260
```
261
261
262
-
Opening your browser at the address specified (http://1127.0.0.1:8000) you will have your copy of the documentation site running. The copy perfectly mirrors the online site in functionality and structure, allowing you to assess the appearance and impact your page will have on the site.
262
+
You will have your copy of the documentation site running when opening your browser at the address specified (http://1127.0.0.1:8000). The copy perfectly mirrors the online site in functionality and structure, allowing you to assess the appearance and impact your page will have on the site.
263
263
264
264
MkDocs incorporates a mechanism for checking changes to the files in the folder specified by the `docs_dir` path, and inserting a new page or modifying an existing one in `documentation/docs` will automatically be recognized and produce a new static site build.
265
265
266
266
Since the time for MkDocs to build the static site can be several minutes, the recommendation is to carefully review the page you are writing before saving or inserting it. This saves waiting for the site to build just because you forgot, for example, punctuation.
267
267
268
-
### Exit the Development Environment
268
+
### Exit the development environment
269
269
270
270
Once the display of your new page meets your satisfaction, you can exit your development environment. This involves first exiting *MkDocs* and then deactivating the python virtual environment. To exit *MkDocs* you need to use the key combination <kbd>CTRL</kbd> + <kbd>C</kbd>, and as you saw above, to exit the virtual environment you will need to invoke the `deactivate` command.
271
271
@@ -280,8 +280,8 @@ INFO - [22:32:41] Serving on http://127.0.0.1:8000/
280
280
281
281
## Conclusions and final thoughts
282
282
283
-
Verification of your new pages in a local development site provides us with the assurance that your work will always conform to the online documentation site therefore allowing us to contribute optimally.
283
+
Verifying your new pages in a local development site assures us that your work will always conform to the online documentation site, allowing us to contribute optimally.
284
284
285
285
Document compliance is also a great help to the curators of the documentation site, who then only have to deal with the correctness of the content.
286
286
287
-
In conclusion, you can say that this method allows meeting the requirements for a "clean" installation of MkDocs without the need to resort to containerization.
287
+
In conclusion, you can say that this method allows for meeting the requirements for a "clean" installation of MkDocs without the need to resort to containerization.
0 commit comments