Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #221

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
43389ca
WIP: updating dependencies
Filienko Jul 24, 2024
5b36cdc
Updating to version 3.9
Filienko Jul 28, 2024
fadf536
Adding flask_oidc
Filienko Jul 28, 2024
566e548
Changing requirements
Filienko Jul 28, 2024
20e1e1e
WIP: testing without libraries
Filienko Jul 28, 2024
e1983eb
Returning to working libraries
Filienko Jul 28, 2024
3147137
Updating requirements
Filienko Jul 28, 2024
95ff06b
Trying to replace flask safe_join with werkzeug
Filienko Jul 28, 2024
8b7c61d
Downgrading flask
Filienko Jul 28, 2024
dd69b36
Upgrading
Filienko Jul 28, 2024
8ee3560
WIP: Changing safe_join
Filienko Jul 28, 2024
2d5e06a
Updating jwt
Filienko Jul 28, 2024
053229c
Downgrade flask
Filienko Jul 28, 2024
f209a24
Downgrading flask
Filienko Jul 28, 2024
1498ab8
Downgrading flask
Filienko Jul 28, 2024
126dc1f
Downgrading pluggy
Filienko Jul 28, 2024
d05b697
Downgrading pytest
Filienko Jul 28, 2024
bc10861
Downgrading werkzeug
Filienko Jul 28, 2024
5df077a
Downgrading itsdangerous
Filienko Jul 28, 2024
43d091c
Downgrading jwt
Filienko Jul 28, 2024
85d341e
Adding six
Filienko Jul 28, 2024
ce34150
Cleaning up dev requirements.
Filienko Jul 28, 2024
f25d7a8
WIP: updating python to 3.11
Filienko Aug 1, 2024
783223c
Updating python version in the readme to correspond to one in the docker
Filienko Aug 7, 2024
b73dfdb
Updating JSONEncoder to import from json
Filienko Aug 7, 2024
a7ea132
Switching to DefaultJSONProvider
Filienko Aug 21, 2024
cbec5b5
from safe_join to werkzeug.utils
Filienko Aug 21, 2024
b5f9ee7
Adding flask-oidc back
Filienko Aug 21, 2024
7b8e4ef
Changing flask-oidc to not use depreciated itsdangerous
Filienko Aug 21, 2024
048af5f
Fixing tests
Filienko Aug 21, 2024
c2cabde
Adding pytest-datadir
Filienko Aug 21, 2024
97d0637
Returning to working flask-oidc declaration
Filienko Aug 21, 2024
dbe4587
Updating to latest versions
Filienko Aug 21, 2024
e70af92
Updating flask
Filienko Aug 21, 2024
29deee0
Add back in fhir-migrations (accidental omission from rebasing)
pbugni Dec 5, 2024
870c7f3
Correct OIDC config to fit upgraded version (2.2.2)
pbugni Dec 5, 2024
ebf93c9
Found functional, supported version of flask-oidc
pbugni Dec 5, 2024
419993e
Additional duplication found in requirements.dev.txt
pbugni Dec 5, 2024
0a858a9
flask upgrade requires name change of send_from_directory() parameter…
pbugni Dec 6, 2024
fa47c2e
add missing `flask-oidc` dependency to setup.cfg
pbugni Dec 9, 2024
ef1e992
return to using `pip-compile` for full generation of `requirements.de…
pbugni Dec 9, 2024
6d05174
DO NOT KEEP this commit - fighting with dev env that won't reload
Dec 9, 2024
ebad9fa
Revert "DO NOT KEEP this commit - fighting with dev env that won't re…
Dec 9, 2024
7d56491
with Flask upgrade, overloading DefaultJSONProvider.default no longer
Dec 10, 2024
a78ea2f
whitespace error
Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.11

- name: Install Python linting dependencies
run: pip install black flake8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
- name: Checkout git commit
uses: actions/checkout@v1

- name: Set up Python 3.7
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.11

- name: Install test runner
run: python3 -m pip install tox
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY . .
RUN npm run build

# -----------------------------------------------------------------------------
FROM python:3.7 as backend
FROM python:3.11 as backend

RUN mkdir /opt/cosri-patientsearch
WORKDIR /opt/cosri-patientsearch
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ All views require Keycloak authentication. Keycloak roles determine authorizati
1) `git clone <this repository>`
2) `cp client_secrets.json.default client_secrets.json` # Edit to fit
3) `cp patientsearch.env.default patientsearch.env` # Edit to fit
4) `mkvirtualenv patientsearch` # Python 3.7
4) `mkvirtualenv patientsearch` # Python 3.11
5) `pip install nodeenv`
6) `nodeenv --python-virtualenv`
7) `pip install -e .`
Expand Down
8 changes: 4 additions & 4 deletions patientsearch/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
make_response,
redirect,
request,
safe_join,
session,
send_from_directory,
)
from flask.json import JSONEncoder
from flask.json.provider import DefaultJSONProvider
import jwt
import requests
from werkzeug.exceptions import Unauthorized, Forbidden
from werkzeug.utils import safe_join
from copy import deepcopy

from patientsearch.audit import audit_entry, audit_HAPI_change
Expand Down Expand Up @@ -145,11 +145,11 @@ def config_settings(config_key):
"""Non-secret application settings"""

# workaround no JSON representation for datetime.timedelta
class CustomJSONEncoder(JSONEncoder):
class CustomJSONProvider(DefaultJSONProvider):
def default(self, obj):
return str(obj)

current_app.json_encoder = CustomJSONEncoder
current_app.json = CustomJSONProvider

# return selective keys - not all can be be viewed by users, e.g.secret key
blacklist = ("SECRET", "KEY", "TOKEN", "CREDENTIALS")
Expand Down
3 changes: 1 addition & 2 deletions patientsearch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ def load_json_config(potential_json_string):
)

OIDC_ID_TOKEN_COOKIE_SECURE = False
OIDC_REQUIRE_VERIFIED_EMAIL = False
OIDC_SCOPES = ["email", "openid", "roles"]
OIDC_SCOPES = "email openid roles"
PROJECT_NAME = os.getenv("PROJECT_NAME", "COSRI")
REQUIRED_ROLES = json.loads(os.getenv("REQUIRED_ROLES", "[]"))
UDS_LAB_TYPES = json.loads(os.getenv("UDS_LAB_TYPES", "[]"))
Expand Down
43 changes: 24 additions & 19 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
-r requirements.txt
pbugni marked this conversation as resolved.
Show resolved Hide resolved
#
# This file is autogenerated by pip-compile
# To update, run:
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile
# pip-compile --extra=dev --output-file=requirements.dev.txt setup.cfg
#
--requirement requirements.txt

attrs==21.2.0 # via pytest
importlib-metadata==4.8.1 # via pluggy, pytest
iniconfig==1.1.1 # via pytest
packaging==21.0 # via pytest
pluggy==1.0.0 # via pytest
py==1.10.0 # via pytest
pyparsing==2.4.7 # via packaging
pytest-datadir==1.3.1 # via patientsearch (setup.py)
pytest-flask==1.2.0 # via patientsearch (setup.py)
pytest-mock==3.6.1 # via patientsearch (setup.py)
pytest==6.2.5 # via patientsearch (setup.py), pytest-datadir, pytest-mock
toml==0.10.2 # via pytest
typing-extensions==3.10.0.2 # via importlib-metadata
zipp==3.5.0 # via importlib-metadata
exceptiongroup==1.2.2
# via pytest
iniconfig==2.0.0
# via pytest
pluggy==1.5.0
# via pytest
pytest==8.3.2
# via
# patientsearch (setup.cfg)
# pytest-datadir
# pytest-flask
# pytest-mock
pytest-datadir==1.5.0
# via patientsearch (setup.cfg)
pytest-flask==1.3.0
# via patientsearch (setup.cfg)
pytest-mock==3.14.0
# via patientsearch (setup.cfg)
tomli==2.0.1
# via pytest
93 changes: 68 additions & 25 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,69 @@
certifi==2021.5.30 # via requests
charset-normalizer==2.0.6 # via requests
click==8.0.1 # via flask
flask-jwt-extended==3.24.1 # via patientsearch (setup.py)
# pin to last hash of master, to remove requirement of freestanding JSON config file
git+https://github.com/uwcirg/flask-oidc.git@ed4eb20#egg=flask-oidc
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile
#
async-timeout==4.0.3
# via redis
blinker==1.8.2
# via flask
cachelib==0.13.0
# via flask-session
certifi==2024.7.4
# via requests
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via flask
flask==3.0.3
# via
pbugni marked this conversation as resolved.
Show resolved Hide resolved
# flask-jwt-extended
# flask-session
# patientsearch (setup.cfg)
flask-jwt-extended==4.6.0
# via patientsearch (setup.cfg)
flask-session==0.8.0
# via patientsearch (setup.cfg)
flask-oidc==2.2.2
git+https://github.com/uwcirg/[email protected]
ivan-c marked this conversation as resolved.
Show resolved Hide resolved
flask==2.0.1 # via flask-jwt-extended, patientsearch (setup.py)
flask-session==0.3.2 # via patientsearch (setup.py)
gunicorn==20.0.4 # via patientsearch (setup.py)
idna==3.2 # via requests
importlib-metadata==4.8.1 # via click
itsdangerous==2.0.1 # via flask
jinja2==3.0.1 # via flask
jmespath==0.10.0 # via patientsearch (setup.py)
markupsafe==2.0.1 # via jinja2
python-json-logger==0.1.11
pyjwt==1.7.1 # via flask-jwt-extended
redis==3.5.3
redis-dict==1.5.2 # via patientsearch (setup.py)
requests==2.26.0 # via patientsearch (setup.py)
six==1.15.0 # via flask-jwt-extended
typing-extensions==3.10.0.2 # via importlib-metadata
urllib3==1.26.7 # via requests
werkzeug==2.0.1 # via flask, flask-jwt-extended
zipp==3.5.0 # via importlib-metadata
gunicorn==23.0.0
# via patientsearch (setup.cfg)
idna==3.7
# via requests
importlib-metadata==8.4.0
# via flask
itsdangerous==2.2.0
# via flask
jinja2==3.1.4
# via flask
jmespath==1.0.1
# via patientsearch (setup.cfg)
markupsafe==2.1.5
# via
# jinja2
# werkzeug
msgspec==0.18.6
# via flask-session
packaging==24.1
# via gunicorn
pyjwt==2.9.0
# via flask-jwt-extended
python-json-logger==2.0.7
# via patientsearch (setup.cfg)
redis==5.0.8
# via
# patientsearch (setup.cfg)
# redis-dict
redis-dict==2.5.0
# via patientsearch (setup.cfg)
requests==2.32.3
# via patientsearch (setup.cfg)
urllib3==2.2.2
# via requests
werkzeug==3.0.3
# via
# flask
# flask-jwt-extended
zipp==3.20.0
# via importlib-metadata
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def generate_claims(email, sub, roles):
def generate_jwt(email="[email protected]", sub="fake-subject", roles=None):
claims = generate_claims(email, sub, roles)
encoded = jwt.encode(claims, SECRET, algorithm="HS256")
return encoded.decode("utf-8")
return encoded


@pytest.fixture()
Expand Down
Loading