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 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 .` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..3acc405d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "patientsearch" +dynamic = ["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 = ["patientsearch"] + +[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 +] 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) 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.* 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, -) 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