Skip to content

Commit

Permalink
Drop Python 3.7 and add Python 3.11 (#46)
Browse files Browse the repository at this point in the history
* Drop Python 3.7 and add Python 3.11

* Drop default_app_config since we only support Django 3.2+

* Run pyupgrade with py38+
  • Loading branch information
zerolab authored Jul 29, 2023
1 parent 8233524 commit fb57918
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
]
Expand All @@ -27,7 +25,7 @@ include = [
]

[tool.poetry.dependencies]
python = ">=3.7.0"
python = ">=3.8.0"
Django = ">=3.2"
PyYAML = ">=5.4.0"
typeguard = "^2.13.3"
Expand Down
4 changes: 0 additions & 4 deletions slippers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
import django

if django.VERSION < (3, 2):
default_app_config = "slippers.apps.SlippersConfig"
8 changes: 1 addition & 7 deletions slippers/conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import sys
from typing import List

if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
from typing import List, Literal

from django.conf import settings as django_settings

Expand Down
8 changes: 1 addition & 7 deletions slippers/props.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import json
import sys
from collections.abc import Mapping
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Union

if sys.version_info >= (3, 8):
from typing import Literal, get_args, get_origin
else:
from typing_extensions import Literal, get_args, get_origin
from typing import Any, Dict, List, Literal, Optional, Union, get_args, get_origin

from django.utils.html import SafeString
from django.utils.safestring import mark_safe
Expand Down
26 changes: 13 additions & 13 deletions slippers/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
# characters: -, :, and @
########################################################################################################################
filter_raw_string = r"""
^(?P<constant>%(constant)s)|
^(?P<var>[%(var_chars)s]+|%(num)s)|
(?:\s*%(filter_sep)s\s*
^(?P<constant>{constant})|
^(?P<var>[{var_chars}]+|{num})|
(?:\s*{filter_sep}\s*
(?P<filter_name>\w+)
(?:%(arg_sep)s
(?:{arg_sep}
(?:
(?P<constant_arg>%(constant)s)|
(?P<var_arg>[%(var_chars)s]+|%(num)s)
(?P<constant_arg>{constant})|
(?P<var_arg>[{var_chars}]+|{num})
)
)?
)""" % {
"constant": constant_string,
"num": r"[-+\.]?\d[\d\.e]*",
)""".format(
constant=constant_string,
num=r"[-+\.]?\d[\d\.e]*",
# The following is the only difference from the original FilterExpression. We allow variable names to have extra
# special characters: -, :, and @
"var_chars": r"\w\-\:\@\.",
"filter_sep": re.escape(FILTER_SEPARATOR),
"arg_sep": re.escape(FILTER_ARGUMENT_SEPARATOR),
}
var_chars=r"\w\-\:\@\.",
filter_sep=re.escape(FILTER_SEPARATOR),
arg_sep=re.escape(FILTER_ARGUMENT_SEPARATOR),
)

filter_re = _lazy_re_compile(filter_raw_string, re.VERBOSE)

Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ envlist =
flake8
black
isort
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}

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310, flake8, black, isort
3.10: py310,
3.11: py311, flake8, black, isort

[testenv]
deps =
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
django41: Django>=4.1,<4.2
django42: Django>=4.2,<4.3
commands =
Expand Down

0 comments on commit fb57918

Please sign in to comment.