Skip to content

Commit 3de3cc1

Browse files
authored
docs: Use gp-libs for doc helpers (#410)
## Changes Add gp-libs (https://github.com/git-pull/gp-libs, https://gp-libs.git-pull.com/, https://pypi.org/project/gp-libs/) - Render changelog in linkify_issues, https://gp-libs.git-pull.com/linkify_issues/ - Fix Table of contents rendering with sphinx autodoc with sphinx_toctree_autodoc_fix, https://gp-libs.git-pull.com/sphinx_toctree_autodoc_fix/ - Test documentation doctests (markdown) via pytest-doctest-docutils https://gp-libs.git-pull.com/doctest/pytest.html
2 parents 39f53b8 + 207018d commit 3de3cc1

File tree

16 files changed

+56
-213
lines changed

16 files changed

+56
-213
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
6969
ls $HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin
7070
tmux -V
71+
sudo apt install cowsay
7172
poetry run py.test --cov=./ --cov-append --cov-report=xml
7273
env:
7374
COV_CORE_SOURCE: .

CHANGES

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@ $ pip install --user --upgrade --pre libtmux
2929
- Add [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) (#408)
3030
- Add [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) (#409)
3131

32+
### Tests
33+
34+
- Test doctests in documentation via
35+
[pytest-doctest-docutils](https://gp-libs.git-pull.com/doctest/pytest.html) (#410)
36+
3237
### Documentation
3338

3439
- Move to sphinx-autoissues, #406
3540
- Examples updated for correctness, #412 (cherry-picked from #410)
41+
- Render changelog in [linkify_issues](https://gp-libs.git-pull.com/linkify_issues/) (#410)
42+
- Fix Table of contents rendering with sphinx autodoc with
43+
[sphinx_toctree_autodoc_fix](https://gp-libs.git-pull.com/sphinx_toctree_autodoc_fix/) (#410)
3644

3745
## libtmux 0.14.2 (2022-08-17)
3846

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
PY_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]py$$' 2> /dev/null
2+
DOC_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]rst\$\|.*[.]md\$\|.*[.]css\$\|.*[.]py\$\|mkdocs\.yml\|CHANGES\|TODO\|.*conf\.py' 2> /dev/null
3+
ALL_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]py\$\|.*[.]rst\$\|.*[.]md\$\|.*[.]css\$\|.*[.]py\$\|mkdocs\.yml\|CHANGES\|TODO\|.*conf\.py' 2> /dev/null
24

35

46
entr_warn:
@@ -22,7 +24,7 @@ start:
2224
$(MAKE) test; poetry run ptw .
2325

2426
watch_test:
25-
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
27+
if command -v entr > /dev/null; then ${ALL_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi
2628

2729
build_docs:
2830
$(MAKE) -C docs html

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,18 @@ Grab the output of pane:
157157
```python
158158
>>> pane.clear() # clear the pane
159159
>>> pane.send_keys("cowsay 'hello'", enter=True)
160-
>>> import time; time.sleep(1)
161-
>>> print('\n'.join(pane.cmd('capture-pane', '-p').stdout))
162-
```
163-
164-
sh-3.2$ cowsay 'hello'
165-
_______
166-
< hello >
167-
-------
168-
\ ^__^
169-
\ (oo)\_______
170-
(__)\ )\/\
171-
||----w |
172-
|| ||
160+
>>> print('\n'.join(pane.cmd('capture-pane', '-p').stdout)) # doctest: +SKIP
161+
$ cowsay 'hello'
162+
_______
163+
< hello >
164+
-------
165+
\ ^__^
166+
\ (oo)\_______
167+
(__)\ )\/\
168+
||----w |
169+
|| ||
170+
...
171+
```
173172

174173
Traverse and navigate:
175174

docs/conf.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@
2222

2323
extensions = [
2424
"sphinx.ext.autodoc",
25-
"autoapi.extension",
2625
"sphinx.ext.intersphinx",
2726
"sphinx_autodoc_typehints",
2827
"sphinx.ext.todo",
2928
"sphinx.ext.linkcode",
3029
"sphinx.ext.napoleon",
31-
"sphinx_autoissues",
3230
"sphinx_click.ext", # sphinx-click
3331
"sphinx_inline_tabs",
3432
"sphinx_copybutton",
3533
"sphinxext.opengraph",
3634
"sphinxext.rediraffe",
3735
"myst_parser",
36+
"linkify_issues",
37+
"sphinx_toctree_autodoc_fix",
3838
]
3939

4040
myst_enable_extensions = [
@@ -94,21 +94,14 @@
9494
]
9595
}
9696

97-
# sphinx-autoissues
98-
issuetracker = "github"
99-
issuetracker_project = about["__github__"].replace("https://github.com/", "")
97+
# linkify_issues
98+
issue_url_tpl = f'{about["__github__"]}/issues/{{issue_id}}'
10099

101100
# sphinx.ext.autodoc
102101
autoclass_content = "both"
103102
autodoc_member_order = "bysource"
104103
autosummary_generate = True
105104

106-
# sphinx-autoapi
107-
autoapi_type = "python"
108-
autoapi_dirs = [project_root / "libtmux"]
109-
autoapi_generate_api_docs = False # when fales, use directives
110-
suppress_warnings = ["autoapi.python_import_resolution", "autoapi.not_readable"]
111-
112105
# sphinx-copybutton
113106
copybutton_prompt_text = (
114107
r">>> |\.\.\. |> |\$ |\# | In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "

docs/internals/test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Test helpers
22

33
```{eval-rst}
4-
.. autoapimodule:: libtmux.test
4+
.. automodule:: libtmux.test
55
:members:
66
```

docs/pytest-plugin.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ object lookups in the test grid.
8787
## API reference
8888

8989
```{eval-rst}
90-
.. autoapimodule:: libtmux.pytest_plugin
90+
.. automodule:: libtmux.pytest_plugin
9191
:members:
9292
:inherited-members:
9393
:private-members:
9494
:show-inheritance:
9595
:member-order: bysource
96-
:exclude-members: Server, TEST_SESSION_PREFIX, get_test_session_name,
97-
namer, logger
9896
```

docs/reference/common.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Utilities
22

33
```{eval-rst}
4-
.. autoapimodule:: libtmux.common
4+
.. automodule:: libtmux.common
55
:members:
66
```

docs/reference/exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Exceptions
22

33
```{eval-rst}
4-
.. autoapimodule:: libtmux.exc
4+
.. automodule:: libtmux.exc
55
:members:
66
```

docs/reference/panes.md

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

1212
```{eval-rst}
13-
.. autoapiclass:: libtmux.Pane
13+
.. autoclass:: libtmux.Pane
1414
:members:
1515
:inherited-members:
1616
:private-members:

docs/reference/servers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
tmux initializes a server on automatically on first running (e.g. executing `tmux`)
1111

1212
```{eval-rst}
13-
.. autoapiclass:: libtmux.Server
13+
.. autoclass:: libtmux.Server
1414
:members:
1515
:inherited-members:
1616
:private-members:

docs/reference/sessions.md

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

99
```{eval-rst}
10-
.. autoapiclass:: libtmux.Session
10+
.. autoclass:: libtmux.Session
1111
:members:
1212
:inherited-members:
1313
:private-members:

docs/reference/windows.md

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

1313
```{eval-rst}
14-
.. autoapiclass:: Window
14+
.. autoclass:: Window
1515
:members:
1616
:inherited-members:
1717
:private-members:

0 commit comments

Comments
 (0)