weblate/scripts/show-extras
Michal Čihař d7ca751138 chore: drop third-party dependency on tomli
Since Python 3.11 tomllib is included.
2024-09-26 09:52:47 +02:00

36 lines
774 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 tomllib
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 = tomllib.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}>`_
-
"""
)