Skip to content

Commit d9ff0da

Browse files
authored
Improve user documentation (#47)
* Move "XML configuration" section to user guide Also change title, set an anchor, and make it clear why we need that. * Create a new glossary entry TOML * Revise "Configuring the Tool" * Add URLs to Sphinx extensions * Amend IDEAS * Raise maxdepth for main index
1 parent 0224b9f commit d9ff0da

8 files changed

Lines changed: 89 additions & 29 deletions

File tree

IDEAS.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,24 @@ This is a unsorted collection of ideas what could be implemented.
1616

1717
* Implement a "check environment" function.
1818
Before we really do anything, this check some prerequisites:
19-
* Checks if certain commands are available (e.g. `git`, `jing`)
20-
* Check if commands have a minimum version
21-
* Check if the available space is enough (can be customized in the envconfig)
22-
* More...?
19+
* Checks if certain commands are available (e.g. `git`, `jing`)
20+
* Check if commands have a minimum version
21+
* Check if the available space is enough (can be customized in the envconfig)
22+
* More...?
2323

2424
This should help that it breaks in the middle of, for example, a build operation.
25+
26+
* An async `anext()` function (resembles the original `next()` function both
27+
in terms of interface and behavior):
28+
29+
```python
30+
NOT_SET = object()
31+
32+
async def anext(async_generator_expression, default=NOT_SET):
33+
try:
34+
return await async_generator_expression.__anext__()
35+
except StopAsyncIteration:
36+
if default is NOT_SET:
37+
raise
38+
return default
39+
```

changelog.d/47.doc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Improve user documentation.
2+
Move "XML configuration" section to user guide. Also change title, set an anchor, and make it clear why we need that. Revise "Configuring the Tool" section.

docs/source/conf.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,40 @@
3838

3939
extensions = [
4040
# Include documentation from docstrings
41+
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
4142
'sphinx.ext.autodoc',
43+
#
4244
# Link to other projects' documentation
45+
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html
4346
'sphinx.ext.intersphinx',
47+
#
4448
# Test code snippets in the documentation
49+
# https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html
4550
'sphinx.ext.doctest',
51+
#
4652
# Create short aliases for external links
53+
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
4754
'sphinx.ext.extlinks',
55+
#
56+
# Embed Graphviz graphs
57+
# https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html
58+
'sphinx.ext.graphviz',
59+
#
4860
# Document Click command-line interfaces
61+
# https://sphinx-click.readthedocs.io/en/latest/
4962
'sphinx_click',
63+
#
5064
# Add a "copy" button to code blocks
65+
# https://sphinx-copybutton.readthedocs.io/en/latest/
5166
'sphinx_copybutton',
67+
#
5268
# Render type hints in signatures
69+
# https://github.com/tox-dev/sphinx-autodoc-typehints
5370
'sphinx_autodoc_typehints',
71+
#
5472
# Generate API documentation from source code
73+
# https://sphinx-autoapi.readthedocs.io/en/latest/
5574
'autoapi.extension',
56-
# Embed Graphviz graphs
57-
'sphinx.ext.graphviz',
5875
]
5976

6077
templates_path = ['_templates']

docs/source/developer/project-dependencies.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,3 @@ External tools
5858
* :command:`make` is used to build the documentation.
5959
* :command:`jing`: for validation the XML configuration files.
6060
* :command:`gh`: optional tool for interacting with GitHub, see :ref:`github-cli`.
61-
62-
63-
64-
XML configuration
65-
-----------------
66-
67-
Formerly known as the *Docserv XML configs*. These configuration files defines the :term:`products <Product>`, their :term:`releases <Docset>`, their :term:`lifecycle <Lifecycle>` status and more.
68-
69-
Clone the |gl_xmlconfig| or use the RNC schema from :gh_tree:`src/docbuild/config/xml/data/` to create this configuration.

docs/source/glossary.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ For Python specific terms, look into:
132132
A configuration file used in Python project to define build system
133133
requirements and project metadata.
134134

135-
See :pep:`518`
135+
See :pep:`518`, :term:`TOML`
136136

137137
Pytest
138138
A testing framework. It's used to write, organize, and run
@@ -166,6 +166,12 @@ For Python specific terms, look into:
166166

167167
See section :ref:`build-docs`.
168168

169+
TOML
170+
*Tom's Obvious, Minimal Language* is a configuration file format
171+
used to define environment settings for the docbuild tool.
172+
173+
See https://toml.io/en/
174+
169175
UV
170176
A fast package manager which simplifies the building, installing,
171177
and managing of this project.

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is the documentation for the |project| project, hosted at |gh_repo|.
1111

1212

1313
.. toctree::
14-
:maxdepth: 1
14+
:maxdepth: 2
1515
:caption: Contents
1616

1717
user/index

docs/source/user/config.rst

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,32 @@
33
Configuring the Tool
44
---------------------
55

6-
Currently, the environment configuration is done via a TOML file. An example configuration file is provided in the repository. find it at :gh_tree:`etc/docbuild/env.example.toml`. Copy it to your working directory and name it accordingly to your purpose, for example, ``env.development.toml``, ``env.testing.toml``, or ``env.production.toml``. Modify it according to your needs.
6+
.. note::
77

8-
To use the configuration file, specific it with the option ``--env-config``.
8+
To prevent accidental commits of sensitive information, all configuration files matching the :file:`env.*.toml` pattern in the root directory are ignored by git. However, this rule does not apply to files within the :file:`etc/` directory.
99

10-
If you need to deal with different environments (testing, staging, production), it can be tedious to type. In such a case, use aliases in your shell.
10+
Use separate TOML files to define the configuration for each of your environments. To avoid confusion, name each file according to its specific purpose. For instance, use :file:`env.devel.toml` for development, :file:`env.staging.toml` for staging, and :file:`env.production.toml` for production.
11+
12+
An example configuration file is provided in the repository at :gh_tree:`etc/docbuild/env.example.toml`.
13+
14+
To use your configuration file, follow these steps one time:
15+
16+
#. In your cloned GitHub repository, copy the example file :file:`etc/docbuild/env.example.toml` to the root directory of this project. For example::
17+
18+
cp etc/docbuild/env.example.toml env.devel.toml
19+
20+
#. Open your TOML file.
21+
22+
#. Adjust the path ``paths.root_config_dir``. Use the path from :ref:`get-xml-config`. The rest can stay as it is.
23+
24+
#. Specific the configuration with the global option ``--env-config``.
25+
26+
To deal with different environments without having to type the full command each time, create aliases in your shell. This allows you to quickly switch between configurations without needing to remember the exact command syntax.
1127

1228
.. code-block:: shell-session
13-
:caption: Example aliases for a configuration file
29+
:caption: Example aliases for different configuration files
1430
:name: docbuild-aliases
1531
1632
$ alias docbuild-prod='docbuild --env-config env.production.toml'
1733
$ alias docbuild-test='docbuild --env-config env.testing.toml'
18-
$ alias docbuild-dev='docbuild --env-config env.development.toml'
19-
20-
Keep in mind, all configuration files that match the pattern ``env.*.toml`` are ignored by git. This is on purpose to prevent accidental commits of sensitive information.
34+
$ alias docbuild-dev='docbuild --env-config env.devel.toml'

docs/source/user/install.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Installing docbuild
33

44
To install the docbuild tool, follow these steps:
55

6-
1. :ref:`prepare-installation` - Prepare your environment for installation.
6+
#. :ref:`prepare-installation` - Prepare your environment for installation.
77

8-
2. :ref:`installing-docbuild` - Install the docbuild tool itself.
8+
#. :ref:`installing-docbuild` - Install the docbuild tool itself.
99

10-
3. :ref:`configuring-docbuild` - Configure the docbuild tool to suit your needs.
10+
#. :ref:`get-xml-config` - Get the XML configuration files required for building documentation.
11+
12+
#. :ref:`configuring-docbuild` - Configure the docbuild tool to suit your needs.
1113

1214

1315
.. _prepare-installation:
@@ -45,15 +47,15 @@ There are different methods to install the :command:`uv` package manager
4547
4648
You should see the version of :command:`uv` printed in the terminal.
4749

48-
3. **Install Python 3.13 or higher**
50+
3. **Install Python 3.12 or higher**
4951

5052
As of the time of writing, the docbuild tool requires Python 3.12 or higher. Install the Python version using :command:`uv`:
5153

5254
.. code-block:: shell-session
5355
5456
$ uv python install 3.13
5557
56-
This command will download Python 3.13 and install it in the directory :file:`~/.local/share/uv/python/<VERSION>`.
58+
The previous command downloads Python 3.13 and install it in the directory :file:`~/.local/share/uv/python/<VERSION>`.
5759

5860
4. **Check the available Python versions**
5961

@@ -105,3 +107,16 @@ Installing the tool
105107
Resolved 29 packages in 586ms
106108
Built docbuild @ file:///.../docbuild
107109
Installed 15 packages in 2.11s
110+
111+
112+
.. _get-xml-config:
113+
114+
Getting the XML configuration
115+
-----------------------------
116+
117+
Formerly known as the *Docserv XML configs*. These configuration files defines the :term:`products <Product>`, their :term:`releases <Docset>`, their :term:`lifecycle <Lifecycle>` status and more.
118+
119+
The tool needs the XML configuration to build the documentation correctly. The XML configuration is not part of the docbuild tool itself, but it is required to run the tool.
120+
121+
Clone the |gl_xmlconfig| to your machine where you can access it easily.
122+
As an alternative, use the RNC schema from :gh_tree:`src/docbuild/config/xml/data/` to create your own configuration.

0 commit comments

Comments
 (0)