Skip to content

Commit 07d32ac

Browse files
committed
[chores] Updated CI configuration
1 parent dcd67a2 commit 07d32ac

File tree

6 files changed

+43
-33
lines changed

6 files changed

+43
-33
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- "3.8"
2020
- "3.9"
2121
- "3.10"
22+
- "3.11"
2223

2324
steps:
2425
- uses: actions/checkout@v4

CHANGES.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ Changelog
44
Verson 1.3.0 [2021-11-29]
55
-------------------------
66

7-
- [change] Allow possibility to point swappable dependency to specific migration number
8-
(instead of only to ``__latest__``)
7+
- [change] Allow possibility to point swappable dependency to specific
8+
migration number (instead of only to ``__latest__``)
99

1010
Version 1.2.0 [2021-11-12]
1111
--------------------------
1212

13-
- [feature] Add possibility to point swappable dependency to ``__latest__``
13+
- [feature] Add possibility to point swappable dependency to
14+
``__latest__``
1415
- [change] Added support for Python 3.9
1516
- [change] Added support for Django 3.2 and Django 4.0a1
1617
- [change] Dropped support for old Django versions (<2.2)
1718
- [change] Dropped support for old Python versions (<3.7)
18-
- [feature] Added optional ``require_ready`` argument to ``load_model`` function
19+
- [feature] Added optional ``require_ready`` argument to ``load_model``
20+
function
1921

2022
Version 1.1.2 [2020-01-15]
2123
--------------------------
@@ -34,27 +36,31 @@ Version 1.1.0 [2017-05-11]
3436
--------------------------
3537

3638
- [test] Added tests for swapper.split
37-
- `#13 <https://github.com/openwisp/django-swappable-models/pull/13>`_ [fix] Handle contrib apps and apps with dot in app_label.
39+
- `#13 <https://github.com/openwisp/django-swappable-models/pull/13>`_
40+
[fix] Handle contrib apps and apps with dot in app_label.
3841

3942
Version 1.0.0 [2016-08-26]
4043
--------------------------
4144

4245
- [docs] Improved usuability docs
43-
- `86e238 <https://github.com/openwisp/django-swappable-models/commit/86e238>`_:
46+
- `86e238
47+
<https://github.com/openwisp/django-swappable-models/commit/86e238>`_:
4448
[deps] Compatibility with django 1.10 added
4549

4650
Version 0.3.0 [2015-11-17]
4751
--------------------------
4852

49-
- `#9 <https://github.com/openwisp/django-swappable-models/pull/9>`_ [deps] Added support for django 1.9
53+
- `#9 <https://github.com/openwisp/django-swappable-models/pull/9>`_
54+
[deps] Added support for django 1.9
5055

5156
Version 0.2.2 [2015-06-16]
5257
--------------------------
5358

5459
- [deps] Added support for django~=1.6.0
5560
- [deps] Added support for Python 3.3
5661
- [docs] Fix model reference in README
57-
- [docs] Notes for load_model initialization (`for more info see #2 <https://github.com/openwisp/django-swappable-models/issues/2>`_)
62+
- [docs] Notes for load_model initialization (`for more info see #2
63+
<https://github.com/openwisp/django-swappable-models/issues/2>`_)
5864

5965
Version 0.2.1 [2014-11-18]
6066
--------------------------

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ def readme():
3232
'Natural Language :: English',
3333
'Operating System :: OS Independent',
3434
'Programming Language :: Python :: 3',
35-
'Programming Language :: Python :: 3.7',
3635
'Programming Language :: Python :: 3.8',
3736
'Programming Language :: Python :: 3.9',
37+
'Programming Language :: Python :: 3.10',
38+
'Programming Language :: Python :: 3.11',
3839
'Framework :: Django',
3940
'Framework :: Django :: 2.0',
4041
'Framework :: Django :: 2.1',
@@ -43,6 +44,7 @@ def readme():
4344
'Framework :: Django :: 3.1',
4445
'Framework :: Django :: 3.2',
4546
'Framework :: Django :: 4.0',
47+
'Framework :: Django :: 4.2',
4648
],
4749
tests_require=['django>=2.0'],
4850
test_suite='tests',

swapper/__init__.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88

