Skip to content

Commit 6489a39

Browse files
authored
Merge pull request AltSchool#345 from AltSchool/pr/339
Update to work with Django 4.0.* & 4.1.* (cc AltSchool#339)
2 parents cdf804f + 7566cc6 commit 6489a39

17 files changed

+185
-181
lines changed

.circleci/config.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.circleci/python-versions.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/test.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,22 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: [3.6, 3.7, 3.8]
16-
dj-version: ["2.2.*", "3.0.*", "3.1.*", "3.2.*"]
15+
python-version: [3.7, 3.8, 3.9, "3.10"]
16+
dj-version: ["2.2.*", "3.0.*", "3.1.*", "3.2.*", "4.0.*", "4.1.*"]
1717
drf-version: ["3.11.*", "3.12.*", "3.13.*"]
18+
exclude:
19+
- python-version: 3.7
20+
dj-version: '4.0.*'
21+
- python-version: 3.7
22+
dj-version: '4.1.*'
23+
- dj-version: '4.0.*'
24+
drf-version: '3.11.*'
25+
- dj-version: '4.1.*'
26+
drf-version: '3.11.*'
27+
- dj-version: '4.0.*'
28+
drf-version: '3.12.*'
29+
- dj-version: '4.1.*'
30+
drf-version: '3.12.*'
1831

1932
steps:
2033
- uses: actions/checkout@v2
@@ -39,15 +52,15 @@ jobs:
3952
steps:
4053
- uses: actions/checkout@v2
4154

42-
- name: Set up Python37
55+
- name: Set up Python39
4356
uses: actions/setup-python@v2
4457
with:
45-
python-version: 3.7
58+
python-version: 3.9
4659

4760
- name: Install Dependencies
4861
run: |
4962
python -m pip install --upgrade pip
50-
pip install flake8==2.4.0
63+
pip install flake8==5.0.4
5164
5265
- name: Lint Code
5366
run: |

benchmarks.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
verticalAlign: 'middle',
3737
borderWidth: 0
3838
},
39-
series: [{"name": "DREST 2.0.0", "data": [[3, 0.0037530000000000003], [14, 0.004215], [39, 0.0047805], [84, 0.005736], [155, 0.006875], [258, 0.0083385], [399, 0.010683000000000002], [584, 0.0135645], [819, 0.016668000000000002], [1110, 0.020622], [1463, 0.025916500000000002], [1884, 0.031551499999999996], [2379, 0.0381205], [2954, 0.0471535], [3615, 0.0551515], [4368, 0.0671345]]}, {"name": "DRF 3.12.4", "data": [[3, 0.0016465], [14, 0.0033355], [39, 0.005826], [84, 0.0093875], [155, 0.014127], [258, 0.0199585], [399, 0.027033], [584, 0.035491499999999995], [819, 0.044836], [1110, 0.056142], [1463, 0.0692645], [1884, 0.085964], [2379, 0.10098850000000001], [2954, 0.122303], [3615, 0.1445205], [4368, 0.16253800000000002]]}]
39+
series: [{"name": "DREST 2.1.5", "data": [[3, 0.0040409999999999995], [14, 0.0045705], [39, 0.0050475], [84, 0.005978], [155, 0.007379500000000001], [258, 0.009155], [399, 0.011596], [584, 0.014615], [819, 0.0196445], [1110, 0.023429], [1463, 0.030967], [1884, 0.0363245], [2379, 0.042646], [2954, 0.052871], [3615, 0.061801499999999995], [4368, 0.075429]]}, {"name": "DRF 3.13.1", "data": [[3, 0.0016865], [14, 0.0031869999999999997], [39, 0.0054065], [84, 0.008954], [155, 0.012576], [258, 0.017916500000000002], [399, 0.023919], [584, 0.0305975], [819, 0.040176], [1110, 0.049114], [1463, 0.0607875], [1884, 0.073817], [2379, 0.08280850000000001], [2954, 0.100053], [3615, 0.116385], [4368, 0.1316425]]}]
4040
});
4141
});
4242
</script>
@@ -75,7 +75,7 @@
7575
verticalAlign: 'middle',
7676
borderWidth: 0
7777
},
78-
series: [{"name": "DREST 2.0.0", "data": [[256, 0.004253], [512, 0.007494499999999999], [768, 0.010120500000000001], [1024, 0.0127455], [1280, 0.0157595], [1536, 0.018013], [1792, 0.0212245], [2048, 0.0240905], [2304, 0.02581], [2560, 0.0287565], [2816, 0.0314165], [3072, 0.0506805], [3328, 0.0382505], [3584, 0.042971], [3840, 0.0428355], [4096, 0.0469565]]}, {"name": "DRF 3.12.4", "data": [[256, 0.08546100000000001], [512, 0.171128], [768, 0.2598395], [1024, 0.33919750000000004], [1280, 0.426328], [1536, 0.5128635], [1792, 0.5989595], [2048, 0.684221], [2304, 0.762429], [2560, 0.8562815], [2816, 0.9428665], [3072, 1.0435575], [3328, 1.1402725], [3584, 1.208104], [3840, 1.29737], [4096, 1.403646]]}]
78+
series: [{"name": "DREST 2.1.5", "data": [[256, 0.0049345], [512, 0.0079795], [768, 0.011013499999999999], [1024, 0.014020999999999999], [1280, 0.017308999999999998], [1536, 0.021166], [1792, 0.024343999999999998], [2048, 0.02784], [2304, 0.0314175], [2560, 0.033699], [2816, 0.038019], [3072, 0.041934], [3328, 0.043043], [3584, 0.0794575], [3840, 0.0490405], [4096, 0.053863999999999995]]}, {"name": "DRF 3.13.1", "data": [[256, 0.08685699999999999], [512, 0.178358], [768, 0.24748900000000001], [1024, 0.3386085], [1280, 0.4147925], [1536, 0.514057], [1792, 0.5993599999999999], [2048, 0.6840200000000001], [2304, 0.773505], [2560, 0.842225], [2816, 0.920455], [3072, 1.0180465], [3328, 1.080375], [3584, 1.171262], [3840, 1.276456], [4096, 1.3620234999999998]]}]
7979
});
8080
});
8181
</script>
@@ -114,7 +114,7 @@
114114
verticalAlign: 'middle',
115115
borderWidth: 0
116116
},
117-
series: [{"name": "DREST 2.0.0", "data": [[20, 0.003006], [72, 0.004069], [156, 0.005076], [272, 0.006527], [420, 0.0086305], [600, 0.010717], [812, 0.013677], [1056, 0.016252], [1332, 0.020575], [1640, 0.024105500000000002], [1980, 0.0269815], [2352, 0.032959], [2756, 0.036424], [3192, 0.043724], [3660, 0.047021], [4160, 0.0538335]]}, {"name": "DRF 3.12.4", "data": [[20, 0.0027085], [72, 0.004940999999999999], [156, 0.0076405], [272, 0.0109555], [420, 0.0148125], [600, 0.018860000000000002], [812, 0.0231945], [1056, 0.0287305], [1332, 0.0355045], [1640, 0.041485], [1980, 0.047808], [2352, 0.056248], [2756, 0.062773], [3192, 0.071774], [3660, 0.07946], [4160, 0.0885375]]}]
117+
series: [{"name": "DREST 2.1.5", "data": [[20, 0.003293], [72, 0.0041295], [156, 0.0052875], [272, 0.006942500000000001], [420, 0.0093875], [600, 0.0121055], [812, 0.0145185], [1056, 0.01793], [1332, 0.022449499999999997], [1640, 0.025948], [1980, 0.031333], [2352, 0.0370555], [2756, 0.04199], [3192, 0.0666925], [3660, 0.0555085], [4160, 0.060936500000000005]]}, {"name": "DRF 3.13.1", "data": [[20, 0.0023765], [72, 0.0044495], [156, 0.006364], [272, 0.008661499999999999], [420, 0.0117725], [600, 0.0146015], [812, 0.017887], [1056, 0.0214405], [1332, 0.026827], [1640, 0.029961], [1980, 0.036192], [2352, 0.040636], [2756, 0.045358499999999996], [3192, 0.050945000000000004], [3660, 0.056278499999999995], [4160, 0.0628445]]}]
118118
});
119119
});
120120
</script>

