diff --git a/dev.py b/dev.py index 1cd0d4190..93731766b 100755 --- a/dev.py +++ b/dev.py @@ -28,6 +28,7 @@ add_command(commands, "code-quality") add_command(commands, "docker-test") add_command(commands, "init-demo") +add_command(commands, "pin-requirements") add_command(commands, "recreate-fixtures") add_command(commands, "release") add_command(commands, "update-ca-data") diff --git a/devscripts/commands/pin_requirements.py b/devscripts/commands/pin_requirements.py new file mode 100644 index 000000000..8d36160e8 --- /dev/null +++ b/devscripts/commands/pin_requirements.py @@ -0,0 +1,36 @@ +# This file is part of django-ca (https://github.com/mathiasertl/django-ca). +# +# django-ca is free software: you can redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# django-ca is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along with django-ca. If not, see +# . + +"""Command to create requirements-pinned.txt.""" + +import argparse +import os +import tempfile + +from devscripts.commands import DevCommand +from devscripts.utils import run + + +class Command(DevCommand): + """Class implementing the ``dev.py pin-requirements`` command.""" + + help_text = "Update requirements-pinned.txt." + + def handle(self, args: argparse.Namespace) -> None: + with tempfile.TemporaryDirectory() as tmpdir: + run(["python", "-m", "venv", tmpdir]) + pip = os.path.join(tmpdir, "bin", "pip") + run([pip, "install", "-U", "pip", "setuptools", "wheel"]) + run([pip, "install", "-e", ".[api,celery,redis,psycopg3,yaml]"]) + with open("requirements-pinned.txt", "wb") as stream: + run([pip, "freeze", "--exclude-editable"], stdout=stream) diff --git a/docs/source/quickstart_from_source.rst b/docs/source/quickstart_from_source.rst index 825963bfa..911e63c0a 100644 --- a/docs/source/quickstart_from_source.rst +++ b/docs/source/quickstart_from_source.rst @@ -99,7 +99,7 @@ last command with: .. code-block:: console root@host:~# /opt/django-ca/venv/bin/pip install -U \ - > -r /opt/django-ca/src/django-ca/requirements/requirements-pinned.txt \ + > -r /opt/django-ca/src/django-ca/requirements-pinned.txt \ > -e /opt/django-ca/src/django-ca Both commands will install PostgreSQL support, but *not* install MySQL support. If you want to use MySQL, diff --git a/docs/source/release.rst b/docs/source/release.rst index 23788e529..ddff12d87 100644 --- a/docs/source/release.rst +++ b/docs/source/release.rst @@ -23,13 +23,9 @@ Run these steps when you begin to create a new release: Pin requirements ================ -Create a file with pinned requirements, so that users can reliably reproduce a -setup:: +Create a file with pinned requirements, so that users can reliably reproduce a setup:: - $ python -m venv venv - $ venv/bin/pip install -U pip setuptools wheel - $ venv/bin/pip install -e .[api,celery,redis,psycopg3,yaml] - $ venv/bin/pip freeze | grep -v django-ca > requirements/requirements-pinned.txt + $ ./dev.py pin-requirements docker-compose ============== diff --git a/requirements/requirements-pinned.txt b/requirements-pinned.txt similarity index 60% rename from requirements/requirements-pinned.txt rename to requirements-pinned.txt index e3ec32080..a85dfc95b 100644 --- a/requirements/requirements-pinned.txt +++ b/requirements-pinned.txt @@ -1,44 +1,44 @@ -acme==2.6.0 +acme==2.7.1 amqp==5.1.1 asgiref==3.7.2 asn1crypto==1.5.1 async-timeout==4.0.3 billiard==4.1.0 -celery==5.3.1 +celery==5.3.4 certifi==2023.7.22 -cffi==1.15.1 -charset-normalizer==3.2.0 +cffi==1.16.0 +charset-normalizer==3.3.0 click==8.1.7 click-didyoumean==0.3.0 click-plugins==1.1.1 click-repl==0.3.0 cryptography==41.0.4 -Django==4.2.4 +Django==4.2.6 django-ninja==0.22.2 -django-object-actions==4.1.0 +django-object-actions==4.2.0 dnspython==2.4.2 hiredis==2.2.3 idna==3.4 josepy==1.13.0 -kombu==5.3.1 -packaging==23.1 +kombu==5.3.2 +packaging==23.2 prompt-toolkit==3.0.39 -psycopg==3.1.10 -psycopg-c==3.1.10 -psycopg-pool==3.1.7 +psycopg==3.1.12 +psycopg-c==3.1.12 +psycopg-pool==3.1.8 pycparser==2.21 -pydantic==1.10.12 +pydantic==1.10.13 pyOpenSSL==23.2.0 pyRFC3339==1.1 python-dateutil==2.8.2 -pytz==2023.3 +pytz==2023.3.post1 PyYAML==6.0.1 -redis==5.0.0 +redis==5.0.1 requests==2.31.0 six==1.16.0 sqlparse==0.4.4 -typing_extensions==4.7.1 +typing_extensions==4.8.0 tzdata==2023.3 -urllib3==2.0.4 +urllib3==2.0.6 vine==5.0.0 -wcwidth==0.2.6 +wcwidth==0.2.8