From 77cbc163170081160fdc59c466507324559c3f48 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 07:48:42 -0400 Subject: [PATCH 1/9] add the setup.py file equivalents fields for pyrpoject.toml per https://packaging.python.org/en/latest/guides/modernize-setup-py-project/ --- pyproject.toml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8a2f802..65aa24a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,26 @@ +[project] +name = "django-fernet-encrypted-fields" +version = "0.3.1" +description = "Symetrically encrypted model fields for Django" +readme = "README.md" +license = "MIT" +authors = [ + { name = "jazzband", email = "n.anahara@fragment.co.jp" }, +] +requires-python = ">=3.8" +dependencies = [ + "Django>=4.2", + "cryptography>=35.0.0", +] + +[project.urls] +Homepage = "https://github.com/jazzband/django-fernet-encrypted-fields/" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + + ################## # ruff ################## From bfd122561664d59961876b877bd4902dfc26775e Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 07:49:40 -0400 Subject: [PATCH 2/9] remove setup.py we could keep it, but there's no complex steps in there that require a setup.py type build --- setup.py | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 5b7c6fc..0000000 --- a/setup.py +++ /dev/null @@ -1,18 +0,0 @@ -from setuptools import setup - -setup( - name="django-fernet-encrypted-fields", - description=("This is inspired by django-encrypted-fields."), - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - url="http://github.com/jazzband/django-fernet-encrypted-fields/", - license="MIT", - author="jazzband", - author_email="n.anahara@fragment.co.jp", - packages=["encrypted_fields"], - version="0.3.0", - install_requires=[ - "Django>=4.2", - "cryptography>=35.0.0", - ], -) From 077832b5e2c96250ca975e756daa8e8efa7b19b8 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 08:00:38 -0400 Subject: [PATCH 3/9] migrate to a src layout --- pyproject.toml | 4 ++-- {encrypted_fields => src/encrypted_fields}/__init__.py | 0 {encrypted_fields => src/encrypted_fields}/fields.py | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {encrypted_fields => src/encrypted_fields}/__init__.py (100%) rename {encrypted_fields => src/encrypted_fields}/fields.py (100%) diff --git a/pyproject.toml b/pyproject.toml index 65aa24a..a7663fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ dependencies = [ Homepage = "https://github.com/jazzband/django-fernet-encrypted-fields/" [build-system] -requires = ["setuptools"] +requires = ["setuptools>=61.0.0"] build-backend = "setuptools.build_meta" @@ -30,7 +30,7 @@ lint.fixable = ["ALL"] lint.ignore = ["A003", "COM812", "D", "DJ008", "ERA001", "ISC001", "PLC2401", "PLC2403", "PT011", "RUF001", "S101", "S105", "S608", "SIM103", "TC001", "TC002", "TC003", "UP040"] lint.select = ["ALL"] lint.unfixable = ["ERA001", "F401"] -include = ["encrypted_fields/*.py", "package_test/*.py"] +extend-include = ["package_test/**/*.py"] target-version = "py312" ################## diff --git a/encrypted_fields/__init__.py b/src/encrypted_fields/__init__.py similarity index 100% rename from encrypted_fields/__init__.py rename to src/encrypted_fields/__init__.py diff --git a/encrypted_fields/fields.py b/src/encrypted_fields/fields.py similarity index 100% rename from encrypted_fields/fields.py rename to src/encrypted_fields/fields.py From 353cdd21c01141e4a37ed01f11aa95d10053f177 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 08:02:53 -0400 Subject: [PATCH 4/9] remove requirements.txt file which is captured in the pyproject.toml now and uses ranges of possible dependencies instead of just pinning to a single version --- requirements.txt | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index df636f6..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -cffi==2.0.0 -cryptography==46.0.2 -pycparser==2.23 -Django>=4.2 From d63e02c453796fec8db01e4cae869c13b430cda5 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 08:18:22 -0400 Subject: [PATCH 5/9] add development dependencies to a dependency group in pyproject.toml --- pyproject.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a7663fa..05fd1a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,15 @@ Homepage = "https://github.com/jazzband/django-fernet-encrypted-fields/" requires = ["setuptools>=61.0.0"] build-backend = "setuptools.build_meta" +[dependency-groups] +dev = [ + "mypy>=1.19.1,<2", + "pre-commit>=4.5.1", + "ruff>=0.15.6,<0.16.0", + "pytest>=9.0.2", + "pytest-cov>=7.0.0", + "coverage>=7.13.4,<8.0.0", +] ################## # ruff From a0a8631e14d2c2b28143a3ee367948a97f207ed5 Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 08:26:05 -0400 Subject: [PATCH 6/9] use dev dependency group for dependency installation in CI and fix command for running test with new src layout --- .github/workflows/lint-and-test.yml | 11 ++--------- .gitignore | 2 ++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 5d9966b..43c925b 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -48,17 +48,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip install --group dev pip install -q Django~=${{ matrix.django_version }} - pip install coverage pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Run tests run: | - coverage3 run --source='./encrypted_fields' manage.py test + coverage run --source='./src/encrypted_fields' manage.py test coverage xml - -# - name: "Upload coverage to Artifact" -# uses: actions/upload-artifact@v4 -# with: -# name: coverage -# path: coverage.xml diff --git a/.gitignore b/.gitignore index f0f01b9..a04484b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ dist/ .ruff_cache .venv .venv_django_* +.coverage* +coverage.* From 5a2e5d764179fa914a64351ef339adf636c1fdaf Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 08:36:01 -0400 Subject: [PATCH 7/9] install encrypted_fields before testing it --- .github/workflows/lint-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 43c925b..30fe6c9 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -48,7 +48,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install --group dev + pip install --group dev . pip install -q Django~=${{ matrix.django_version }} - name: Run tests From d22be8c977143f37e8b9252bc20b023700bd6acb Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 11:19:30 -0400 Subject: [PATCH 8/9] update required python version to 3.10 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 05fd1a8..c6deb2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ license = "MIT" authors = [ { name = "jazzband", email = "n.anahara@fragment.co.jp" }, ] -requires-python = ">=3.8" +requires-python = ">=3.10" dependencies = [ "Django>=4.2", "cryptography>=35.0.0", From fd1564ee1e00710051abc5b14ace6cb1c03b6e9d Mon Sep 17 00:00:00 2001 From: David Paul Graham Date: Sat, 14 Mar 2026 11:21:22 -0400 Subject: [PATCH 9/9] fix typo in description --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c6deb2d..c99195c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "django-fernet-encrypted-fields" version = "0.3.1" -description = "Symetrically encrypted model fields for Django" +description = "Symmetrically encrypted model fields for Django" readme = "README.md" license = "MIT" authors = [