From 46b775d6d786b6fe5becbc00a371ea74688f1cc4 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 2 Feb 2024 11:43:30 +0000 Subject: [PATCH 01/19] Bump pre-commit repos, run through Black 24.1.1 Black changes witnessed (mainly) include: - addition of blank line between module docstrings and imports - removal of blank lines between class declarations and docstrings - prefer splitting assignment statements on right-hand side - wrap conditional expressions that span multiple lines in parens --- .pre-commit-config.yaml | 12 ++++++------ ...ates_or_creates_registered_subject_model_mixin.py | 1 - edc_registration/tests/models.py | 2 -- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f3af91..3fa7253 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,32 +3,32 @@ exclude: tests/etc/user-* repos: - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.7.7 hooks: - id: bandit args: - "-x *test*.py" - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.1.1 hooks: - id: black language_version: python3.11 - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 args: - "--config=setup.cfg" - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.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.32.0 + rev: v1.33.0 hooks: - id: yamllint args: diff --git a/edc_registration/model_mixins/updates_or_creates_registered_subject_model_mixin.py b/edc_registration/model_mixins/updates_or_creates_registered_subject_model_mixin.py index 26138f2..3642779 100644 --- a/edc_registration/model_mixins/updates_or_creates_registered_subject_model_mixin.py +++ b/edc_registration/model_mixins/updates_or_creates_registered_subject_model_mixin.py @@ -17,7 +17,6 @@ class UpdatesOrCreatesRegistrationModelError(Exception): class UpdatesOrCreatesRegistrationModelMixin(models.Model): - """A model mixin that creates or updates Registration model (e.g. RegisteredSubject) on post_save signal. """ diff --git a/edc_registration/tests/models.py b/edc_registration/tests/models.py index 9dee74f..a1f57e8 100644 --- a/edc_registration/tests/models.py +++ b/edc_registration/tests/models.py @@ -19,7 +19,6 @@ def registration_unique_field(self): class SubjectModelTwo(UpdatesOrCreatesRegistrationModelMixin, BaseUuidModel): - """Note: registration_unique_field is overridden.""" subject_identifier = models.CharField(max_length=25, null=True) @@ -32,7 +31,6 @@ def registration_unique_field(self): class SubjectModelThree(UpdatesOrCreatesRegistrationModelMixin, BaseUuidModel): - """Note: registration_unique_field is overridden.""" subject_identifier = models.CharField(max_length=25, null=True) From 0114dc233094d22d90b790cc6ab53d168f1fcf9b Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 6 Feb 2024 09:06:01 +0000 Subject: [PATCH 02/19] Update GH actions to versions running Node.js 20 Fixes warnings: "Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20" See also: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/ --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ec2681..59f4d55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,9 +36,9 @@ jobs: sudo apt-get -y update sudo apt-get install libcups2-dev wamerican - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -48,7 +48,7 @@ jobs: echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} key: From 3dcc2ac7b8aeac7a627c5d7cf583bc52ab7b9ec3 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 13 Feb 2024 13:30:45 +0000 Subject: [PATCH 03/19] Bump pre-commit repos (Black 24.2.0, yamllint 1.34.0) --- .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 3fa7253..a32918b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - "-x *test*.py" - repo: https://github.com/psf/black - rev: 24.1.1 + rev: 24.2.0 hooks: - id: black language_version: python3.11 @@ -42,7 +42,7 @@ repos: - id: detect-private-key - repo: https://github.com/adrienverge/yamllint - rev: v1.33.0 + rev: v1.34.0 hooks: - id: yamllint args: From cd0344158e13a97b5b2c9d3f0db7fc3a596b7e93 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 13 Feb 2024 20:19:31 +0000 Subject: [PATCH 04/19] Fix/unify GH actions build status badge --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 3712ee1..8b3b93b 100644 --- a/README.rst +++ b/README.rst @@ -67,8 +67,8 @@ A subject's ``RegisteredSubject`` instance is created and updated in a ``post_sa .. |pypi| image:: https://img.shields.io/pypi/v/edc-registration.svg :target: https://pypi.python.org/pypi/edc-registration -.. |actions| image:: https://github.com/clinicedc/edc-registration/workflows/build/badge.svg?branch=develop - :target: https://github.com/clinicedc/edc-registration/actions?query=workflow:build +.. |actions| image:: https://github.com/clinicedc/edc-registration/actions/workflows/build.yml/badge.svg + :target: https://github.com/clinicedc/edc-registration/actions/workflows/build.yml .. |codecov| image:: https://codecov.io/gh/clinicedc/edc-registration/branch/develop/graph/badge.svg :target: https://codecov.io/gh/clinicedc/edc-registration From 04a68ac2460e70467b216c3d4c9ea23a38c34583 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 16:00:05 +0100 Subject: [PATCH 05/19] 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 fc9b3512aa9afcb79fe31b552369fee18f5e9bde Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 16:17:28 +0100 Subject: [PATCH 06/19] 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 d6936d79fff2175dee9ad8003f1fe61cfd8fad1c Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 16:45:45 +0100 Subject: [PATCH 07/19] 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 ae9b3420ed5ebe98142b827b2a503d219eaf9d75 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 4 Sep 2024 17:06:26 +0100 Subject: [PATCH 08/19] 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 8db1058d5e0edbb1e8729b8cd6a6cad175e7926d Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Thu, 5 Sep 2024 17:13:44 +0100 Subject: [PATCH 09/19] 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 | 6 +++--- 3 files changed, 24 insertions(+), 19 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 9afec50..79c7a06 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 2ae3843..71450f0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,15 +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 2229fd6c55c1857e6acf08e8f91f8c2390a2b4e3 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 6 Sep 2024 15:33:35 +0100 Subject: [PATCH 10/19] 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 79c7a06..b046dcd 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 34f8dca46075b77b2c27bb9af30cfdb26c86e7d6 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Thu, 10 Oct 2024 17:35:15 +0100 Subject: [PATCH 11/19] 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 b641b02de885ef091ffd45206b888bb8a861bd8a Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 11 Oct 2024 13:05:54 +0100 Subject: [PATCH 12/19] 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 b046dcd..29de59f 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 71450f0..f38b964 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,7 +12,6 @@ keywords = django edc registration, 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 f74967d2b05ecb3a2b44c84d55dd7e3844703071 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Fri, 11 Oct 2024 20:22:05 +0100 Subject: [PATCH 13/19] 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 29de59f..cfe7e2a 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 51197ef86c0043b54eea386750f71ee45750fe6d Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Mon, 18 Nov 2024 14:19:03 +0000 Subject: [PATCH 14/19] 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 0126d278086852e37508f8877aa8ba04c1727e07 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Mon, 18 Nov 2024 16:24:41 +0000 Subject: [PATCH 15/19] pre-commit: add `end-of-file-fixer` hook, and run on all files --- .coveragerc | 2 +- .pre-commit-config.yaml | 1 + LICENSE | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.coveragerc b/.coveragerc index e55531e..4cbd89e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,4 @@ [run] include = edc_registration/* omit = edc_registration/tests/*,edc_registration/migrations/* -branch = 1 \ No newline at end of file +branch = 1 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/LICENSE b/LICENSE index 8cdb845..23cb790 100644 --- a/LICENSE +++ b/LICENSE @@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. - From fa72d2fce9e03d093477ceaa65552539f117d619 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 19 Nov 2024 12:43:18 +0000 Subject: [PATCH 16/19] 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 cfe7e2a..565a0e2 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 29227f5d5377efefcfbb8f9b3b6e33052351e876 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Tue, 19 Nov 2024 16:10:10 +0000 Subject: [PATCH 17/19] 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 565a0e2..888cb41 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 """ From c0be7d6071f26c4acdb820ee74def06316dd69a5 Mon Sep 17 00:00:00 2001 From: erikvw Date: Wed, 20 Nov 2024 10:20:57 -0600 Subject: [PATCH 18/19] show screening identifier in admin --- edc_registration/modeladmin_mixins.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/edc_registration/modeladmin_mixins.py b/edc_registration/modeladmin_mixins.py index fbe0918..f01760c 100644 --- a/edc_registration/modeladmin_mixins.py +++ b/edc_registration/modeladmin_mixins.py @@ -62,6 +62,7 @@ def get_list_display(self, request): "initials", "gender", "subject_type", + "screening_identifier", "sid", "registration_status", "site", @@ -74,6 +75,7 @@ def get_list_display(self, request): "dashboard", "gender", "subject_type", + "screening_identifier", "sid", "registration_status", "site", From 2560aafc1b1bb415f20fa015ce4300a5b5fd5146 Mon Sep 17 00:00:00 2001 From: Jonathan Willitts Date: Wed, 20 Nov 2024 18:03:18 +0000 Subject: [PATCH 19/19] Refactor tests to use `edc_test_settings.default_test_settings` --- edc_registration/tests/test_settings.py | 61 +++++++++++++++++++++++ runtests.py | 66 +------------------------ 2 files changed, 63 insertions(+), 64 deletions(-) create mode 100644 edc_registration/tests/test_settings.py diff --git a/edc_registration/tests/test_settings.py b/edc_registration/tests/test_settings.py new file mode 100644 index 0000000..1978755 --- /dev/null +++ b/edc_registration/tests/test_settings.py @@ -0,0 +1,61 @@ +import sys +from pathlib import Path + +from edc_test_settings.default_test_settings import DefaultTestSettings + +app_name = "edc_registration" +base_dir = Path(__file__).absolute().parent.parent.parent + +project_settings = DefaultTestSettings( + calling_file=__file__, + BASE_DIR=base_dir, + APP_NAME=app_name, + SILENCED_SYSTEM_CHECKS=[ + "sites.E101", + "edc_navbar.E002", + "edc_sites.E001", + "edc_sites.E002", + ], + SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit", + INSTALLED_APPS=[ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "django.contrib.sites", + "django_crypto_fields.apps.AppConfig", + "django_revision.apps.AppConfig", + "multisite", + "adverse_event_app.apps.AppConfig", + "edc_action_item.apps.AppConfig", + "edc_adverse_event.apps.AppConfig", + "edc_appointment.apps.AppConfig", + # "edc_auth.apps.AppConfig", + "edc_dashboard.apps.AppConfig", + # "edc_data_manager.apps.AppConfig", + # "edc_device.apps.AppConfig", + # "edc_facility.apps.AppConfig", + # "edc_form_runners.apps.AppConfig", + # "edc_identifier.apps.AppConfig", + # "edc_lab.apps.AppConfig", + # "edc_label.apps.AppConfig", + # "edc_locator.apps.AppConfig", + # "edc_metadata.apps.AppConfig", + "edc_notification.apps.AppConfig", + # "edc_offstudy.apps.AppConfig", + "edc_registration.apps.AppConfig", + "edc_review_dashboard.apps.AppConfig", + "edc_sites.apps.AppConfig", + "edc_subject_dashboard.apps.AppConfig", + # "edc_timepoint.apps.AppConfig", + "edc_visit_schedule.apps.AppConfig", + "edc_visit_tracking.apps.AppConfig", + "edc_appconfig.apps.AppConfig", + ], + add_dashboard_middleware=True, +).settings + +for k, v in project_settings.items(): + setattr(sys.modules[__name__], k, v) diff --git a/runtests.py b/runtests.py index 9fb5963..220f674 100644 --- a/runtests.py +++ b/runtests.py @@ -1,67 +1,5 @@ #!/usr/bin/env python -import logging -from pathlib import Path - -from edc_test_utils import DefaultTestSettings, func_main - -app_name = "edc_registration" -base_dir = Path(__file__).absolute().parent - -project_settings = DefaultTestSettings( - calling_file=__file__, - BASE_DIR=base_dir, - APP_NAME=app_name, - SILENCED_SYSTEM_CHECKS=[ - "sites.E101", - "edc_navbar.E002", - "edc_navbar.E003", - "edc_consent.E001", - "edc_sites.E001", - "edc_sites.E002", - ], - SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit", - ETC_DIR=str(base_dir / app_name / "tests" / "etc"), - INSTALLED_APPS=[ - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "django.contrib.sites", - "django_crypto_fields.apps.AppConfig", - "django_revision.apps.AppConfig", - "multisite", - "edc_action_item.apps.AppConfig", - "edc_appointment.apps.AppConfig", - "edc_auth.apps.AppConfig", - "edc_data_manager.apps.AppConfig", - "edc_device.apps.AppConfig", - "edc_facility.apps.AppConfig", - "edc_form_runners.apps.AppConfig", - "edc_identifier.apps.AppConfig", - "edc_lab.apps.AppConfig", - "edc_label.apps.AppConfig", - "edc_locator.apps.AppConfig", - "edc_metadata.apps.AppConfig", - "edc_notification.apps.AppConfig", - "edc_offstudy.apps.AppConfig", - "edc_registration.apps.AppConfig", - "edc_sites.apps.AppConfig", - "edc_timepoint.apps.AppConfig", - "edc_visit_schedule.apps.AppConfig", - "edc_visit_tracking.apps.AppConfig", - "edc_appconfig.apps.AppConfig", - ], - RANDOMIZATION_LIST_PATH=str(base_dir / app_name / "tests" / "test_randomization_list.csv"), - add_dashboard_middleware=True, -).settings - - -def main(): - func_main(project_settings, *[f"{app_name}.tests"]) - +from edc_test_settings.func_main import func_main2 if __name__ == "__main__": - logging.basicConfig() - main() + func_main2("edc_registration.tests.test_settings", "edc_registration.tests")