一个用于从 requirement.txt 生成 rst/markdown 以显示 Python 包依赖项的 Sphinx 扩展
项目描述
sphinxcontrib-requirements-txt
一个用于从 requirement.txt
生成 rst/markdown 以显示 Python 包依赖项的 Sphinx 扩展。
使用方法
以 MyST 为例。rst 类似。
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.cn/title/Namcap>.
git+git://gitlab.archlinux.org/pacman/namcap
docs/conf.py
:
# ...
extensions = [
"myst_parser",
"sphinxcontrib.requirements_txt",
]
# ...
docs/index.md
:
```{requirements} ../requirements.txt
```
然后
cd docs && sphinx-build . _build/html
cd -
xdg-open docs/_build/html/index.html
生成的 markdown 将被插入并渲染。您可以看到
自定义
```{requirements} /the/path/of/requirements.txt
---
title: Dependence
template: /the/path/of/template.j2
---
```
/the/path/of/requirements.txt
可以是一个 glob 表达式。title
可以包含{title}
,它将被转换为 requirement 文件的基本名称。例如,requirements/dev.txt
将转换为dev
。template
是一个 jinja2 文件。参见 jinja2 语法 和 示例。
替代方案
项目详情
关闭
sphinxcontrib-requirements-txt-0.0.4.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 5375fc48c5b0c6ce0ef232e599ca509ffb986e1ed12269460511eeaeaaeda1e6 |
|
MD5 | b6b38db226bd3009cb4ccbd6db7ae5e7 |
|
BLAKE2b-256 | 150986a2e5de277b58d56e379600f21034fab5fc8df1c29e1f60c82041dce8e2 |
关闭
sphinxcontrib_requirements_txt-0.0.4-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b312e6ff740407c67b8d79d2b5dcbd8c9109d882bff1cb040e5f585303efd431 |
|
MD5 | cffbd8def186d0496a3e3af73348ca2e |
|
BLAKE2b-256 | caaee795d7562c7514bf1139debba320dc2d6bafea90c132c2665e9dec87f209 |