Skip to content

Commit

Permalink
HP-1842 Update python-jose to version 3.3.0
Browse files Browse the repository at this point in the history
Move python-jose dependency to requirements.in, as it's not just a
development dependency. It's needed by the actual server too; via
django-helusers, but still.

Use the `cryptography` backend with python-jose, which is the
recommended choice. Python-jose depends on `ecdsa`, `pyasn1` and `rsa`
packages, but it doesn't need them when the `cryptography` backend is
used. Those packages are excluded from the requirements.txt file by
using --unsafe-package arguments with pip-compile. This works for now,
since python-jose is the ONLY package that depends on those packages. If
any other package update needs any of those other dependencies, then
they need to be allwed again. There is a proposal to pip-tools [1] to
provide a better tool for this kind of use case, but it hasn't been
accepted.

In order to not get those unnecessary dependencies installed anyways,
the --no-deps argument needs to be given to `pip`. This was added to
Dockerfile.

[1] jazzband/pip-tools#1645
  • Loading branch information
akikoskinen committed Apr 11, 2023
1 parent 9a9462f commit b2a02af
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-install.sh \
python3-gdal \
postgresql-client \
&& pip install -U pip \
&& pip install --no-cache-dir -r /app/requirements.txt \
&& pip install --no-cache-dir --no-deps -r /app/requirements.txt \
&& pip install --no-cache-dir -r /app/requirements-prod.txt \
&& apt-cleanup.sh build-essential pkg-config

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pytest
pytest-cov
pytest-django
pytest-mock
python-jose
requests-mock
pytest-factoryboy
rope
Expand Down
22 changes: 0 additions & 22 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ decorator==4.4.2
# traitlets
distlib==0.3.0
# via virtualenv
ecdsa==0.16.1
# via
# -c requirements.txt
# python-jose
entrypoints==0.3
# via flake8
exceptiongroup==1.0.4
Expand All @@ -68,10 +64,6 @@ flake8-polyfill==1.0.2
# via pep8-naming
freezegun==0.3.15
# via -r requirements-dev.in
future==0.17.1
# via
# -c requirements.txt
# python-jose
identify==1.4.15
# via pre-commit
idna==2.9
Expand Down Expand Up @@ -140,10 +132,6 @@ prompt-toolkit==3.0.5
# via ipython
ptyprocess==0.6.0
# via pexpect
pyasn1==0.4.5
# via
# -c requirements.txt
# rsa
pycodestyle==2.5.0
# via
# autopep8
Expand Down Expand Up @@ -177,10 +165,6 @@ python-dateutil==2.8.1
# via
# faker
# freezegun
python-jose==3.0.1
# via
# -c requirements.txt
# -r requirements-dev.in
pyyaml==5.4.1
# via
# -c requirements.txt
Expand All @@ -193,17 +177,11 @@ requests-mock==1.8.0
# via -r requirements-dev.in
rope==0.16.0
# via -r requirements-dev.in
rsa==4.7.2
# via
# -c requirements.txt
# python-jose
six==1.14.0
# via
# -c requirements.txt
# ecdsa
# freezegun
# python-dateutil
# python-jose
# requests-mock
# snapshottest
# traitlets
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ graphene-federation
git+https://github.com/City-of-Helsinki/graphene-validator.git@main
iso3166
psycopg2
python-jose[cryptography]
pyyaml>=5.3
requests
requests-oauthlib
Expand Down
28 changes: 16 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.7
# by the following command:
#
# pip-compile requirements.in
# pip-compile --unsafe-package=ecdsa --unsafe-package=pyasn1 --unsafe-package=rsa requirements.in
#
--no-binary psycopg2

Expand All @@ -16,8 +16,12 @@ certifi==2020.4.5.1
# via
# requests
# sentry-sdk
cffi==1.15.1
# via cryptography
chardet==3.0.4
# via requests
cryptography==40.0.1
# via python-jose
database-sanitizer==1.1.0
# via django-sanitized-dump
deprecation==2.1.0
Expand Down Expand Up @@ -53,10 +57,6 @@ django-sanitized-dump==1.2.1
# via -r requirements.in
django-searchable-encrypted-fields==0.1.3
# via -r requirements.in
ecdsa==0.16.1
# via python-jose
future==0.17.1
# via python-jose
graphene==2.1.8
# via
# graphene-django
Expand Down Expand Up @@ -90,12 +90,14 @@ promise==2.2.1
# graphql-relay
psycopg2==2.8.3
# via -r requirements.in
pyasn1==0.4.5
# via rsa
pycparser==2.21
# via cffi
pycryptodome==3.15.0
# via django-searchable-encrypted-fields
python-jose==3.0.1
# via django-helusers
python-jose[cryptography]==3.3.0
# via
# -r requirements.in
# django-helusers
pytz==2019.1
# via django
pyyaml==5.4.1
Expand All @@ -110,8 +112,6 @@ requests==2.25.1
# requests-oauthlib
requests-oauthlib==1.3.0
# via -r requirements.in
rsa==4.7.2
# via python-jose
rx==1.6.1
# via graphql-core
sentry-sdk==0.10.2
Expand All @@ -128,7 +128,6 @@ six==1.14.0
# graphql-core
# graphql-relay
# promise
# python-jose
# singledispatch
sqlparse==0.4.2
# via django
Expand All @@ -138,3 +137,8 @@ urllib3==1.26.6
# via
# requests
# sentry-sdk

# The following packages are considered to be unsafe in a requirements file:
# ecdsa
# pyasn1
# rsa

0 comments on commit b2a02af

Please sign in to comment.