benchmarks/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
STATIC_ROOT = INSTALL_DIR + 'www/static'
99

1010
DEBUG = True
11+
USE_TZ = False
1112

1213
DATABASES = {}
1314
if os.environ.get('DATABASE_URL'):

benchmarks/test_bench.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,4 @@ def get_random_string(size):
269269
)
270270
test = generate_benchmark(name, title, drest, drf, size, sample)
271271
setattr(BenchmarkTest, test_name, test)
272+
del test_name, test

dynamic_rest/metadata.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
"""This module contains custom DRF metadata classes."""
22
from collections import OrderedDict
33

4-
from django.utils.encoding import force_text
4+
try:
5+
from django.utils.encoding import force_str
6+
except ImportError:
7+
from django.utils.encoding import force_text as force_str
8+
59
from rest_framework.fields import empty
610
from rest_framework.metadata import SimpleMetadata
711
from rest_framework.serializers import ListSerializer, ModelSerializer
@@ -50,7 +54,7 @@ def get_field_info(self, field):
5054
field_info['choices'] = [
5155
{
5256
'value': choice_value,
53-
'display_name': force_text(choice_name, strings_only=True)
57+
'display_name': force_str(choice_name, strings_only=True)
5458
}
5559
for choice_value, choice_name in field.choices.items()
5660
]

