From d46f4e28ecbc27ef71d40dc006e282b1b751aee4 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 17:17:20 -0800 Subject: [PATCH 01/14] python 3.7 fell off EOL. upgrade to 3.11 --- Dockerfile | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7a55cd06..6fcf0dac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index a4800e43..c4622638 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ All views require Keycloak authentication. Keycloak roles determine authorizati 1) `git clone ` 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 .` From dda1580ee2376312baa701dc928709c39a18d170 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 17:22:36 -0800 Subject: [PATCH 02/14] python 3.7 fell off EOL cliff. upgrade to 3.11 --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index bff9e724..ad9495f5 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e8fc55c4..08ab91d0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 From 36eaa36fb76c2f466f8ef53abfcc65cf8c40fa49 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 17:43:08 -0800 Subject: [PATCH 03/14] Try direct dependency on version of setuptools that patches: DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated --- requirements.dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.dev.txt b/requirements.dev.txt index 86a576be..0559b904 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -17,6 +17,7 @@ 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 +setuptools>=58.2.0 toml==0.10.2 # via pytest typing-extensions==3.10.0.2 # via importlib-metadata zipp==3.5.0 # via importlib-metadata From b88c3d006667dab2dc539f84eb12376f1b357b40 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 18:17:18 -0800 Subject: [PATCH 04/14] Attempt conversion from `setup.py` to `pyproject.toml`. See PEP 518 --- pyproject.toml | 10 ++++++++++ setup.py | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..bf7251b4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "patientsearch" +version = "1.0" + +[tool.setuptools.packages.find] +include = ["patientsearch"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 307aa81d..00000000 --- a/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -from setuptools import setup - -setup( - name="patientsearch", - version="1.0", - packages=["patientsearch"], - include_package_data=True, -) From 82ed3dc8544493679393e95830b063e4b4ee3b39 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 18:19:01 -0800 Subject: [PATCH 05/14] revert failed attempt to pin version of setuptools --- requirements.dev.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 0559b904..86a576be 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -17,7 +17,6 @@ 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 -setuptools>=58.2.0 toml==0.10.2 # via pytest typing-extensions==3.10.0.2 # via importlib-metadata zipp==3.5.0 # via importlib-metadata From eb2a05d8e3e28c506e3bd812e3e596cc7d475c04 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 21:00:10 -0800 Subject: [PATCH 06/14] Attempt to replace `setup.py` and `setup.cfg` with `pyproject.toml` --- pyproject.toml | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bf7251b4..b8d98b9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,45 @@ [build-system] -requires = ["setuptools>=42", "wheel"] +requires = ["setuptools>=42", "wheel", "setuptools_scm"] build-backend = "setuptools.build_meta" [project] name = "patientsearch" -version = "1.0" +version = { attr = "setuptools_scm.get_version" } +dependencies = [ + "flask", + "flask-jwt-extended", + "flask-session", + "gunicorn", + "requests", + "redis", + "redis-dict", + "jmespath", + "python-json-logger", +] + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-flask", + "pytest-datadir", + "pytest-mock", +] [tool.setuptools.packages.find] include = ["patientsearch"] +zip-safe = false +include-package-data = true + +[tool.flake8] +max-line-length = 100 + +[tool.pytest.ini_options] +addopts = "--color yes --verbose" +console_output_style = "classic" +filterwarnings = [ + "module", # Only print each warning once per module + "ignore:^\"localhost\" is not a valid cookie domain, it must contain a.*:Warning", + "ignore::DeprecationWarning:dogpile", # Specific dependency warning + "ignore::DeprecationWarning:flask_user", # Specific dependency warning + "error:.*assertion is always true.*", # Error on bad assertions +] From df23235baec1dcb749611a90360dff88b769e2a7 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 21:12:25 -0800 Subject: [PATCH 07/14] Corrected syntax errors in pyproject.toml - building locally now. --- pyproject.toml | 8 +++----- setup.cfg | 55 -------------------------------------------------- 2 files changed, 3 insertions(+), 60 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index b8d98b9a..b4fc5bf7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "patientsearch" -version = { attr = "setuptools_scm.get_version" } +dynamic = ["version"] dependencies = [ "flask", "flask-jwt-extended", @@ -25,10 +25,8 @@ dev = [ "pytest-mock", ] -[tool.setuptools.packages.find] -include = ["patientsearch"] -zip-safe = false -include-package-data = true +[tool.setuptools] +packages = ["patientsearch"] [tool.flake8] max-line-length = 100 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4a717be5..00000000 --- a/setup.cfg +++ /dev/null @@ -1,55 +0,0 @@ -# pyup: ignore file -# setup.py configuration file -# https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files - -[metadata] -name = patientsearch -version = attr: setuptools_scm.get_version - -[options] -packages = patientsearch -zip_safe = False -include_package_data = True -setup_requires = - setuptools_scm - -# abstract requirements; -# concrete requirements belong in requirements.txt -# https://caremad.io/posts/2013/07/setup-vs-requirement/ -install_requires = - flask - flask-jwt-extended - flask-session - gunicorn - requests - redis - redis-dict - jmespath - python-json-logger - -[options.extras_require] -dev = - pytest - pytest-flask - pytest-datadir - pytest-mock - -[flake8] -max-line-length=100 - -[tool:pytest] -addopts = --color yes --verbose -console_output_style = classic -filterwarnings = - # only print each warning once per module - module - - # Ignore testing-specific warning - ignore:^"localhost" is not a valid cookie domain, it must contain a.*:Warning - - # Ignore warnings on specific dependencies (already reported upstream) - ignore::DeprecationWarning:dogpile - ignore::DeprecationWarning:flask_user - - # error on bad assertions - error:.*assertion is always true.* From 959d94021d3c5b88cb507b6d86d90093003b722a Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 21:21:41 -0800 Subject: [PATCH 08/14] flake8 apparently looks in `tox.ini` before `pyproject.toml` for max-line-length --- pyproject.toml | 3 --- tox.ini | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b4fc5bf7..9db5c12a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,9 +28,6 @@ dev = [ [tool.setuptools] packages = ["patientsearch"] -[tool.flake8] -max-line-length = 100 - [tool.pytest.ini_options] addopts = "--color yes --verbose" console_output_style = "classic" diff --git a/tox.ini b/tox.ini index 46c1ac79..59cc7f85 100644 --- a/tox.ini +++ b/tox.ini @@ -21,3 +21,6 @@ commands = --cov patientsearch \ --cov-report xml:"{toxinidir}/coverage.xml" \ [] + +[flake8] +max-line-length = 100 From 4a686a397b39cf2e6419d9f3486fa3b71fb53715 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 21:32:38 -0800 Subject: [PATCH 09/14] Try naming python version for tox dependency problems --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 59cc7f85..f555a8b7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3 +envlist = py311 skipdist = True [testenv] From 6ea149305f8338bd58cba95f930b841d78b8c71c Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Mon, 13 Jan 2025 21:42:20 -0800 Subject: [PATCH 10/14] Trying python 3.10 given https://github.com/pytest-dev/py/issues/273 --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- Dockerfile | 2 +- README.md | 2 +- tox.ini | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ad9495f5..45a5a24e 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -37,7 +37,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.11 + python-version: 3.10 - name: Install Python linting dependencies run: pip install black flake8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 08ab91d0..95babe6d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,10 +9,10 @@ jobs: - name: Checkout git commit uses: actions/checkout@v1 - - name: Set up Python 3.11 + - name: Set up Python 3.10 uses: actions/setup-python@v1 with: - python-version: 3.11 + python-version: 3.10 - name: Install test runner run: python3 -m pip install tox diff --git a/Dockerfile b/Dockerfile index 6fcf0dac..4e8ecb6c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY . . RUN npm run build # ----------------------------------------------------------------------------- -FROM python:3.11 as backend +FROM python:3.10 as backend RUN mkdir /opt/cosri-patientsearch WORKDIR /opt/cosri-patientsearch diff --git a/README.md b/README.md index c4622638..d89a3ac8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ All views require Keycloak authentication. Keycloak roles determine authorizati 1) `git clone ` 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.11 +4) `mkvirtualenv patientsearch` # Python 3.10 5) `pip install nodeenv` 6) `nodeenv --python-virtualenv` 7) `pip install -e .` diff --git a/tox.ini b/tox.ini index f555a8b7..27a880e9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py311 +envlist = py310 skipdist = True [testenv] From 0846dd63dc5336ae20c3886df5abb0807a2382bc Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Tue, 14 Jan 2025 09:24:03 -0800 Subject: [PATCH 11/14] Revert "Trying python 3.10 given https://github.com/pytest-dev/py/issues/273" This reverts commit 6ea149305f8338bd58cba95f930b841d78b8c71c. --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yaml | 4 ++-- Dockerfile | 2 +- README.md | 2 +- tox.ini | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 45a5a24e..ad9495f5 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -37,7 +37,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.10 + python-version: 3.11 - name: Install Python linting dependencies run: pip install black flake8 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 95babe6d..08ab91d0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,10 +9,10 @@ jobs: - name: Checkout git commit uses: actions/checkout@v1 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v1 with: - python-version: 3.10 + python-version: 3.11 - name: Install test runner run: python3 -m pip install tox diff --git a/Dockerfile b/Dockerfile index 4e8ecb6c..6fcf0dac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY . . RUN npm run build # ----------------------------------------------------------------------------- -FROM python:3.10 as backend +FROM python:3.11 as backend RUN mkdir /opt/cosri-patientsearch WORKDIR /opt/cosri-patientsearch diff --git a/README.md b/README.md index d89a3ac8..c4622638 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ All views require Keycloak authentication. Keycloak roles determine authorizati 1) `git clone ` 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.10 +4) `mkvirtualenv patientsearch` # Python 3.11 5) `pip install nodeenv` 6) `nodeenv --python-virtualenv` 7) `pip install -e .` diff --git a/tox.ini b/tox.ini index 27a880e9..f555a8b7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py310 +envlist = py311 skipdist = True [testenv] From 6eb0f7cb6701f86854e6d0843c565c007ec37f6d Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Tue, 14 Jan 2025 09:25:41 -0800 Subject: [PATCH 12/14] Upgrade `py` to correct tox errors. See https://github.com/pytest-dev/py/issues/273 --- requirements.dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.dev.txt b/requirements.dev.txt index 86a576be..96297218 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -11,7 +11,7 @@ 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 +py==1.11.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) From d60908265a8db1addaaa6377935a1bb089493e17 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Tue, 14 Jan 2025 14:15:04 -0800 Subject: [PATCH 13/14] Revert failed attempt to confront tox problems. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index f555a8b7..59cc7f85 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py311 +envlist = py3 skipdist = True [testenv] From 9019cadad499cc018bbbc8a227a55bf73c93e8e0 Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Tue, 14 Jan 2025 14:21:50 -0800 Subject: [PATCH 14/14] Remove unused dependency on `setuptools_scm` --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9db5c12a..3acc405d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm"] +requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project]