Skip to content

Commit

Permalink
Prepare for Django 5.0 / Python3.12 compatibility (#245)
Browse files Browse the repository at this point in the history
* Prepare for Django 5.0 / Python3.12 compatibility
  • Loading branch information
protoroto committed Nov 28, 2023
1 parent 363b919 commit 77bbf2f
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
******************************************
Expand All @@ -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

Expand Down
19 changes: 14 additions & 5 deletions app_helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import shutil
import string
import sys
from distutils.version import LooseVersion
from tempfile import mkdtemp
from unittest.mock import patch

Expand All @@ -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

Expand Down Expand Up @@ -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


Expand Down
1 change: 1 addition & 0 deletions changes/244.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prepare for Django 5.0 / Python 3.12 compatibility
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,30 @@ 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
Framework :: Django
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
install_requires =
dj-database-url
docopt
six
setuptools; python_version>="3.12"
setup_requires =
setuptools
packages = find:
Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down

0 comments on commit 77bbf2f

Please sign in to comment.