99
def swappable_setting(app_label, model):
10-
"""
11-
Returns the setting name to use for the given model (i.e. AUTH_USER_MODEL)
10+
"""Returns the setting name to use for the given model
11+
12+
Returns the setting name to use for the given model (i.e.
13+
AUTH_USER_MODEL)
1214
"""
1315
prefix = _prefixes.get(app_label, app_label)
1416
setting = "{prefix}_{model}_MODEL".format(
@@ -23,7 +25,8 @@ def swappable_setting(app_label, model):
2325

2426

2527
def is_swapped(app_label, model):
26-
"""
28+
"""Returns the value of the swapped setting.
29+
2730
Returns the value of the swapped setting, or False if the model hasn't
2831
been swapped.
2932
"""
@@ -37,15 +40,17 @@ def is_swapped(app_label, model):
3740

3841

3942
def get_model_name(app_label, model):
40-
"""
41-
Returns [app_label.model] unless the model has been swapped, in which case
42-
returns the swappable setting value.
43+
"""Returns [app_label.model].
44+
45+
Returns [app_label.model] unless the model has been swapped, in which
46+
case returns the swappable setting value.
4347
"""
4448
return is_swapped(app_label, model) or join(app_label, model)
4549

4650

4751
def dependency(app_label, model, version=None):
48-
"""
52+
"""Returns a Django 1.7+ style dependency tuple
53+
4954
Returns a Django 1.7+ style dependency tuple for inclusion in
5055
migration.dependencies[]
5156
"""
@@ -56,16 +61,12 @@ def dependency(app_label, model, version=None):
5661

5762

5863
def get_model_names(app_label, models):
59-
"""
60-
Map model names to their swapped equivalents for the given app
61-
"""
64+
"""Map model names to their swapped equivalents for the given app"""
6265
return dict((model, get_model_name(app_label, model)) for model in models)
6366

6467

6568
def load_model(app_label, model, required=True, require_ready=True):
66-
"""
67-
Load the specified model class, or the class it was swapped out for.
68-
"""
69+
"""Load the specified model class, or the class it was swapped out for."""
6970
swapped = is_swapped(app_label, model)
7071
if swapped:
7172
app_label, model = split(swapped)
@@ -83,9 +84,7 @@ def load_model(app_label, model, required=True, require_ready=True):
8384

8485

8586
def set_app_prefix(app_label, prefix):
86-
"""
87-
Set a custom prefix to use for the given app (e.g. WQ)
88-
"""
87+
"""Set a custom prefix to use for the given app (e.g. WQ)"""
8988
_prefixes[app_label] = prefix
9089

9190

tests/test_swapper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616

1717
class SwapperTestCase(TestCase):
18-
1918
# Tests that should work whether or not default_app.Type is swapped
2019
def test_fields(self):
2120
Type = swapper.load_model('default_app', 'Type')

tox.ini

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
[tox]
22
envlist =
3-
py{37,38}-django22-{noswap,swap}
4-
py{37,38}-django30-{noswap,swap}
5-
py{37,38,39}-django31-{noswap,swap}
6-
py{37,38,39}-django32-{noswap,swap}
7-
py{38,39}-django40-{noswap, swap}
3+
py{38}-django22-{noswap,swap}
4+
py{38}-django30-{noswap,swap}
5+
py{38,39}-django31-{noswap,swap}
6+
py{38,39,310}-django32-{noswap,swap}
7+
py{38,39,310}-django40-{noswap, swap}
8+
py{38,39,310,311}-django42-{noswap, swap}
89
lint
910

1011
[gh-actions]
1112
python =
12-
3.7: py37
1313
3.8: py38, lint
1414
3.9: py39, lint
15+
3.10: py310, lint
16+
3.11: py311, lint
1517

1618
[testenv]
1719
commands =
@@ -22,7 +24,8 @@ deps =
2224
django30: django~=3.0.0
2325
django31: django~=3.1.0
2426
django32: django~=3.2.0
25-
django40: django~=4.0a1
27+
django40: django~=4.0.0
28+
django42: django~=4.2.0
2629
setenv =
2730
noswap: DJANGO_SETTINGS_MODULE=tests.settings
2831
swap: DJANGO_SETTINGS_MODULE=tests.swap_settings

0 commit comments

Comments
 (0)