Skip to content

Commit 44ceb80

Browse files
authored
docs: sphinx-autoapi (#367)
2 parents 7d019ea + 70d94c5 commit 44ceb80

File tree

9 files changed

+206
-19
lines changed

9 files changed

+206
-19
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ $ pip install --user --upgrade --pre libtmux
1818

1919
This created issues with running poetry while inside the virtualenv.
2020

21+
### Documentation
22+
23+
- Try out sphinx-autoapi for its table of contents generation ({issue}`367`)
24+
2125
## libtmux 0.11.0 (2022-03-10)
2226

2327
### Compatibility

docs/api.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ versions.
1616
## Server Object
1717

1818
```{eval-rst}
19-
.. autoclass:: Server
19+
.. autoapiclass:: Server
2020
:members:
2121
:inherited-members:
2222
:private-members:
@@ -27,7 +27,7 @@ versions.
2727
## Session Object
2828

2929
```{eval-rst}
30-
.. autoclass:: Session
30+
.. autoapiclass:: Session
3131
:members:
3232
:inherited-members:
3333
:private-members:
@@ -38,7 +38,7 @@ versions.
3838
## Window Object
3939

4040
```{eval-rst}
41-
.. autoclass:: Window
41+
.. autoapiclass:: Window
4242
:members:
4343
:inherited-members:
4444
:private-members:
@@ -49,7 +49,7 @@ versions.
4949
## Pane Object
5050

5151
```{eval-rst}
52-
.. autoclass:: Pane
52+
.. autoapiclass:: Pane
5353
:members:
5454
:inherited-members:
5555
:private-members:
@@ -68,22 +68,22 @@ versions.
6868
```
6969

7070
```{eval-rst}
71-
.. autoclass:: libtmux.common.TmuxRelationalObject
71+
.. autoapiclass:: libtmux.common.TmuxRelationalObject
7272
:members:
7373
```
7474

7575
```{eval-rst}
76-
.. autoclass:: libtmux.common.TmuxMappingObject
76+
.. autoapiclass:: libtmux.common.TmuxMappingObject
7777
:members:
7878
```
7979

8080
```{eval-rst}
81-
.. autoclass:: libtmux.common.EnvironmentMixin
81+
.. autoapiclass:: libtmux.common.EnvironmentMixin
8282
:members:
8383
```
8484

8585
```{eval-rst}
86-
.. autoclass:: libtmux.common.tmux_cmd
86+
.. autoapiclass:: libtmux.common.tmux_cmd
8787
```
8888

8989
```{eval-rst}
@@ -187,7 +187,7 @@ versions.
187187
```
188188

189189
```{eval-rst}
190-
.. autoclass:: libtmux.test.EnvironmentVarGuard
190+
.. autoapiclass:: libtmux.test.EnvironmentVarGuard
191191
```
192192

193193
## Environmental variables

docs/conf.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
extensions = [
2424
"sphinx.ext.autodoc",
25+
"autoapi.extension",
2526
"sphinx.ext.intersphinx",
2627
"sphinx_autodoc_typehints",
2728
"sphinx.ext.todo",
@@ -96,6 +97,17 @@
9697
ogp_desscription_length = about["__description__"]
9798
ogp_site_name = about["__title__"]
9899

100+
# sphinx.ext.autodoc
101+
autoclass_content = "both"
102+
autodoc_member_order = "bysource"
103+
autosummary_generate = True
104+
105+
# sphinx-autoapi
106+
autoapi_type = "python"
107+
autoapi_dirs = [project_root / "libtmux"]
108+
autoapi_generate_api_docs = False # when fales, use directives
109+
suppress_warnings = ["autoapi.python_import_resolution", "autoapi.not_readable"]
110+
99111
# sphinx-copybutton
100112
copybutton_prompt_text = (
101113
r">>> |\.\.\. |> |\$ |\# | In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "

docs/reference/panes.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
[pty(4)]: https://www.freebsd.org/cgi/man.cgi?query=pty&sektion=4
1111

1212
```{eval-rst}
13-
.. autoclass:: libtmux.Pane
14-
:noindex:
13+
.. autoapiclass:: libtmux.Pane
1514
:members:
1615
:inherited-members:
1716
:private-members:

docs/reference/servers.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ In tmux, a server is automatically started on your behalf
1111
when you first run tmux.
1212

1313
```{eval-rst}
14-
.. autoclass:: libtmux.Server
15-
:noindex:
14+
.. autoapiclass:: libtmux.Server
1615
:members:
1716
:inherited-members:
1817
:private-members:

docs/reference/sessions.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
- identified by `$`, e.g. `$313`
88

99
```{eval-rst}
10-
.. autoclass:: libtmux.Session
11-
:noindex:
10+
.. autoapiclass:: libtmux.Session
1211
:members:
1312
:inherited-members:
1413
:private-members:

docs/reference/windows.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
```
1212

1313
```{eval-rst}
14-
.. autoclass:: Window
15-
:noindex:
14+
.. autoapiclass:: Window
1615
:members:
1716
:inherited-members:
1817
:private-members:

poetry.lock

Lines changed: 175 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ sphinx-inline-tabs = "*"
5353
sphinxext-opengraph = "*"
5454
sphinx-copybutton = "^0.5.0"
5555
sphinxext-rediraffe = "*"
56+
sphinx-autoapi = "^1.8.4"
5657
myst_parser = "~0.17.0"
5758

5859
### Testing ###
@@ -74,7 +75,7 @@ isort = "*"
7475
flake8 = "*"
7576

7677
[tool.poetry.extras]
77-
docs = ["sphinx", "sphinx-issues", "sphinx-autodoc-typehints", "sphinx-autobuild", "sphinx-copybutton", "sphinxext-opengraph", "sphinx-inline-tabs", "sphinxext-rediraffe", "myst_parser", "furo"]
78+
docs = ["sphinx", "sphinx-issues", "sphinx-autoapi", "sphinx-autodoc-typehints", "sphinx-autobuild", "sphinx-copybutton", "sphinxext-opengraph", "sphinx-inline-tabs", "sphinxext-rediraffe", "myst_parser", "furo"]
7879
test = ["pytest", "pytest-rerunfailures", "pytest-mock", "pytest-watcher"]
7980
coverage = ["codecov", "coverage", "pytest-cov"]
8081
format = ["black", "isort"]

0 commit comments

Comments
 (0)