weblate/scripts/show-extras
Michal Čihař a02f67e7bc docs: update list of optional deps
- Fixed the generating script for pyproject.toml
- Add tomli to dev deps
- Update generated documentation
2024-04-18 11:50:49 +02:00

37 lines
771 B
Python
Executable file

#!/usr/bin/env python
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
import re
import tomli
print(
"""
.. Table is generated using scripts/show-extras
.. list-table:: Optional dependencies
:header-rows: 1
* - pip extra
- Python Package
- Weblate feature
"""
)
with open("pyproject.toml", "rb") as handle:
toml_dict = tomli.load(handle)
for section, data in toml_dict["project"]["optional-dependencies"].items():
if section in {"all", "ci", "dev", "lint", "mypy", "test"}:
continue
dependency = re.split("[;<>=[]", data[0])[0].strip()
print(
f"""
* - ``{section}``
- `{dependency} <https://pypi.org/project/{dependency}>`_
-
"""
)