Skip to main content

A sphinx extension to generate a rst/markdown to display the dependencies of a python package from requirement.txt

Project description

sphinxcontrib-requirements-txt

readthedocs pre-commit.ci status github/workflow codecov

github/downloads github/downloads/latest github/issues github/issues-closed github/issues-pr github/issues-pr-closed github/discussions github/milestones github/forks github/stars github/watchers github/contributors github/commit-activity github/last-commit github/release-date

github/license github/languages github/languages/top github/directory-file-count github/code-size github/repo-size github/v

pypi/status pypi/v pypi/downloads pypi/format pypi/implementation pypi/pyversions

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:

screenshot

Customize

```{requirements} /the/path/of/requirements.txt
---
title: Dependence
template: /the/path/of/template.j2
---
```
  • /the/path/of/requirements.txt can be a glob expression.
  • title can contain {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.

Alternatives

See readthedocs to know more.

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

sphinxcontrib-requirements-txt-0.0.4.tar.gz (25.6 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page