Skip to content

Commit 86a8825

Browse files
Update app dev tutorial to include Go and Java (#5042)
This change uses (linked) tabs to display code snippets and language-specific commands for the user's desired programming language. In order to use the sphinx-tabs extension, the version of Python used to build the docs had to be updated. Since the `n42org/tox` Docker image used had a very old Python version baked in, and there were no more recent versions available, the `make docs` target now uses the official Python image. In addition to providing a much more current Python environment, this image natively supports arm64 in addition to amd64, allowing docs to be built on Apple Silicon Macs. Signed-off-by: Mark S. Lewis <[email protected]>
1 parent 3657477 commit 86a8825

File tree

5 files changed

+653
-220
lines changed

5 files changed

+653
-220
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ spaces:
345345
@scripts/check_file_name_spaces.sh
346346

347347
.PHONY: docs
348-
docs:
349-
@docker run --rm -v $$(pwd):/docs n42org/tox:3.4.0 sh -c 'cd /docs && tox -e docs'
348+
docs: # Builds the documentation in html format
349+
@docker run --rm -v $$(pwd):/docs python:3.12-slim sh -c 'pip install --no-input tox && cd /docs && tox -e docs'
350350

351351
.PHONY: ccaasbuilder-clean
352352
ccaasbuilder-clean/%:

docs/requirements.txt

+29-28
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
alabaster==0.7.16
2-
Babel==2.14.0
3-
certifi==2023.11.17
4-
charset-normalizer==3.3.2
1+
alabaster==1.0.0
2+
babel==2.16.0
3+
certifi==2024.8.30
4+
charset-normalizer==3.4.0
55
commonmark==0.9.1
6-
docutils==0.20.1
7-
idna==3.6
6+
docutils==0.21.2
7+
idna==3.10
88
imagesize==1.4.1
9-
importlib-metadata==6.7.0
10-
Jinja2==3.1.3
9+
importlib-metadata==8.5.0
10+
Jinja2==3.1.4
1111
markdown-it-py==3.0.0
12-
MarkupSafe==2.1.3
13-
mdit-py-plugins==0.4.0
12+
MarkupSafe==3.0.1
13+
mdit-py-plugins==0.4.2
1414
mdurl==0.1.2
15-
myst-parser==2.0.0
16-
packaging==23.2
17-
Pygments==2.17.2
18-
python-markdown-math==0.2
19-
pytz==2023.3
20-
PyYAML==6.0.1
15+
myst-parser==4.0.0
16+
packaging==24.1
17+
Pygments==2.18.0
18+
python-markdown-math==0.8
19+
pytz==2024.2
20+
PyYAML==6.0.2
2121
readthedocs-sphinx-ext==2.2.5
2222
recommonmark==0.7.1
23-
requests==2.31.0
23+
requests==2.32.3
2424
six==1.16.0
2525
snowballstemmer==2.2.0
26-
Sphinx==7.2.6
27-
sphinx-rtd-theme==2.0.0
28-
sphinxcontrib-applehelp==1.0.8
29-
sphinxcontrib-devhelp==1.0.6
30-
sphinxcontrib-htmlhelp==2.0.5
26+
Sphinx==8.1.3
27+
sphinx-rtd-theme==3.0.1
28+
sphinx-tabs==3.4.7
29+
sphinxcontrib-applehelp==2.0.0
30+
sphinxcontrib-devhelp==2.0.0
31+
sphinxcontrib-htmlhelp==2.1.0
3132
sphinxcontrib-jquery==4.1
3233
sphinxcontrib-jsmath==1.0.1
33-
sphinxcontrib-qthelp==1.0.7
34-
sphinxcontrib-serializinghtml==1.1.10
35-
sphinxcontrib-websupport==1.2.4
36-
typing_extensions==4.7.1
37-
urllib3==2.1.0
38-
zipp==3.15.0
34+
sphinxcontrib-qthelp==2.0.0
35+
sphinxcontrib-serializinghtml==2.0.0
36+
sphinxcontrib-websupport==2.0.0
37+
typing_extensions==4.12.2
38+
urllib3==2.2.3
39+
zipp==3.20.2

docs/source/conf.py

+39-36
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,30 @@
1010
import os
1111
import sys
1212
from os import environ
13-
sys.path.insert(0, os.path.abspath('.'))
13+
14+
sys.path.insert(0, os.path.abspath("."))
1415

1516
import sphinx_rtd_theme
1617

17-
rtd_tag = 'latest'
18-
if environ.get('READTHEDOCS_VERSION') is not None:
19-
rtd_tag = os.environ['READTHEDOCS_VERSION']
18+
rtd_tag = "latest"
19+
if environ.get("READTHEDOCS_VERSION") is not None:
20+
rtd_tag = os.environ["READTHEDOCS_VERSION"]
2021

2122

2223
placeholder_replacements = {
2324
"{BRANCH}": "main",
24-
"{BRANCH_DOC}" : "latest", # Used to target the correct ReadTheDocs distribution version
25-
"{RTD_TAG}": rtd_tag
25+
"{BRANCH_DOC}": "latest", # Used to target the correct ReadTheDocs distribution version
26+
"{RTD_TAG}": rtd_tag,
2627
}
2728

2829
# -- Project information -----------------------------------------------------
2930
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
3031

31-
project = u'Hyperledger Fabric Docs'
32-
copyright = u'2017-2024, Hyperledger Foundation'
33-
author = u'Hyperledger Foundation'
34-
release = u'main'
35-
version = u'main'
32+
project = "Hyperledger Fabric Docs"
33+
copyright = "2017-2024, Hyperledger Foundation"
34+
author = "Hyperledger Foundation"
35+
release = "main"
36+
version = "main"
3637

3738
# -- General configuration ---------------------------------------------------
3839
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -46,43 +47,43 @@
4647
# Sphinx projects.
4748
# Installed version as per directive in docs/requirement.txt
4849
source_parsers = {
49-
'.md': 'recommonmark.parser.CommonMarkParser',
50+
".md": "recommonmark.parser.CommonMarkParser",
5051
}
5152

52-
# The file extensions of source files. Sphinx considers the files with this suffix as sources.
53+
# The file extensions of source files. Sphinx considers the files with this suffix as sources.
5354
# The value can be a dictionary mapping file extensions to file types. For example:
54-
source_suffix = {
55-
'.rst': 'restructuredtext',
56-
'.md': 'markdown'
57-
}
55+
source_suffix = {".rst": "restructuredtext", ".md": "markdown"}
5856

5957
# Add any paths that contain templates here, relative to this directory.
60-
templates_path = ['_templates']
58+
templates_path = ["_templates"]
6159

6260
# List of patterns, relative to source directory, that match files and
6361
# directories to ignore when looking for source files.
6462
# This patterns also effect to html_static_path and html_extra_path
65-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
63+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
6664

6765
# Used to be "master_doc"
6866
# The main toctree document
69-
root_doc = 'index'
67+
root_doc = "index"
7068

7169
# The name of the Pygments (syntax highlighting) style to use.
72-
pygments_style = 'sphinx'
70+
pygments_style = "sphinx"
7371

7472
# If true, `todo` and `todoList` produce output, else they produce nothing.
7573
todo_include_todos = True
7674

77-
extensions = ['sphinx.ext.autodoc',
78-
'sphinx.ext.doctest',
79-
'sphinx.ext.intersphinx',
80-
'sphinx.ext.todo',
81-
'sphinx.ext.imgmath',
82-
'sphinx.ext.ifconfig',
83-
'sphinx.ext.viewcode',
84-
'myst_parser',
85-
'sphinxcontrib.jquery']
75+
extensions = [
76+
"sphinx.ext.autodoc",
77+
"sphinx.ext.doctest",
78+
"sphinx.ext.intersphinx",
79+
"sphinx.ext.todo",
80+
"sphinx.ext.imgmath",
81+
"sphinx.ext.ifconfig",
82+
"sphinx.ext.viewcode",
83+
"myst_parser",
84+
"sphinxcontrib.jquery",
85+
"sphinx_tabs.tabs",
86+
]
8687

8788
# -- Special API Accesses -------------------------------------------------
8889
# They create an instance of the Sphinx object, documented here
@@ -91,31 +92,33 @@
9192
#
9293
# We then call it to perform special/specific customizations.
9394

95+
9496
def placeholderReplace(app, docname, source):
9597
result = source[0]
9698
for key in app.config.placeholder_replacements:
9799
result = result.replace(key, app.config.placeholder_replacements[key])
98100
source[0] = result
99101

102+
100103
def setup(app):
101-
app.add_css_file('css/custom.css')
102-
app.add_config_value('placeholder_replacements', {}, True)
103-
app.connect('source-read', placeholderReplace)
104+
app.add_css_file("css/custom.css")
105+
app.add_config_value("placeholder_replacements", {}, True)
106+
app.connect("source-read", placeholderReplace)
104107

105108

106109
# -- Options for HTML output -------------------------------------------------
107110
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
108111

109-
html_theme = 'sphinx_rtd_theme'
112+
html_theme = "sphinx_rtd_theme"
110113

111114
# html_css_files = ['css/custom.css']
112115

113116
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
114117

115-
html_static_path = ['_static']
118+
html_static_path = ["_static"]
116119

117120
html_add_permalinks = True
118121

119122
# -- MyST-specific Options -------------------------------------------------
120123
# https://myst-parser.readthedocs.io/en/latest/configuration.html#sphinx-config-options
121-
myst_all_links_external = True
124+
myst_all_links_external = True

0 commit comments

Comments
 (0)