diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d10d1b..0c8db2a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,10 +9,17 @@ jobs: continue-on-error: ${{ matrix.continue-on-error }} strategy: matrix: - python-version: ["3.11", "3.10", "3.9"] - django: [42, 32] + python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"] + django: [50, 42, 32] cms: [nocms, cms311, async] continue-on-error: [false] + exclude: + - django: 50 + cms: cms311 + - django: 50 + python-version: 3.9 + - django: 50 + python-version: 3.8 steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -39,7 +46,7 @@ jobs: python -m pip install --upgrade pip setuptools tox>4 - name: Test with tox env: - TOX_ENV: ${{ format('py-django{1}-{2}', matrix.python-version, matrix.django, matrix.cms) }} + TOX_ENV: ${{ format('py{0}-django{1}-{2}', matrix.python-version, matrix.django, matrix.cms) }} COMMAND: coverage run COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_SERVICE_NAME: github diff --git a/README.rst b/README.rst index cf22b05..5bd7a12 100644 --- a/README.rst +++ b/README.rst @@ -9,6 +9,8 @@ Django App helper Starting from 3 django-app-helper only supports Django 2.2+ and django CMS 3.7+. If you need support for older (unsupported) versions, use django-app-helper 2. + Django 5.0 support exclude django CMS 3.11 support, as django CMS 3.11 doesn't yet support Django 5.0. + ****************************************** Helper for django applications development ****************************************** @@ -28,9 +30,9 @@ It supports both tests writted using Django ``TestCase`` and pytest ones Supported versions ================== -Python: 3.9, 3.10, 3.11 +Python: 3.8, 3.9, 3.10, 3.11, 3.12 -Django: 3.2, 4.0, 4.1, 4.2 +Django: 3.2, 4.0, 4.1, 4.2, 5.0 django CMS: 3.11 diff --git a/app_helper/utils.py b/app_helper/utils.py index 7252629..5cf02d5 100644 --- a/app_helper/utils.py +++ b/app_helper/utils.py @@ -4,7 +4,6 @@ import shutil import string import sys -from distutils.version import LooseVersion from tempfile import mkdtemp from unittest.mock import patch @@ -16,6 +15,11 @@ from . import HELPER_FILE +try: + from setuptools import LooseVersion +except ImportError: # pragma: no cover + from distutils.version import LooseVersion + try: import cms # NOQA @@ -61,12 +65,17 @@ def load_from_file(module_path): Borrowed from django-cms """ - from imp import PY_SOURCE, load_module - imported = None if module_path: - with open(module_path) as openfile: - imported = load_module("mod", openfile, module_path, ("imported", "r", PY_SOURCE)) + try: + from importlib.machinery import SourceFileLoader + + imported = SourceFileLoader("mod", module_path).load_module() + except ImportError: # pragma: no cover + from imp import PY_SOURCE, load_module + + with open(module_path) as openfile: + imported = load_module("mod", openfile, module_path, ("imported", "r", PY_SOURCE)) return imported diff --git a/changes/244.feature b/changes/244.feature new file mode 100644 index 0000000..941eb31 --- /dev/null +++ b/changes/244.feature @@ -0,0 +1 @@ +Prepare for Django 5.0 / Python 3.12 compatibility diff --git a/setup.cfg b/setup.cfg index dc487f2..fe73327 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ description = Helper for django applications development long_description = file: README.rst, HISTORY.rst long_description_content_type = text/x-rst license = GPLv2+ -license_file = LICENSE +license_files = LICENSE classifiers = License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) Development Status :: 5 - Production/Stable @@ -18,13 +18,14 @@ classifiers = Framework :: Django :: 3.2 Framework :: Django :: 4.1 Framework :: Django :: 4.2 + Framework :: Django :: 5.0 Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 [options] include_package_data = True @@ -32,6 +33,7 @@ install_requires = dj-database-url docopt six + setuptools; python_version>="3.12" setup_requires = setuptools packages = find: diff --git a/tox.ini b/tox.ini index 2f92d25..000aa05 100644 --- a/tox.ini +++ b/tox.ini @@ -8,9 +8,11 @@ envlist = ruff pypi-description towncrier - py{311}-django{42,41,40,32}-{cms311,nocms,async} - py{310}-django{42,41,40,32}-{cms311,nocms,async} - py{39}-django{32}-{cms311,nocms,async} + py{3.12}-django{42,50}-{nocms,async} + py{3.11}-django{42,41,40,32}-{cms311,nocms,async} + py{3.10}-django{42,41,40,32}-{cms311,nocms,async} + py{3.9}-django{32}-{cms311,nocms,async} + py{3.8}-django{32}-{cms311,nocms,async} minversion = 3.23 [testenv] @@ -20,6 +22,7 @@ deps= django40: django~=4.0.0 django41: django~=4.1.0 django42: django~=4.2.0 + django50: django~=5.0.0b1 cms311: https://github.com/yakky/django-cms/archive/release/3.11.x.zip cms311: djangocms-text-ckeditor>=5.0,<6.0 -r{toxinidir}/requirements-test.txt