From ab0ddba5214e3e22feb32af38e3e8a567d9846fd Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 16:00:26 +0100 Subject: [PATCH 01/13] Bump and align .pre-commit-config.yaml repos --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a32918b..c1d3e48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.7 + rev: 1.7.8 hooks: - id: bandit args: @@ -13,7 +13,7 @@ repos: rev: 24.2.0 hooks: - id: black - language_version: python3.11 + language_version: python3.12 - repo: https://github.com/pycqa/flake8 rev: 7.0.0 From 8aa29a371eb4516d58d7baeb3c438d19abb46e33 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 16:17:47 +0100 Subject: [PATCH 02/13] Bump and align .pre-commit-config.yaml repos src: edc-qareports --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c1d3e48..c3fd69a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,20 +3,20 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.8 + rev: 1.7.9 hooks: - id: bandit args: - "-x *test*.py" - repo: https://github.com/psf/black - rev: 24.2.0 + rev: 24.8.0 hooks: - id: black language_version: python3.12 - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 args: @@ -28,7 +28,7 @@ repos: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: requirements-txt-fixer files: requirements/.*\.txt$ @@ -42,7 +42,7 @@ repos: - id: detect-private-key - repo: https://github.com/adrienverge/yamllint - rev: v1.34.0 + rev: v1.35.1 hooks: - id: yamllint args: From 29304b6661e4ec1d9a424bce138fa909c335108e Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 16:46:11 +0100 Subject: [PATCH 03/13] Add check-toml hook (pre-commit-hooks) --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c3fd69a..892b227 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,7 @@ repos: - id: check-docstring-first - id: check-executables-have-shebangs - id: check-merge-conflict + - id: check-toml - id: debug-statements - id: detect-private-key From 882f242340607aa8973a310df3a5552c9b669961 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 17:06:52 +0100 Subject: [PATCH 04/13] Sort hooks by id (pre-commit-hooks) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 892b227..78a9907 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,17 +30,17 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - - id: requirements-txt-fixer - files: requirements/.*\.txt$ - - id: trailing-whitespace - id: check-added-large-files - - id: fix-byte-order-marker - id: check-docstring-first - id: check-executables-have-shebangs - id: check-merge-conflict - id: check-toml - id: debug-statements - id: detect-private-key + - id: fix-byte-order-marker + - id: requirements-txt-fixer + files: requirements/.*\.txt$ + - id: trailing-whitespace - repo: https://github.com/adrienverge/yamllint rev: v1.35.1 From fb2b75457eb3a2b57991ce4bc5ef7d0ac5756d3e Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Thu, 5 Sep 2024 17:14:10 +0100 Subject: [PATCH 05/13] Align Tox, GH Actions, setup.cfg (py312,dj42,dj51) Includes: - align pyproject.toml files - align build.yml files - align setup.cfg (somewhat) - add Python 3.12 support - add Django 5.1 support, tests - drop Python 3.11 support - drop Django 5.0 support - fix (some) typos --- .github/workflows/build.yml | 25 ++++++++++++++++--------- pyproject.toml | 12 +++++------- setup.cfg | 5 +++-- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59f4d55..dd67298 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,20 +5,17 @@ on: [push, pull_request] jobs: build: - name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}) + name: | + build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}, ${{ matrix.database-engine }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ['3.11', '3.12'] - django-version: ['4.2', '5.0', 'dev'] + python-version: ['3.12'] + django-version: ['4.2', '5.1', 'dev'] + database-engine: ["mysql", "postgres"] - exclude: - - python-version: '3.12' - django-version: '4.2' - - python-version: '3.11' - django-version: 'dev' services: mysql: image: mysql:latest @@ -28,6 +25,17 @@ jobs: ports: - 3306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:latest + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 steps: - name: Install pycups and words dependency @@ -61,7 +69,6 @@ jobs: python -m pip install --upgrade pip python -m pip install -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt - - name: Tox tests run: | tox -v diff --git a/pyproject.toml b/pyproject.toml index 86ed5ca..51b3328 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,12 +6,12 @@ version_file="_version.py" [tool.black] line-length = 95 -target-version = ["py311"] +target-version = ["py312"] extend-exclude = '''^(.*\/)*\b(migrations)\b($|\/.*$)''' [tool.isort] profile = "black" -py_version = "311" +py_version = "312" skip = [".tox", ".eggs", "migrations"] [tool.coverage.run] @@ -35,21 +35,19 @@ exclude_lines = [ legacy_tox_ini = """ [tox] envlist = - py{311}-dj{42,50}, - py{312}-dj{50,dev}, + py{312}-dj{42,51,dev}, lint isolated_build = true [gh-actions] python = - 3.11: py311 3.12: py312, lint [gh-actions:env] DJANGO = 4.2: dj42 - 5.0: dj50 + 5.1: dj51 dev: djdev, lint [testenv] @@ -59,7 +57,7 @@ deps = -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/edc.txt -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/third_party_dev.txt dj42: Django>=4.2,<5.0 - dj50: Django>=5.0 + dj51: Django>=5.1,<5.2 djdev: https://github.com/django/django/tarball/main commands = diff --git a/setup.cfg b/setup.cfg index a60ab5d..7258ab4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,14 +13,15 @@ classifiers= Environment :: Web Environment Framework :: Django Framework :: Django :: 4.2 + Framework :: Django :: 5.1 Intended Audience :: Developers Intended Audience :: Science/Research Operating System :: OS Independent - Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 License :: OSI Approved :: GNU General Public License v3 (GPLv3) [options] -python_requires = >=3.11 +python_requires = >=3.12 zip_safe = False include_package_data = True packages = find: From 6758acf69812f229797cde64c2fd95fb043f8bf9 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 6 Sep 2024 15:33:55 +0100 Subject: [PATCH 06/13] Remove explicit update of `coverage[toml]` Latest version is already installed as part of: https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 51b3328..badfeab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,7 +61,7 @@ deps = djdev: https://github.com/django/django/tarball/main commands = - pip install -U pip coverage[toml] + pip install -U pip pip --version pip freeze coverage run -a runtests.py From 1f44b96313e1ecd2c9cd863e382911ab099717bd Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Thu, 10 Oct 2024 17:35:39 +0100 Subject: [PATCH 07/13] Bump pre-commit repos (bandit, black and pre-commit-hooks) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 78a9907..6718a49 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,14 +3,14 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.9 + rev: 1.7.10 hooks: - id: bandit args: - "-x *test*.py" - repo: https://github.com/psf/black - rev: 24.8.0 + rev: 24.10.0 hooks: - id: black language_version: python3.12 @@ -28,7 +28,7 @@ repos: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-docstring-first From cd4bc26fd73c3b6f17bc659222cb9b1f69f5fabe Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 11 Oct 2024 13:06:23 +0100 Subject: [PATCH 08/13] Add Python 3.13, remove Django 4.2 tox/GH actions test runners --- .github/workflows/build.yml | 4 ++-- pyproject.toml | 8 ++++---- setup.cfg | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd67298..950e9aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.12'] - django-version: ['4.2', '5.1', 'dev'] + python-version: ['3.12', '3.13'] + django-version: ['5.1', 'dev'] database-engine: ["mysql", "postgres"] services: diff --git a/pyproject.toml b/pyproject.toml index badfeab..f23cba6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,18 +35,18 @@ exclude_lines = [ legacy_tox_ini = """ [tox] envlist = - py{312}-dj{42,51,dev}, + py{312,313}-dj{51,dev}, lint isolated_build = true [gh-actions] python = - 3.12: py312, lint + 3.12: py312 + 3.13: py313, lint [gh-actions:env] DJANGO = - 4.2: dj42 5.1: dj51 dev: djdev, lint @@ -56,12 +56,12 @@ deps = -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/test_utils.txt -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/edc.txt -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/third_party_dev.txt - dj42: Django>=4.2,<5.0 dj51: Django>=5.1,<5.2 djdev: https://github.com/django/django/tarball/main commands = pip install -U pip + python --version pip --version pip freeze coverage run -a runtests.py diff --git a/setup.cfg b/setup.cfg index 7258ab4..7dae28f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,7 +12,6 @@ keywords = django edc unblinding, RCT, clinicedc, clinical trials classifiers= Environment :: Web Environment Framework :: Django - Framework :: Django :: 4.2 Framework :: Django :: 5.1 Intended Audience :: Developers Intended Audience :: Science/Research From 43e37b60848a0a3e7f633a25bc8e586a6e0af6df Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 11 Oct 2024 20:22:30 +0100 Subject: [PATCH 09/13] Align, add `build-backend` to pyproject.toml --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f23cba6..e7f5e19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,9 @@ [build-system] requires = ["setuptools>=60", "setuptools-scm>=8.0"] +build-backend = "setuptools.build_meta" [tool.setuptools_scm] -version_file="_version.py" +version_file = "_version.py" [tool.black] line-length = 95 From 2a8e2d8c28b6ceca99c5834db9a3a8843c8cf6af Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Mon, 18 Nov 2024 14:19:13 +0000 Subject: [PATCH 10/13] pre-commit: add `check-yaml` hook --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6718a49..c4ac7ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,6 +35,7 @@ repos: - id: check-executables-have-shebangs - id: check-merge-conflict - id: check-toml + - id: check-yaml - id: debug-statements - id: detect-private-key - id: fix-byte-order-marker From 28b9ac6c06d100a75349dd6c3bce3051bcc0f3b2 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Mon, 18 Nov 2024 16:24:53 +0000 Subject: [PATCH 11/13] pre-commit: add `end-of-file-fixer` hook, and run on all files --- .pre-commit-config.yaml | 1 + AUTHORS | 2 +- edc_unblinding/tests/holidays.csv | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4ac7ed..bace820 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,7 @@ repos: - id: check-yaml - id: debug-statements - id: detect-private-key + - id: end-of-file-fixer - id: fix-byte-order-marker - id: requirements-txt-fixer files: requirements/.*\.txt$ diff --git a/AUTHORS b/AUTHORS index 3bc0afa..eb5e7d3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1 @@ -Erik van Widenfelt \ No newline at end of file +Erik van Widenfelt diff --git a/edc_unblinding/tests/holidays.csv b/edc_unblinding/tests/holidays.csv index f72c587..a0285a5 100644 --- a/edc_unblinding/tests/holidays.csv +++ b/edc_unblinding/tests/holidays.csv @@ -12,4 +12,4 @@ 2019-12-01,Mawlid Day,tanzania 2019-12-09,Independence Day,tanzania 2019-12-25,Christmas Day,tanzania -2019-12-26,Boxing Day,tanzania \ No newline at end of file +2019-12-26,Boxing Day,tanzania From 05b18f95304f7d6bf41d4d34a712f0628eb4a822 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 19 Nov 2024 12:43:25 +0000 Subject: [PATCH 12/13] Remove `third_party_dev.txt` deps (already referenced in `edc.txt`) --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e7f5e19..9dd4330 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,6 @@ deps = -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/tox.txt -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/test_utils.txt -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/edc.txt - -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/third_party_dev.txt dj51: Django>=5.1,<5.2 djdev: https://github.com/django/django/tarball/main From 84d84973b02de5e697fed18867e0383615fbb088 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 19 Nov 2024 16:10:17 +0000 Subject: [PATCH 13/13] Add pre-commit env/runner to Tox/GH Actions --- pyproject.toml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9dd4330..550ee42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,18 +38,19 @@ legacy_tox_ini = """ envlist = py{312,313}-dj{51,dev}, lint + pre-commit isolated_build = true [gh-actions] python = - 3.12: py312 - 3.13: py313, lint + 3.12: py312, lint, pre-commit + 3.13: py313 [gh-actions:env] DJANGO = 5.1: dj51 - dev: djdev, lint + dev: djdev, lint, pre-commit [testenv] deps = @@ -70,7 +71,19 @@ commands = [testenv:lint] deps = -r https://raw.githubusercontent.com/clinicedc/edc/develop/requirements.tests/lint.txt commands = + python --version + pip --version + pip freeze isort --profile=black --check --diff . black --check --diff . flake8 . + +[testenv:pre-commit] +deps = pre-commit +commands = + python --version + pip --version + pip freeze + pre-commit autoupdate + pre-commit run --all-files """