Skip to content

Commit

Permalink
add command for pinning requirements, move to top-level
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Oct 14, 2023
1 parent 903f03a commit c94e2d7
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 24 deletions.
1 change: 1 addition & 0 deletions dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
36 changes: 36 additions & 0 deletions devscripts/commands/pin_requirements.py
Original file line number Diff line number Diff line change
@@ -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
# <http://www.gnu.org/licenses/>.

"""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)
2 changes: 1 addition & 1 deletion docs/source/quickstart_from_source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions docs/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
==============
Expand Down
34 changes: 17 additions & 17 deletions requirements/requirements-pinned.txt → requirements-pinned.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c94e2d7

Please sign in to comment.