Skip to content

Commit 65f6cc6

Browse files
authored
Drop python 3.5 and 3.6 (#67)
* Added pre-commit and testing against python 3.10 * Added pre-commit and testing against python 3.10 * Update tox isort command for v5 * Keep dependabot happy. * Drop django 3.0 support due to security issues * Add django 4 to tests * Add django 4 to classifiers * Simplified tests because there isn't a requirement on django-cms but it was being installed. * Separated django 4 tests while python 3.7 is still included
1 parent 43b967d commit 65f6cc6

22 files changed

+224
-108
lines changed

.github/workflows/test.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,37 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
python-version: [ 3.7, 3.8, 3.9, ] # latest release minus two
12-
requirements-file: [
13-
dj22_cms37.txt,
14-
dj22_cms38.txt,
15-
dj30_cms37.txt,
16-
dj30_cms38.txt,
17-
dj31_cms38.txt,
18-
dj32_cms39.txt,
11+
python-version: ['3.7', '3.8', '3.9', '3.10']
12+
django-version: ['2.2', '3.1', '3.2']
13+
os: [
14+
ubuntu-20.04,
1915
]
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Set up Python ${{ matrix.python-version }}
20+
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install django==${{ matrix.django-version }} coverage
28+
python setup.py install
29+
30+
- name: Run coverage
31+
run: coverage run setup.py test
32+
33+
- name: Upload Coverage to Codecov
34+
uses: codecov/codecov-action@v1
35+
36+
unit-tests-dj4:
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
python-version: ['3.8', '3.9', '3.10']
2042
os: [
2143
ubuntu-20.04,
2244
]
@@ -31,7 +53,7 @@ jobs:
3153
- name: Install dependencies
3254
run: |
3355
python -m pip install --upgrade pip
34-
pip install -r tests/requirements/${{ matrix.requirements-file }}
56+
pip install "django>=4.0,<4.1" coverage
3557
python setup.py install
3658
3759
- name: Run coverage

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*.log
55
*.pot
66
.DS_Store
7-
.coverage/
7+
.coverage
88
.eggs/
99
.idea/
1010
.project/

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
- repo: https://github.com/asottile/pyupgrade
3+
rev: v2.31.0
4+
hooks:
5+
- id: pyupgrade
6+
args: ["--py37-plus"]
7+
8+
- repo: https://github.com/adamchainz/django-upgrade
9+
rev: '1.4.0'
10+
hooks:
11+
- id: django-upgrade
12+
args: [--target-version, "2.2"]
13+
14+
- repo: https://github.com/PyCQA/flake8
15+
rev: 4.0.1
16+
hooks:
17+
- id: flake8
18+
19+
- repo: https://github.com/asottile/yesqa
20+
rev: v1.3.0
21+
hooks:
22+
- id: yesqa
23+
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v4.1.0
26+
hooks:
27+
- id: check-merge-conflict
28+
- id: mixed-line-ending
29+
30+
- repo: https://github.com/pycqa/isort
31+
rev: 5.10.1
32+
hooks:
33+
- id: isort

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog
33
=========
44

5+
unreleased
6+
==========
7+
8+
* Added support for Django 3.2 and 4.0
9+
* Drop support for python 3.5 and 3.6
510

611
2.0.0 (2020-08-26)
712
==================

classytags/arguments.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
from classytags.exceptions import InvalidFlag
55
from classytags.utils import NULL, TemplateConstant, mixin
6-
from classytags.values import (
7-
ChoiceValue, DictValue, IntegerValue, ListValue, StrictStringValue,
8-
StringValue,
9-
)
6+
from classytags.values import ChoiceValue, DictValue, IntegerValue, ListValue, StrictStringValue, StringValue
107

118

129
class Argument:
@@ -22,7 +19,7 @@ def __init__(self, name, default=None, required=True, resolve=True):
2219
self.resolve = resolve
2320

2421
def __repr__(self): # pragma: no cover
25-
return '<%s: %s>' % (self.__class__.__name__, self.name)
22+
return f'<{self.__class__.__name__}: {self.name}>'
2623

2724
def get_default(self):
2825
"""
@@ -164,7 +161,7 @@ def __init__(self, name, default=None, required=True, resolve=True,
164161
def get_default(self):
165162
items = self.default.items()
166163
return self.wrapper_class(
167-
dict([(key, TemplateConstant(value)) for key, value in items])
164+
{key: TemplateConstant(value) for key, value in items}
168165
)
169166

170167
def parse(self, parser, token, tagname, kwargs):

classytags/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __repr__(self):
5959
blocks = ';%s' % ','.join(map(attrgetter('alias'), self.blocks))
6060
else: # pragma: no cover
6161
blocks = ''
62-
return '<Options:%s%s>' % (options, blocks)
62+
return f'<Options:{options}{blocks}>'
6363

6464
def __add__(self, other):
6565
if not isinstance(other, Options):
@@ -146,7 +146,7 @@ def render(self, context):
146146
Usually you should not override this method, but rather use render_tag.
147147
"""
148148
items = self.kwargs.items()
149-
kwargs = dict([(key, value.resolve(context)) for key, value in items])
149+
kwargs = {key: value.resolve(context) for key, value in items}
150150
kwargs.update(self.blocks)
151151
return str(self.render_tag(context, **kwargs))
152152

classytags/parser.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
from django import template
44

5-
from classytags.exceptions import (
6-
ArgumentRequiredError, BreakpointExpected, TooManyArguments,
7-
TrailingBreakpoint,
8-
)
5+
from classytags.exceptions import ArgumentRequiredError, BreakpointExpected, TooManyArguments, TrailingBreakpoint
96

107

118
class Parser:

classytags/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def __init__(self, options, breakpoints, blocks, combind_breakpoints):
3939
self.breakpoints = copy(breakpoints)
4040
self.blocks = copy(blocks)
4141
self.combined_breakpoints = dict(combind_breakpoints.items())
42-
self.reversed_combined_breakpoints = dict(
43-
(v, k) for k, v in combind_breakpoints.items()
44-
)
42+
self.reversed_combined_breakpoints = {
43+
v: k for k, v in combind_breakpoints.items()
44+
}
4545
self.current_breakpoint = None
4646
if self.breakpoints:
4747
self.next_breakpoint = self.breakpoints.pop(0)
@@ -79,7 +79,7 @@ def get_default_name(name):
7979
def mixin(parent, child, attrs=None):
8080
attrs = attrs or {}
8181
return type(
82-
'%sx%s' % (parent.__name__, child.__name__),
82+
f'{parent.__name__}x{child.__name__}',
8383
(child, parent),
8484
attrs
8585
)

classytags/values.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def __init__(self, value):
8383
dict.__init__(self, value)
8484

8585
def resolve(self, context):
86-
resolved = dict(
87-
[(key, value.resolve(context)) for key, value in self.items()]
88-
)
86+
resolved = {
87+
key: value.resolve(context) for key, value in self.items()
88+
}
8989
return self.clean(resolved)
9090

9191

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
master_doc = 'index'
4141

4242
# General information about the project.
43-
project = u'django-classy-tags'
44-
copyright = u'2010, Jonas Obrist'
43+
project = 'django-classy-tags'
44+
copyright = '2010, Jonas Obrist'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
@@ -175,8 +175,8 @@
175175
# Grouping the document tree into LaTeX files. List of tuples
176176
# (source start file, target name, title, author, documentclass [howto/manual]).
177177
latex_documents = [
178-
('index', 'django-classy-tags.tex', u'django-classy-tags Documentation',
179-
u'Jonas Obrist', 'manual'),
178+
('index', 'django-classy-tags.tex', 'django-classy-tags Documentation',
179+
'Jonas Obrist', 'manual'),
180180
]
181181

182182
# The name of an image file (relative to this directory) to place at the top of

0 commit comments

Comments
 (0)