Skip to content

Commit bb6027d

Browse files
ArBridgemanckunki
andauthored
Documentation/512 consolidate documentation (#513)
* sphinx-multiversion to building_documentation.rst * Move FAQ docs to documentation/troubleshooting.rst * Move links:x to documentation/index & documentation/troubleshooting * Remove unneeded steps as in cookiecutter template & .gitignore there * Write as conf.py included in cookiecutter project template, so don't need to provide specific config instructions here * Move configuration information into documentation/index and reference in getting_started * Add changelog entry * Improve introduction of documentation per review Co-authored-by: Christoph Kuhnke <christoph.kuhnke@exasol.com> * Sections need actual numbers not #s per review * Update description to make clearer GitHub workflows & nicer content per review Co-authored-by: Christoph Kuhnke <christoph.kuhnke@exasol.com> * Identify workflows & actions & be more explicit per review Co-authored-by: Christoph Kuhnke <christoph.kuhnke@exasol.com> * Alter comment per review but fix with apostrophe applied * Add sphinx redirect --------- Co-authored-by: Christoph Kuhnke <christoph.kuhnke@exasol.com>
1 parent 46801d8 commit bb6027d

File tree

11 files changed

+196
-137
lines changed

11 files changed

+196
-137
lines changed

doc/changes/unreleased.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
# Unreleased
2+
3+
## Documentation
4+
5+
* #512: Consolidated and added to deploying documentation pages

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@
8888
linkcheck_allowed_redirects = {
8989
# All HTTP redirections from the source URI to
9090
# the canonical URI will be treated as "working".
91-
r"https://github\.com/.*": r"https://github\.com/login*"
91+
r"https://github\.com/.*": r"https://github\.com/login*",
92+
r"https://www.sphinx-doc\.org/.*": r"https://www.sphinx-doc\.org/en/master/.*",
9293
}

doc/developer_guide/modules/modules.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ Modules
44
.. toctree::
55
:maxdepth: 2
66

7-
sphinx/sphinx
87
nox
98
nox_tasks

doc/developer_guide/modules/sphinx/sphinx.rst

Lines changed: 0 additions & 24 deletions
This file was deleted.

doc/faq.rst

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,6 @@ There are several methods to configure your shell:
1717
2. For a general setup: :code:`export PYTHONPATH=`pwd``
1818
3. Alternatively, tools like `direnv <https://direnv.net>`_ can be used.
1919

20-
.. _faq_duplicated_label_error:
21-
22-
Duplicated label error when building documentation
23-
--------------------------------------------------
24-
25-
Similar error to :code:`Warning, treated as error: integration-test-docker-environment/doc/changes/changes_0.10.0.md:5:duplicate label summary, other instance in integration-test-docker-environment/doc/changes/changes_0.1.0.md'`, might be caused by sphinx extension `sphinx.ext.autosectionlabel`. Try to remove this extension in `doc/conf.py`.
26-
27-
28-
.. _faq_multiversion_build_warnings:
29-
30-
Warning while building multiversion documentation
31-
--------------------------------------------------
32-
When running ``nox -s docs:multiversion``, I receive the following warnings during the build:
33-
34-
.. code-block::
35-
36-
WARNING: unknown config value 'smv_metadata_path' in override, ignoring
37-
WARNING: unknown config value 'smv_current_version' in override, ignoring
38-
39-
If you receive the warnings above, it is very likely that the multiversion extension is not configured in your Sphinx configuration (``conf.py``). Try adding it to your configuration and rerun the build.
40-
41-
.. code-block:: python
42-
43-
extensions = [
44-
...,
45-
...,
46-
"exasol.toolbox.sphinx.multiversion",
47-
]
48-
49-
50-
.. _faq_multiversion_selection_missing:
51-
52-
Missing Version Selection Box in Multiversion Documentation
53-
------------------------------------------------------------
54-
55-
I have run ``nox -s docs:multiversion``, but I still do not see any version selection box in the upper right corner before the GitHub symbol.
56-
57-
This is likely due to :ref:`faq_multiversion_build_warnings`
58-
59-
60-
.. _faq_multiversion_limited_versions:
61-
62-
Limited Previous Versions in Multiversion Documentation
63-
-------------------------------------------------------
64-
65-
If not all previous versions of the project are available via the version selection box of the multiversion documentation, it is likely due to the fact that the unavailable documentation for those versions was not in a compatible format (there hasn't been a compatible setup of a Sphinx-based documentation).
66-
67-
6820
.. _faq_failing_format_check:
6921

7022
Format Still Fails After Running ``project:fix``

doc/user_guide/customization.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@ Customization
33

44
.. _plugins:
55

6-
Nox Tasks `links:x`
7-
---------------------
8-
9-
PTB offers two nox sessions to check hyperlinks in your documentation:
10-
* `links:list` - List all the links within the documentation
11-
* `links:check` - Checks whether all links in the documentation are accessible
12-
13-
`links:check` is run in the CI `checks.yml`. If this step fails in the CI, it will cause
14-
the build to break. Please check the output & manually resolve the issues. There might
15-
be some cases where you need to update your `doc/conf.py` with specific values for the allowed
16-
options for the [Linkcheck Builder](https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder).
17-
18-
196
Nox Task Plugins
207
----------------
218

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
.. _deploying_documentation:
2+
3+
Deploying documentation
4+
=======================
5+
6+
.. toctree::
7+
:maxdepth: 2
8+
9+
multiversion
10+
troubleshooting
11+
12+
The PTB uses ref:`sphinx <https://www.sphinx-doc.org/>`__ to build and validate the contents
13+
of your project's documentation. PTB expects the project's documentation in directory ``doc``,
14+
primarily as ``rst`` files. The ``doc/conf.py`` acts as the configuration file for building the
15+
documentation.
16+
17+
GitHub workflow ``checks.yml`` also runs the checks for the documention.
18+
This enables updating and fixing the documentation together with other changes in the same pull request.
19+
The final building & serving of the documentation happens in GitHub workflow ``gh-pages.yml``.
20+
21+
+--------------------------+------------------+----------------------------------------+
22+
| Nox session | CI Usage | Action |
23+
+==========================+==================+========================================+
24+
| ``docs:build`` | ``checks.yml`` | Builds the documentation |
25+
+--------------------------+------------------+----------------------------------------+
26+
| ``docs:clean`` | No | Removes the documentation build folder |
27+
+--------------------------+------------------+----------------------------------------+
28+
| ``docs:multiversion`` | ``gh-pages.yml`` | Builds the multiversion documentation |
29+
+--------------------------+------------------+----------------------------------------+
30+
| ``docs:open`` | No | Opens the built documentation |
31+
+--------------------------+------------------+----------------------------------------+
32+
| ``links:check`` | ``checks.yml`` | Checks if all links in the |
33+
| | | documentation are accessible |
34+
+--------------------------+------------------+----------------------------------------+
35+
| ``links:list`` | No | Lists all links in the documentation |
36+
+--------------------------+------------------+----------------------------------------+
37+
38+
.. _documentation_configuration:
39+
40+
Configuration
41+
+++++++++++++
42+
43+
``doc/conf.py``
44+
^^^^^^^^^^^^^^^
45+
The PTB's cookiecutter project template already provides a file ``doc/conf.py`` with
46+
default content. If your project needs adjustment, please refer to:
47+
48+
* the `general sphinx documentation <https://www.sphinx-doc.org/en/master/>`__.
49+
* specifically to the `Linkcheck Builder <https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder>`__
50+
for ``links:check`` and ``links:list``.
51+
52+
``gh-pages.yml``
53+
^^^^^^^^^^^^^^^^
54+
GitHub workflow ``gh-pages.yml`` uses actions ``upload-pages-artifact`` and ``deploy-pages``.
55+
In order to properly deploy your generated documentation, you will need to manually
56+
reconfigure the GitHub Pages settings for the repo:
57+
58+
#. Go to the affected repo's GitHub page
59+
#. Select 'Settings'
60+
#. Scroll down & select 'Pages'
61+
#. Within the 'Build and deployment' section, change 'Source' to 'GitHub Actions'.
62+
63+
You also need to configure settings for the `github-pages` environment:
64+
65+
#. Go to the affected repo's GitHub page
66+
#. Select 'Settings'
67+
#. Scroll down & select 'Environment'
68+
#. Click on 'github-pages'
69+
#. In the 'Deployment branches and tags', click 'Add deployment branch or tag rule'
70+
#. Select 'Ref type' to be 'Tag' and set the 'Name pattern' to `[0-9]*.[0-9]*.[0-9]*` (or whatever matches that repo's tags)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
sphinx-multiversion
2+
===================
3+
4+
The ``sphinx-multiversion`` extension is a modified copy of
5+
`sphinx-contrib/multiversion <https://github.com/sphinx-contrib/multiversion>`__.
6+
This copy was taken from version :code:`0.24.0`.
7+
8+
It has been modified to work with Exasol's integration projects, which often require a
9+
specific project structure and layout. Additionally, it is designed to be used with an
10+
HTML theme that supports displaying and selecting multiple versions if the `versions`
11+
variable is set in the HTML context of sphinx. As of this writing, the theme used in
12+
conjunction with this modified version of ``sphinx-multiversion`` is
13+
`SHIBUYA <https://github.com/lepture/shibuya>`__.
14+
15+
.. attention::
16+
17+
**Attribution**
18+
19+
A big thanks to the original author and project
20+
`Jan Holthuis <https://github.com/Holzhaus>`_, as well as
21+
`Samuel Dowling <https://github.com/samuel-emrys>`_, as we took various patches for
22+
the plugin from his fork.
23+
24+
Note: Both projects are published under the `BSD-2 license <https://opensource.org/license/bsd-2-clause>`_.
25+
26+
* https://github.com/sphinx-contrib/multiversion
27+
* https://github.com/samuel-emrys/sphinx-multiversion
28+
29+
.. note::
30+
31+
In the long term, it would be advantageous to remove unnecessary features and code
32+
that are not required for Exasol's projects. Adding further tests would also be
33+
beneficial. However, the primary goal was to create a low-effort, stable
34+
multi-version support solution for our projects.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Troubleshooting
2+
===============
3+
4+
Duplicated label error when building documentation
5+
--------------------------------------------------
6+
7+
If you have an error similar to this one:
8+
.. :code-block::
9+
10+
Warning, treated as error:
11+
integration-test-docker-environment/doc/changes/changes_0.10.0.md:5:duplicate
12+
label summary, other instance in
13+
integration-test-docker-environment/doc/changes/changes_0.1.0.md'
14+
15+
then, this might be caused by sphinx extension ``sphinx.ext.autosectionlabel``.
16+
Try to remove this extension in ``doc/conf.py``.
17+
18+
19+
.. _faq_multiversion_build_warnings:
20+
21+
Warning while building multiversion documentation
22+
--------------------------------------------------
23+
When running ``nox -s docs:multiversion``, you receive the following warnings during the build:
24+
25+
.. code-block::
26+
27+
WARNING: unknown config value 'smv_metadata_path' in override, ignoring
28+
WARNING: unknown config value 'smv_current_version' in override, ignoring
29+
30+
It is likely that the multiversion extension is not configured in your Sphinx
31+
configuration (``doc/conf.py``). Try adding it to your configuration and rerun the build.
32+
33+
.. code-block:: python
34+
35+
extensions = [
36+
...,
37+
...,
38+
"exasol.toolbox.sphinx.multiversion",
39+
]
40+
41+
42+
43+
Missing version selection box in multiversion documentation
44+
------------------------------------------------------------
45+
46+
You have run ``nox -s docs:multiversion``, but you still do not see any version
47+
selection box in the upper right corner before the GitHub symbol.
48+
49+
This is likely due to :ref:`faq_multiversion_build_warnings` or
50+
:ref:`limited_multiversion_documentation`.
51+
52+
53+
.. _limited_multiversion_documentation:
54+
55+
Limited previous versions in multiversion documentation
56+
-------------------------------------------------------
57+
58+
If not all previous versions of the project are available via the version selection box
59+
of the multiversion documentation, it is likely due to the fact that the unavailable
60+
documentation for those versions was not in a compatible format. In other words, there
61+
had not, for those missing versions, been a compatible setup of a Sphinx-based
62+
documentation.
63+
64+
``links:check`` breaks CI build
65+
-------------------------------
66+
``links:check`` is run in the CI ``checks.yml``. If this step fails in the CI, it will
67+
cause the build to break. Please check the output & manually resolve the issues. There
68+
might be some cases where you need to update your ``doc/conf.py`` with specific values
69+
for the allowed options for the
70+
`Linkcheck Builder <https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder>`__.

doc/user_guide/features/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Features
88

99
collecting_metrics
1010
creating_a_release
11+
documentation/index
1112

1213
Uniform Project Layout
1314
----------------------

0 commit comments

Comments
 (0)