Skip to content

Commit

Permalink
docs: update list of optional deps
Browse files Browse the repository at this point in the history
- Fixed the generating script for pyproject.toml
- Add tomli to dev deps
- Update generated documentation
  • Loading branch information
nijel committed Apr 18, 2024
1 parent b4304b5 commit a02f67e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
45 changes: 25 additions & 20 deletions docs/admin/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,58 +186,63 @@ Django REST Framework
- Weblate feature


* - ``Amazon``
* - ``alibaba``
- `aliyun-python-sdk-alimt <https://pypi.org/project/aliyun-python-sdk-alimt>`_
- :ref:`mt-alibaba`

* - ``amazon``
- `boto3 <https://pypi.org/project/boto3>`_
- :ref:`mt-aws`


* - ``LDAP``
- `django-auth-ldap <https://pypi.org/project/django-auth-ldap>`_
- :ref:`ldap-auth`


* - ``zxcvbn``
- `django-zxcvbn-password <https://pypi.org/project/django-zxcvbn-password>`_
- :ref:`password-authentication`
* - ``antispam``
- `python-akismet <https://pypi.org/project/python-akismet>`_
- :ref:`spam-protection`


* - ``Gerrit``
* - ``gerrit``
- `git-review <https://pypi.org/project/git-review>`_
- :ref:`vcs-gerrit`


* - ``Google``
* - ``google``
- `google-cloud-translate <https://pypi.org/project/google-cloud-translate>`_
- :ref:`mt-google-translate-api-v3`


* - ``Mercurial``
* - ``ldap``
- `django-auth-ldap <https://pypi.org/project/django-auth-ldap>`_
- :ref:`ldap-auth`



* - ``mercurial``
- `mercurial <https://pypi.org/project/mercurial>`_
- :ref:`vcs-mercurial`


* - ``MySQL``
* - ``mysql``
- `mysqlclient <https://pypi.org/project/mysqlclient>`_
- MySQL or MariaDB, see :ref:`database-setup`

* - ``OpenAI``

* - ``openai``
- `openai <https://pypi.org/project/openai>`_
- :ref:`mt-openai`

* - ``Postgres``
* - ``postgres``
- `psycopg <https://pypi.org/project/psycopg>`_
- PostgreSQL, see :ref:`database-setup`


* - ``Antispam``
- `python-akismet <https://pypi.org/project/python-akismet>`_
- :ref:`spam-protection`


* - ``SAML``
* - ``saml``
- `python3-saml <https://pypi.org/project/python3-saml>`_
- :ref:`saml-auth`

* - ``zxcvbn``
- `django-zxcvbn-password <https://pypi.org/project/django-zxcvbn-password>`_
- :ref:`password-authentication`

When installing using pip, you can directly specify desired features when installing:

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ dev = [
"PyICU==2.12",
"reuse==3.0.2",
"scour==0.38.2",
"tinyunicodeblock==1.3"
"tinyunicodeblock==1.3",
"tomli"
]
gerrit = [
"git-review>=2.2.0,<2.5.0"
Expand Down
25 changes: 12 additions & 13 deletions scripts/show-extras
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import re

import tomli

print(
"""
.. Table is generated using scripts/show-extras
Expand All @@ -19,20 +21,17 @@ print(
"""
)

with open("requirements-optional.txt") as requirements:
section = None
for line in requirements:
line = line.strip()
if line.startswith("-r") or not line:
continue
if line.startswith("#"):
section = line[2:]
else:
dependency = re.split("[;<>=[]", line)[0].strip()
print(
f"""
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}>`_
-
"""
)
)

0 comments on commit a02f67e

Please sign in to comment.