Sphinx extensions and pytest plugins shared across git-pull's projects, developed by dogfooding them on cihai, vcs-python, and tmux-python.
Two components:
-
doctest_docutilsmodule: Same specification asdoctest, but can parse reStructuredText and markdown -
pytest_doctest_docutils: Pytest plugin, collects test items for pytest for reStructuredText and markdown filesThis means you can do:
$ pytest docs
This extends standard library doctest to support anything docutils can parse.
It can parse reStructuredText (.rst) and markdown (.md).
See more: https://gp-libs.git-pull.com/modules/doctest_docutils/
It supports two barebones directives:
-
docutils'
doctest_block>>> 2 + 2 4
-
.. doctest::directivereStructuredText:
.. doctest:: >>> 2 + 2 4
Markdown:
```{doctest} >>> 2 + 2 4 ```
The doctest_docutils module preserves standard library's usage conventions:
$ python -m doctest_docutils README.rst -vThat's what doctest does by design.
Markdown files run through myst-parser, which is installed with gp-libs.
$ python -m doctest_docutils README.md -vThis plugin blocks pytest's standard doctest plugin.
This plugin integrates doctest_docutils with pytest so documentation examples
run with the surrounding conftest.py setup.
$ pytest docs/Like the above module, it supports docutils' own doctest_block and a basic
.. doctest:: directive.
See more: https://gp-libs.git-pull.com/modules/pytest_doctest_docutils/
linkify_issues turns a plain-text issue reference, e.g. #99999, into a link
to the project tracker at https://github.com/git-pull/gp-libs/issues/99999.
The source text stays plain, so it still reads correctly wherever it is
rendered unprocessed, including GitHub and GitLab.
In your conf.py:
-
Add
'linkify_issues'toextensionsextensions = [ # ... "linkify_issues", ]
-
Configure your issue URL,
issue_url_tpl:# linkify_issues issue_url_tpl = "https://github.com/git-pull/gp-libs/issues/{issue_id}"
The config variable is formatted via
str.format()whereissue_idis42if the text is #42.
See more: https://gp-libs.git-pull.com/modules/linkify_issues/
$ pip install --user gp-libsYou can test the unpublished version of gp-libs before it's released.
-
pip:
$ pip install --user --upgrade --pre gp-libs
To lift the development burden of supporting legacy APIs, as this package is
lightly used, a minimum constraint is pinned in pyproject.toml:
- docutils: 0.20+
myst-parser has no minimum version pinned. If you have a passing interest in
supporting legacy versions, file an issue on the tracker.
- Python support: >= 3.10
- Source: https://github.com/git-pull/gp-libs
- Docs: https://gp-libs.git-pull.com
- Changelog: https://gp-libs.git-pull.com/history.html
- Issues: https://github.com/git-pull/gp-libs/issues
- Test Coverage: https://codecov.io/gh/git-pull/gp-libs
- pypi: https://pypi.python.org/pypi/gp-libs
- License: MIT.