Skip to content

Commit f791242

Browse files
authored
Add support for multi version documentation (#264)
1 parent 26e55a1 commit f791242

File tree

18 files changed

+101
-54
lines changed

18 files changed

+101
-54
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- name: Build Documentation
1818
run: |
19-
poetry run python -m nox -s build-docs
19+
poetry run sphinx-multiversion docs/ .html-documentation
2020
2121
- name: Deploy
2222
uses: JamesIves/github-pages-deploy-action@v4.6.3

doc/_templates/version.html

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

doc/changes/unreleased.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@
44

55
* Dropped python 3.8 support
66

7+
## ✨ Added
8+
9+
* Added support for multi version Documentation
10+
711
## 🐞 Fixed
812

913
* Fixed CD workflow template
1014

1115
## 📚 Documentation
1216

13-
* Add Documentation on Metrics
17+
* Added Documentation on Metrics
1418

1519
## 🔩 Internal
1620

17-
* Relock dependencies
21+
* Relocked dependencies
1822

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"sphinx_design",
3939
"sphinx_inline_tabs",
4040
"sphinx_copybutton",
41+
"exasol.toolbox.sphinx.multiversion",
4142
]
4243

4344
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

doc/user_guide/modules/sphinx/multiversion/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Sphinx configuration file."""
2+
23
import time
34

45
author = "Jan Holthuis"

exasol/toolbox/metrics.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,14 @@ def char(value: str, default: str = "H") -> str:
157157
return value[0]
158158
return default
159159

160-
weight = {"LL": 1/18, "LM": 1/15, "LH": 1/12, "ML": 1/9, "MM": 1/6, "MH": 1/3}
160+
weight = {
161+
"LL": 1 / 18,
162+
"LM": 1 / 15,
163+
"LH": 1 / 12,
164+
"ML": 1 / 9,
165+
"MM": 1 / 6,
166+
"MH": 1 / 3,
167+
}
161168
exp = 0.0
162169
for infos in ratings:
163170
severity = infos["issue_severity"]

exasol/toolbox/nox/_lint.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
def _pylint(session: Session, files: Iterable[str]) -> None:
1313
session.run(
14-
"poetry",
15-
"run",
16-
"python",
17-
"-m",
18-
"pylint",
19-
"--output-format",
20-
"colorized,json:.lint.json,text:.lint.txt",
21-
*files)
14+
"poetry",
15+
"run",
16+
"python",
17+
"-m",
18+
"pylint",
19+
"--output-format",
20+
"colorized,json:.lint.json,text:.lint.txt",
21+
*files,
22+
)
2223

2324

2425
def _type_check(session: Session, files: Iterable[str]) -> None:

exasol/toolbox/nox/_shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _context(session: Session, **kwargs: Any) -> MutableMapping[str, Any]:
6565
parser = _context_parser()
6666
namespace, args = parser.parse_known_args(session.posargs)
6767
cli_context: MutableMapping[str, Any] = vars(namespace)
68-
cli_context['fwd-args'] = args
68+
cli_context["fwd-args"] = args
6969
default_context = {"db_version": "7.1.9", "coverage": False}
7070
# Note: ChainMap scans last to first
7171
return ChainMap(kwargs, cli_context, default_context)

exasol/toolbox/nox/_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _test_command(
2828
else []
2929
)
3030
pytest_command = ["pytest", "-v", f"{path}"]
31-
return base_command + coverage_command + pytest_command + context['fwd-args']
31+
return base_command + coverage_command + pytest_command + context["fwd-args"]
3232

3333

3434
def _unit_tests(

exasol/toolbox/sphinx/multiversion/__init__.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,16 @@
1010
1111
So huge thanks to the original author `Jan Holthuis <https://github.com/Holzhaus>`_ and all contributors.
1212
13-
TODO's:
14-
* add standard default templates
15-
* add support for index page
16-
* add sorting support
17-
* add gh pages support
18-
* add command to deploy to gh-pages
19-
* add support for loading packed version template?
13+
14+
NOTE:
15+
The original version and its defaults were minimally adjusted to work in Exasol's projects with the defaults and without adding an extra template. The [Shibuya](https://github.com/lepture/shibuya) theme is expected to be used for HTML, which already evaluates the versions field in the HTML context and generates an appropriate selector for the versions.
2016
"""
2117

2218
from exasol.toolbox.sphinx.multiversion.main import main
19+
from exasol.toolbox.sphinx.multiversion.sphinx import setup
20+
from exasol.toolbox.version import VERSION
2321

24-
__version__ = "0.1.0"
22+
__version__ = VERSION
2523

2624
__all__ = [
2725
"setup",

0 commit comments

Comments
 (0)