Skip to content

Commit

Permalink
Bump: Supported versions of Python/Django/DRF (evenicoulddoit#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipstarkey authored Mar 18, 2024
1 parent abed9de commit c5f8856
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 45 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
* Support for Python 3.9, 3.10, 3.11, and 3.12
* Support for Django 3.2, 4.2, and 5.0
* Support for Django REST Framework 3.12, 3.13, 3.14, and 3.15

### Changed
* Switches from Travis CI to Github Actions
* Introduced `black` and `isort` to standardise coding style
* Restructures requirements to create single source of truth
* Drops `./runtest` executable, `pytest` now direct route
* Drops `mock` dependency, in favour of `unittest.mock`

### Removed
* Support for Python <= 3.7 (EOL 2023)
* Support for Django <= 3.1 (EOL 2021)
* Support for Django REST Framework <= 3.11

## [2.0.1] - 2020-09-20
### Fixed
* Removed `import_local()`, use Django's in-built `import_string()` method
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ API, we suggest you consider switching to HashIds instead.
## Requirements
Tested against:

* Python (3.6, 3.7, 3.8)
* [Django](https://github.com/django/django) (2.1, 2.2, 3.0)
* [Django REST Framework](https://github.com/tomchristie/django-rest-framework) (3.9, 3.10, 3.11)
* Python (3.8, 3.9, 3.10, 3.11, 3.12)
* [Django](https://github.com/django/django) (3.2, 4.2, 5.0)
* [Django REST Framework](https://github.com/tomchristie/django-rest-framework)
(3.12, 3.13, 3.14, 3.15). Note Django REST Framework 3.15 is the first version to
officially support Django 4.2+.
* [HashIds](https://github.com/davidaurelio/hashids-python) (>1.0)


Expand Down Expand Up @@ -183,7 +185,7 @@ $ mkdocs build
```
[build-status-image]: https://secure.travis-ci.org/evenicoulddoit/django-rest-framework-serializer-extensions.svg?branch=master
[build-status-image]: https://github.com/evenicoulddoit/django-rest-framework-serializer-extensions/actions/workflows/test.yml/badge.svg?branch=master
[gh-actions]: https://github.com/evenicoulddoit/django-rest-framework-serializer-extensions/actions/workflows/test.yml?query=branch%3Amaster
[coverage-status-image]: https://img.shields.io/codecov/c/github/evenicoulddoit/django-rest-framework-serializer-extensions/master.svg
[codecov]: http://codecov.io/github/evenicoulddoit/django-rest-framework-serializer-extensions?branch=master
Expand Down
8 changes: 5 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ API, we suggest you consider switching to HashIDs instead.


## Requirements
* Python (2.7, 3.4, 3.5)
* [Django](https://github.com/django/django) (1.8, 1.10, 1.11)
* [Django REST Framework](https://github.com/tomchristie/django-rest-framework) (3.4, 3.5, 3.6)
* Python (3.8, 3.9, 3.10, 3.11, 3.12)
* [Django](https://github.com/django/django) (3.2, 4.2, 5.0)
* [Django REST Framework](https://github.com/tomchristie/django-rest-framework)
(3.12, 3.13, 3.14, 3.15). Note Django REST Framework 3.15 is the first version to
officially support Django 4.2+.
* [HashIds](https://github.com/davidaurelio/hashids-python) (>1.0)
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ site_dir: html
theme: readthedocs
extra_css:
- css/extra.css
pages:
nav:
- Home: 'index.md'
- Overview: 'overview.md'
- Installation: 'installation.md'
Expand Down
4 changes: 2 additions & 2 deletions requirements-coverage.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Code coverage requirements
# Note: These packages are stored outside of the setup.py, to maintain a
# single source of truth, and allow the extras to be installed in isolation.
codecov==2.0.15
pytest-cov==2.6.1
codecov==2.1.13
pytest-cov==4.1.0
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Development / CI requirements
# Note: These packages are stored outside of the setup.py, to maintain a
# single source of truth, and allow the extras to be installed in isolation.
black==19.10b0
flake8==3.9.0
isort==5.8.0
wheel==0.24.0 # for PyPI installs
black==24.2.0
flake8==7.0.0
isort==5.13.2
wheel==0.42.0 # for PyPI installs
2 changes: 1 addition & 1 deletion requirements-mkdocs.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mkdocs==0.16.1 # for documentation previews/deploys
mkdocs==1.5.3 # for documentation previews/deploys
11 changes: 6 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# Note: These packages are stored outside of the setup.py, to maintain a
# single source of truth, and allow the extras to be installed in isolation.
django-test-plus==1.4.0
Django>=2.1.15,<4
djangorestframework>=3.9.4
pytest-cov==2.6.1
pytest-django==3.4.8
pytest==4.4.1
Django>=3.2,<5.1
djangorestframework>=3.12
pytest-cov==4.1.0
pytest-django==4.8.0
pytest==8.0.0
setuptools==69.1.0
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[flake8]
extend-ignore = E203 # Spaces before ":", which conflicts with black
# Ignore spaces before ":", which conflicts with black
extend-ignore = E203

[wheel]
universal = 1
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ def get_long_description():
"Operating System :: OS Independent",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
],
)
1 change: 1 addition & 0 deletions tests/serializers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A collection of complete extensions serializers to be used by various tests.
"""

from rest_framework import serializers

from rest_framework_serializer_extensions.serializers import (
Expand Down
8 changes: 5 additions & 3 deletions tests/test_serializers__expandable_fields_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class Meta:
expandable_fields = dict(
manufacturer=ManufacturerTestSerializer,
skus=dict(
serializer="{0}.SkuTestSerializer".format(MODULE), many=True
serializer="{0}.SkuTestSerializer".format(MODULE),
many=True,
),
)

Expand All @@ -49,7 +50,8 @@ class Meta:
expandable_fields = dict(
model=CarModelTestSerializer,
owners=dict(
serializer="{0}.OwnerTestSerializer".format(MODULE), many=True,
serializer="{0}.OwnerTestSerializer".format(MODULE),
many=True,
),
)

Expand Down Expand Up @@ -434,7 +436,7 @@ def test_method_field_serializer_unexpanded(self):
"""
self.assertDictEqual(
OwnerWithMethodFieldTestSerializer(self.owner_tyrell).data,
dict(id=self.owner_tyrell.pk, name=self.owner_tyrell.name,),
dict(id=self.owner_tyrell.pk, name=self.owner_tyrell.name),
)

def test_method_field_serializer_expanded(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_serializers__only_fields_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_complex(self):
),
dict(
name=self.carmodel_model_s.name,
manufacturer=dict(name=self.manufacturer_tesla.name,),
manufacturer=dict(name=self.manufacturer_tesla.name),
skus=[
dict(variant=self.sku_p100d.variant),
dict(variant=self.sku_70.variant),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_extensions_query_params_enabled(self):
)

@patch.object(
SerializerExtensionsAPIViewMixin, "get_extensions_auto_optimize",
SerializerExtensionsAPIViewMixin, "get_extensions_auto_optimize"
)
def test_auto_optimization_included(self, mock_get_auto_optimize):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import re_path
from django.urls import re_path
from django.views.generic import TemplateView

urlpatterns = [
Expand Down
1 change: 1 addition & 0 deletions tests/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A collection of complete extensions views to be used by various tests.
"""

from rest_framework.generics import ListAPIView, RetrieveAPIView

from rest_framework_serializer_extensions.views import (
Expand Down
31 changes: 17 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,34 @@ envlist =
flake8
codecov
docs
{py36,py37,py38}-django{21,22}-drf{39,310,311}
{py36,py37,py38}-django{30}-drf{310,311}
{py38,py39}-django{32}-drf{312,313,314,315}
{py38,py39,py310,py311,py312}-django{42}-drf{314,315}
{py310,py311,py312}-django{50}-drf{314,315}

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38,black,flake8,docs
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312,black,flake8,docs

[testenv]
passenv = CI TRAVIS TRAVIS_*
setenv =
PYTHONDONTWRITEBYTECODE=1
commands = pytest {posargs}
deps =
django21: Django==2.1.15
django22: Django==2.2.8
django30: Django==3.0.0
drf39: djangorestframework==3.9.4
drf310: djangorestframework==3.10.3
drf311: djangorestframework==3.11.0
django32: Django==3.2
django42: Django==4.2
django50: Django==5.0
drf312: djangorestframework==3.12
drf313: djangorestframework==3.13
drf314: djangorestframework==3.14
drf315: djangorestframework==3.15
extras = test

[testenv:black]
commands = black rest_framework_serializer_extensions tests
commands = black rest_framework_serializer_extensions tests --check --diff
skip_install = true
deps =
-crequirements-dev.txt
Expand Down Expand Up @@ -59,4 +62,4 @@ extras =
[testenv:docs]
commands = mkdocs build
deps =
mkdocs>=0.16.1
mkdocs>=1.5.3

0 comments on commit c5f8856

Please sign in to comment.