install_requires.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Django>=2.2,<4
2-
djangorestframework>=3.11.0,<3.14.0
1+
Django>=2.2,<4.2
2+
djangorestframework>=3.11.2,<3.15
33
inflection>=0.4.0
44
requests
55
hashids>=1.3.1

requirements.benchmark.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
Sphinx==1.3.4
2-
Django>=2.2.12<=3.2.7
3-
djangorestframework>=3.11.0,<3.14.0
41
dj-database-url==0.3.0
52
django-debug-toolbar==1.7
6-
flake8==3.9.2
7-
pytest-cov==2.5.1
8-
pytest-django==2.8.0
9-
pytest-sugar==0.5.1
10-
pytest==3.7.1
11-
psycopg2-binary==2.8.6
12-
tox-pyenv==1.0.2
13-
tox==2.3.1
14-
djay==0.0.8
3+
Django>=2.2,<4.2
4+
djangorestframework>=3.11.2,<3.15
5+
djay>=0.0.9
6+
flake8>=3.0
7+
psycopg2-binary==2.9.3
8+
pytest-cov==3.0.0
9+
pytest-django==4.5.2
10+
pytest-sugar==0.9.5
11+
pytest==7.1.2
12+
Sphinx==1.7.5
13+
tox-pyenv==1.1.0
14+
tox==3.25.1

requirements.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
dj-database-url==0.5.0
2-
djay>=0.0.8
3-
flake8==3.9.2
2+
djay>=0.0.9
3+
flake8>=3.0
44
hashids==1.3.1
55
mock==2.0.0
6-
psycopg2-binary==2.8.6
7-
pytest-cov==2.5.1
8-
pytest-django==3.4.1
9-
pytest-sugar==0.9.1
10-
pytest==3.7.1
6+
psycopg2-binary==2.9.3
7+
pytest-cov==3.0.0
8+
pytest-django==4.5.2
9+
pytest-sugar==0.9.5
10+
pytest>=7.0.0
1111
six==1.16.0
1212
Sphinx==1.7.5
1313
tox-pyenv==1.1.0
14-
tox==3.14.6
15-
twine==3.3.0
14+
tox==3.25.1
15+
twine==3.8.0

0 commit comments

Comments
 (0)