Repository navigation
Modernize supported Django/Python matrix and drop dead compatibility code - #84
Merged
PetrDlouhy merged 3 commits intoJul 28, 2026
Merged
Conversation
The supported matrix had drifted far from reality: setup.py still advertised Django 2.2/3.0 on Python 3.6-3.8, while CI was actually exercising Django 2.2-5.1 on Python 3.7-3.12. Set the baseline at Django 3.2 and Python 3.8. That specific line is not arbitrary - it is the exact point at which every remaining version-conditional branch in the package becomes dead code (removed in the following commit). Raising it further would drop more versions without simplifying anything. Also add `python_requires`, which this package has never declared. Without it pip will happily install a release onto an unsupported Python and fail at import; with it, users below the baseline keep resolving to 4.3.x. This is what makes dropping versions a minor release rather than a breaking one. The test matrix now covers Django 3.2, 4.2, 5.2, 6.0 and main across Python 3.8-3.13. Dropping 3.7 also lets the workflow go back to plain `ubuntu-latest`, since 3.7 was the only entry unavailable on ubuntu-24.04 and needed a pinned older runner. Two further fixes here: `coverage<5` (from 2019) is unpinned so it can install on current Pythons, and the `main` Django factor is renamed to `djmain` so it actually matches the `djmain` envs - as written, the `master:` dep line matched no factor, so those environments silently tested the latest released Django instead of main. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
With Django >= 3.2 and Python >= 3.8 guaranteed, every version- conditional branch in the package is unreachable: - `default_app_config` is only consulted below Django 3.2; from 3.2 on, app-config autodiscovery finds pinax.referrals.apps.AppConfig on its own (verified: verbose_name and default_auto_field are still applied). - The `MiddlewareMixin` fallback to `object` was already dead - the mixin has existed since Django 1.10, well below the previous 2.2 floor - and the fallback would have produced broken middleware anyway. - `is_safe_url` was the pre-Django-3.0 spelling of `url_has_allowed_host_and_scheme`, and was itself removed in Django 4.0, so the fallback could never fire usefully. - The `pkg_resources` fallback is only needed below Python 3.8. runtests.py additionally carried compatibility for Django < 1.10 (MIDDLEWARE_CLASSES), Django < 1.7 (`hasattr(django, "setup")`) and Django < 1.8 (`django.test.simple.DjangoTestSuiteRunner`) - all far below even the previous floor. Removing the Django 1.10 check also drops the `distutils` import, which is no longer in the standard library from Python 3.12 and only still resolves via a setuptools shim. The `account.decorators` import is deliberately kept: that is optional- dependency detection for django-user-accounts, not version compat. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
flake8 3.7.9 and isort 4.3.21 both date from 2019, and the isort invocation used `--recursive`, a flag removed in isort 5. Move to flake8 7 and isort 5, and replace the deprecated single-dash `-sp` with `--settings-path`. isort 5 orders one test module's imports differently from isort 4 (model_bakery sorts before pinax, which this project's config treats as third-party); that file is reformatted to match. flake8 7 reports no new findings. README: refresh the support table, add the 4.4.0 entry, and replace the CircleCI badge - CI has been GitHub Actions for some time, so that badge pointed at a service no longer in use. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Housekeeping ahead of a 4.4.0 release, following on from #82 and #83.
Where the baseline is set, and why there
Django >= 3.2, Python >= 3.8.
That line is picked by the code rather than the calendar: it is the exact point at which every remaining version-conditional branch in the package becomes dead code. Raising it further would drop more versions while simplifying nothing.
default_app_configis_safe_urlfallback forurl_has_allowed_host_and_schemepkg_resourcesfallback (added in #82)MiddlewareMixin→objectfallbackruntests.py:MIDDLEWARE_CLASSES,hasattr(django, "setup"),DjangoTestSuiteRunnerThe
account.decoratorsimport is deliberately kept — that is optional-dependency detection for django-user-accounts, not version compatibility.Removing the Django 1.10 branch also drops
runtests.py'sdistutilsimport.distutilsleft the standard library in Python 3.12 and currently only resolves through a setuptools shim, so that was a latent failure waiting on a setuptools release.python_requires, and why this is 4.4.0 and not 5.0.0Dropping supported versions is only a minor change if package metadata stops incompatible users from receiving the release — otherwise their pip installs it and it breaks at import.
This package has never declared
python_requires; all 15 published releases reportrequires_python=(none). So when 4.3.0 dropped Python 3.6, nothing prevented a 3.6 user from installing it.This PR adds
python_requires=">=3.8"and raisesinstall_requirestodjango>=3.2, so users below the baseline resolve to 4.3.x. With that gate in place, this matches the precedent of 4.3.0 dropping Python 3.6 in a minor release.Two pre-existing bugs fixed along the way
mainDjango factor never matched.envlistdeclareddjmainenvironments, but the dep line wasmaster:. No factor namedmasterexists, so those environments installed no explicit Django and silently tested the latest released version instead of main. Renamed todjmain:— the run below confirms it now fetchesdjango/tarball/main.coverage<5was pinned to a 2019 release; unpinned so it installs on current Pythons.Also included
ubuntu-latest— 3.7 was the only entry unavailable onubuntu-24.04, and Update deprecated GitHub Actions and test invocation so CI can run again #83 had to pin an older runner for it. That pin is now gone.--recursiveflag and the deprecated-spspelling. isort 5 orders one test module differently; that file is reformatted. flake8 7 reports no new findings.setup.pyclassifiers and the long-description support table now match what CI actually proves, instead of claiming Django 2.2/3.0 on Python 3.6–3.8.Net -23 lines, no functional change to the library.
Verification
Run on a fork before opening: all 7 jobs green, covering 16 tox environments, each confirmed to have actually executed rather than silently skipped:
Locally I also confirmed the 10 tests pass with system checks clean, and that after removing
default_app_configapp-config autodiscovery still appliespinax.referrals.apps.AppConfigwith itsverbose_nameanddefault_auto_fieldintact.🤖 Generated with Claude Code