Skip to content

Commit

Permalink
Support Python 3.11 / Django 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro committed May 13, 2024
1 parent 67647eb commit 43693f1
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 59 deletions.
52 changes: 14 additions & 38 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CHANGELOG
1.3.4 (unreleased)
==================

-
- Support Python 3.11 / Django 5.0

1.3.3 (2023-11-13)
==================
Expand Down
2 changes: 1 addition & 1 deletion safedelete/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
59 changes: 41 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,45 +1,68 @@
[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
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
Expand Down

0 comments on commit 43693f1

Please sign in to comment.