Skip to content

Commit 6aa71c5

Browse files
authored
docs: Remove docs extra, upgrade Sphinx, enable hyperlinks to gRPC/Python/NumPy docs (#710)
* Reformat pyproject.toml * docs: Convert docs extra to a dependency group and upgrade to latest Sphinx * Update poetry.lock * docs: Generate docs with Python 3.11 and install with Poetry * docs: Update copyright year to 2017-%Y * docs: Enable intersphinx * pyproject.toml: Remove sphinx-click * Update poetry.lock * CHANGELOG.md: Document removal of `docs` extra * docs: Add gRPC intersphinx links * docs: Add protobuf hyperlinks
1 parent db80440 commit 6aa71c5

File tree

7 files changed

+133
-124
lines changed

7 files changed

+133
-124
lines changed

.github/workflows/generate_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/setup-python@v5
1616
id: setup-python
1717
with:
18-
python-version: "3.9"
18+
python-version: "3.11"
1919
- name: Set up Poetry
2020
uses: Gr1N/setup-poetry@v9
2121
with:

.readthedocs.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
version: 2
44

55
build:
6-
os: ubuntu-22.04
6+
os: ubuntu-24.04
77
tools:
8-
python: "3.9"
8+
python: "3.11"
9+
jobs:
10+
post_create_environment:
11+
- pip install poetry==1.8.2
12+
post_install:
13+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --only main,docs
914

1015
sphinx:
1116
configuration: docs/conf.py
12-
13-
python:
14-
install:
15-
- method: pip
16-
path: .
17-
extra_requirements:
18-
- docs

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ All notable changes to this project will be documented in this file.
3131
* ...
3232

3333
* ### Major Changes
34-
* ...
34+
* Removed the `docs` extra and converted it to a Poetry dependency group.
3535

3636
* ### Known Issues
3737
* ...

docs/conf.py

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
"""Sphinx Configuration File."""
22

3-
import datetime
43
import os
54
import pathlib
65
import sys
6+
77
import toml
88

9-
sys.path.insert(0, os.path.abspath('../'))
9+
sys.path.insert(0, os.path.abspath("../"))
1010

1111

1212
# -- General configuration ------------------------------------------------
1313

14-
extensions = ['sphinx.ext.autodoc',
15-
'sphinx.ext.coverage',
16-
'sphinx.ext.viewcode',
17-
'sphinx.ext.napoleon']
14+
extensions = [
15+
"sphinx.ext.autodoc",
16+
"sphinx.ext.coverage",
17+
"sphinx.ext.intersphinx",
18+
"sphinx.ext.napoleon",
19+
"sphinx.ext.viewcode",
20+
]
1821

19-
source_suffix = '.rst'
22+
source_suffix = ".rst"
2023

21-
master_doc = 'index'
24+
master_doc = "index"
2225

2326
root_path = pathlib.Path(__file__).parent.parent
2427
pyproj_file = root_path / "pyproject.toml"
@@ -27,57 +30,70 @@
2730
project = proj_config["tool"]["poetry"]["name"]
2831
company = "National Instruments"
2932
author = company
30-
copyright = f"{datetime.datetime.now().year}, {company}"
33+
copyright = f"2017-%Y, {company}"
3134

3235
# Release is the full version, version is only the major component
3336
release = proj_config["tool"]["poetry"]["version"]
3437
version = ".".join(release.split(".")[:2])
3538
description = proj_config["tool"]["poetry"]["description"]
3639

37-
language = 'en'
40+
language = "en"
3841

39-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
42+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
4043

41-
pygments_style = 'sphinx'
44+
pygments_style = "sphinx"
4245

4346
todo_include_todos = False
4447

48+
intersphinx_mapping = {
49+
"grpc": ("https://grpc.github.io/grpc/python/", None),
50+
"numpy": ("https://numpy.org/doc/stable/", None),
51+
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
52+
"python": ("https://docs.python.org/3", None),
53+
}
4554

4655
# -- Options for HTML output ----------------------------------------------
4756

48-
html_theme = 'sphinx_rtd_theme'
57+
html_theme = "sphinx_rtd_theme"
4958

5059
html_static_path = []
5160

5261

5362
# -- Options for HTMLHelp output ------------------------------------------
5463

55-
htmlhelp_basename = 'NI-DAQmxPythonAPIdoc'
64+
htmlhelp_basename = "NI-DAQmxPythonAPIdoc"
5665

5766

5867
# -- Options for LaTeX output ---------------------------------------------
5968

60-
latex_elements = {
61-
}
69+
latex_elements = {}
6270

6371
latex_documents = [
64-
(master_doc, 'NI-DAQmxPythonAPI.tex', 'NI-DAQmx Python API Documentation',
65-
'National Instruments', 'manual'),
72+
(
73+
master_doc,
74+
"NI-DAQmxPythonAPI.tex",
75+
"NI-DAQmx Python API Documentation",
76+
"National Instruments",
77+
"manual",
78+
),
6679
]
6780

6881

6982
# -- Options for manual page output ---------------------------------------
7083

71-
man_pages = [
72-
(master_doc, 'ni-daqmxpythonapi', 'NI-DAQmx Python API Documentation',
73-
[author], 1)
74-
]
84+
man_pages = [(master_doc, "ni-daqmxpythonapi", "NI-DAQmx Python API Documentation", [author], 1)]
7585

7686

7787
# -- Options for Texinfo output -------------------------------------------
7888

7989
texinfo_documents = [
80-
(master_doc, 'NI-DAQmxPythonAPI', 'NI-DAQmx Python API Documentation',
81-
author, 'NI-DAQmxPythonAPI', 'One line description of project.',
82-
'Miscellaneous'),
90+
(
91+
master_doc,
92+
"NI-DAQmxPythonAPI",
93+
"NI-DAQmx Python API Documentation",
94+
author,
95+
"NI-DAQmxPythonAPI",
96+
"One line description of project.",
97+
"Miscellaneous",
98+
),
8399
]

poetry.lock

Lines changed: 43 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)