A sphinx extension to generate a rst/markdown to display the dependencies of a python package from requirement.txt
Project description
sphinxcontrib-requirements-txt
A sphinx extension to generate a rst/markdown to display the dependencies of
a python package from requirement.txt
.
Usage
Take MyST as an example. rst is similar.
requirement.txt
:
# To complete package names, a cache is needed.
# Every time you change template, the cache must be regenerated.
#
# ```shell
# $ pkgbuild-language-server --print-config cache
# /home/wzy/.cache/pacman.json
# ```
pyalpm
# See <https://wiki.archlinux.org/title/Namcap>.
git+git://gitlab.archlinux.org/pacman/namcap
docs/conf.py
:
# ...
extensions = [
"myst_parser",
"sphinxcontrib.requirements_txt",
]
# ...
docs/index.md
:
```{requirements} ../requirements.txt
```
Then:
cd docs && sphinx-build . _build/html
cd -
xdg-open docs/_build/html/index.html
A generated markdown will be inserted and rendered. You see:
Customize
```{requirements} /the/path/of/requirements.txt
---
title: Dependence
template: /the/path/of/template.j2
---
```
title
can contains {title}
, which will be converted to the base name of
requirement file. Such as requirements/dev.txt
will be converted to dev
.
template
is a jinja2 file. See jinja2 syntax
and
examples.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for sphinxcontrib-requirements-txt-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98a159c3cffd67a7cf3d163b8524d9ba5fb3b3af55ea83fc72810a9994e7cca6 |
|
MD5 | ddbabcc17c6d3345bfccadf0d6f884b9 |
|
BLAKE2b-256 | 60a857be0b2684e33bff51b4cf0a5116f50805199f32dd68fa2d41af15054b01 |
Close
Hashes for sphinxcontrib_requirements_txt-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 998f5a5ae2c537c8730812fb434d4e3aa16aba0ab8b7977da7a9c8040f943ee6 |
|
MD5 | 3a00df835e69544977ccc9a342a3094e |
|
BLAKE2b-256 | 20e76e48e6d018f62f2d4cca8b30dd00428974b0144d5ad0fc65d45f242374ed |