diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index e9e1779..549329b 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -11,58 +11,34 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - django_version: [ '3.2', '4.0', '4.1', '4.2' ] - python_version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] - exclude: - - django_version: '3.2' - python_version: '3.11' - - - django_version: '4.0' - python_version: '3.11' - - - django_version: '4.1' - python_version: '3.11' - - - django_version: '4.0' - python_version: '3.7' - - - django_version: '4.1' - python_version: '3.7' - - - django_version: '4.2' - python_version: '3.7' + python_version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + - '3.12' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python_version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_version }} - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v4 with: # This path is specific to Ubuntu path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.django_version }} + key: ${{ runner.os }}-pip-${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . - pip install -U flake8 coveralls argparse mypy django-stubs types-setuptools - pip install -U Django~=${{ matrix.django_version }} - - name: Lint with flake8 - run: | - flake8 --ignore=E501,W504 safedelete - - name: Check typings - run: | - mypy --config-file mypy.ini safedelete - - name: Test Django - if: matrix.django_version != '1.11' - run: | - python -W error::DeprecationWarning -W error::PendingDeprecationWarning \ - -m coverage run `which django-admin` test --settings=safedelete.tests.settings + python -m pip install --upgrade 'tox>=4.0.0rc3' + - name: Run tox targets for ${{ matrix.python_version }} + run: tox run -f py$(echo ${{ matrix.python_version }} | tr -d .) + - name: Coverage if: ${{ success() }} run: | diff --git a/CHANGES b/CHANGES index c6abdd1..9b9d6bc 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,7 @@ CHANGELOG 1.3.4 (unreleased) ================== -- +- Support Python 3.11 / Django 5.0 1.3.3 (2023-11-13) ================== diff --git a/safedelete/admin.py b/safedelete/admin.py index ec32051..45f954a 100644 --- a/safedelete/admin.py +++ b/safedelete/admin.py @@ -12,7 +12,7 @@ from django.utils.encoding import force_str from django.utils.html import conditional_escape, format_html from django.utils.translation import gettext_lazy as _ -from pkg_resources import parse_version +from packaging.version import parse as parse_version from .config import FIELD_NAME from .utils import related_objects diff --git a/setup.py b/setup.py index eb1ec5c..0be7cf9 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,6 @@ def get_version(package_name): 'Development Status :: 4 - Beta', ], license='BSD', - install_requires=['Django'], + install_requires=['Django', 'packaging'], include_package_data=True, ) diff --git a/tox.ini b/tox.ini index 701c627..04f7722 100644 --- a/tox.ini +++ b/tox.ini @@ -1,34 +1,35 @@ [tox] skipsdist = True envlist = - {py37}-django-{32} {py38}-django-{32,40,41,42} {py39}-django-{32,40,41,42} - {py310}-django-{32,40,41,42} - {py311}-django-{32,40,41,42} - {py310}-isort - {py310}-flake8 - {py310}-mypy + {py310}-django-{32,40,41,42,50} + {py311}-django-{32,40,41,42,50} + {py312}-django-{41,42,50} + isort + flake8 + mypy [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir} deps = - flake8: flake8>=2.0,<3.0 - django-32: Django>=3.2,<3.3 + coverage + packaging>=24.0 + django-32: Django>=3.2,<4.0 django-40: Django>=4.0,<4.1 django-41: Django>=4.1,<4.2 django-42: Django>=4.2,<5.0 - mypy: mypy - mypy: Django>=4.1,<5.0 - mypy: django-stubs - mypy: types-setuptools - isort: isort + django-50: Django>=5.0,<5.1 + commands = - isort: isort . - flake8: flake8 safedelete --ignore=E501 - django: {toxinidir}/runtests.py {posargs} - mypy: mypy --config-file mypy.ini {posargs: safedelete} + python \ + -W error::DeprecationWarning \ + -W error::PendingDeprecationWarning \ + -W ignore:::site \ + -W ignore:::distutils \ + -m coverage run \ + {toxinidir}/runtests.py {posargs} [testenv:docs] basepython = python @@ -36,10 +37,32 @@ changedir = docs deps = sphinx sphinx_rtd_theme - Django>=4.2,<5.0 + Django>=5.0,<5.1 commands = sphinx-build -W -b html -d build/doctrees . build/html +[testenv:mypy] +usedevelop = false +basepython = python3.12 +deps = + mypy + Django>=5.0,<5.1 + django-stubs + types-setuptools +commands = mypy --config-file mypy.ini {posargs: safedelete} + +[testenv:flake8] +usedevelop = false +basepython = python3.12 +deps = flake8 +commands = flake8 --ignore=E501,W504 safedelete + +[testenv:isort] +usedevelop = false +basepython = python3.12 +deps = isort +commands = isort . + [isort] skip_gitignore = true include_trailing_comma = true