Skip to content

Commit 9507c02

Browse files
DelboyJaytyomo4kastuart-bradley
authored
1.3.0 Release branch (#47)
* Added authorisation header to BasicKeyEncoder. pre-commit chores. (#40) Co-authored-by: Del Hyman-Jones <DelboyJay@users.noreply.github.com> * CLE-1613 django42 python311 support (#46) * Fix test cases * Update tox to run python version from 3.7 to 3.11 (3.12 is not supported fully yet) Add django testing for 4.1 and 4.2 Add djangorestframework testing for 3.14 * update poetry packages * update github workflows and actions * update pre-commit config to latest versions Fix linting * Update README.md * formatted files * Updated CHANGES.md * version to 1.3.0 added readme for pypi description and homepage link * Fix release file * fix linting --------- Co-authored-by: Artem <tyomo4ka@users.noreply.github.com> Co-authored-by: Stuart Bradley <stuy.bradley@gmail.com>
1 parent 29e30a9 commit 9507c02

23 files changed

+1129
-938
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.2.0
2+
current_version = 1.3.0
33
commit = False
44
tag = False
55

@@ -10,7 +10,3 @@ replace = version = "{new_version}"
1010
[bumpversion:file:Makefile]
1111
search = django-idempotency-key-{current_version}.tar.gz
1212
replace = django-idempotency-key-{new_version}.tar.gz
13-
14-
[bumpversion:file:.github/workflows/release.yml]
15-
search = uses: d1618033/gh-action-python-publish-using-poetry@{current_version}
16-
replace = uses: d1618033/gh-action-python-publish-using-poetry@{new_version}

.github/actions/lint/action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: "Django Idempotency Key Tests"
1+
name: "Linting"
22
runs:
33
using: "composite"
44
steps:
5-
- uses: actions/checkout@v2
5+
- uses: actions/checkout@v3
66

7-
- name: Set up Python 3.10.0
8-
uses: actions/setup-python@v2
7+
- name: Set up Python 3.11
8+
uses: actions/setup-python@v4
99
with:
10-
python-version: "3.10"
10+
python-version: "3.11"
1111

1212
- name: pre-commit
13-
uses: pre-commit/action@v2.0.3
13+
uses: pre-commit/action@v3.0.0

.github/actions/tests/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ runs:
77
using: "composite"
88
steps:
99
- name: Check out repository
10-
uses: actions/checkout@v2
10+
uses: actions/checkout@v3
1111

1212
- name: Set up Python ${{ inputs.python-version }}
13-
uses: actions/setup-python@v2
13+
uses: actions/setup-python@v4
1414
with:
1515
python-version: ${{ inputs.python-version }}
1616

@@ -25,7 +25,7 @@ runs:
2525
- name: tox tests for python 3.7
2626
shell: bash
2727
if: ${{inputs.python-version == '3.7'}}
28-
run: tox -e django22-drf38,django22-drf39,django22-drf310,django22-drf311,django22-drf312,django22-drf313,django32-drf311,django32-drf312,django32-drf313
28+
run: tox -e py37-django22-drf38,py37-django22-drf39,py37-django22-drf310,py37-django22-drf311,py37-django22-drf312,py37-django22-drf313,py37-django32-drf311,py37-django32-drf312,py37-django32-drf313
2929

3030
- name: tox tests for python >= 3.8
3131
shell: bash

.github/workflows/continuous_integration.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Check out repository
9-
uses: actions/checkout@v2
9+
uses: actions/checkout@v3
1010

1111
- uses: ./.github/actions/lint
1212

1313
test:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.7", "3.8", "3.9", "3.10"]
17+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1818
fail-fast: false
1919
steps:
2020
- name: Check out repository
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222

2323
- uses: ./.github/actions/tests
2424
with:

.github/workflows/release.yml

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,16 @@ name: Release
22

33
on:
44
release:
5-
types: [created]
5+
types:
6+
- created
67

78
jobs:
8-
lint:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- name: Check out repository
12-
uses: actions/checkout@v2
13-
14-
- uses: ./.github/actions/lint
15-
16-
test:
17-
runs-on: ubuntu-latest
18-
strategy:
19-
matrix:
20-
python-version: ["3.7", "3.8", "3.9", "3.10"]
21-
fail-fast: false
22-
steps:
23-
- name: Check out repository
24-
uses: actions/checkout@v2
25-
26-
- uses: ./.github/actions/tests
27-
with:
28-
python-version: ${{ matrix.python-version }}
29-
309
publish:
31-
needs: [test, lint]
3210
runs-on: ubuntu-latest
3311
steps:
3412
- name: Check out repository
35-
uses: actions/checkout@v2
36-
13+
uses: actions/checkout@v3
3714
- name: Build and publish
38-
uses: d1618033/gh-action-python-publish-using-poetry@0.1.1
15+
uses: JRubics/poetry-publish@v1.16
3916
with:
40-
pypi_username: '__token__'
41-
pypi_password: ${{ secrets.PYPI_TOKEN }}
17+
pypi_token: ${{ secrets.PYPI_TOKEN }}

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ repos:
1111
- id: black
1212

1313
- repo: https://github.com/PyCQA/flake8
14-
rev: 5.0.4
14+
rev: 6.0.0
1515
hooks:
1616
- id: flake8
1717
additional_dependencies: [flake8-bugbear]
1818

1919
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v4.2.0
20+
rev: v4.4.0
2121
hooks:
2222
- id: check-added-large-files
2323
- id: check-ast

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ updating.
2020
**[Breaking changes]** - There are changes that break existing compatibility.
2121

2222
---
23+
# 1.3.0
24+
**[Dropped support]**
25+
26+
**[Added support]**
27+
- Added support for Python 3.11
28+
- Added support for Django 4.1 and Django 4.2
29+
- Added HTTP_AUTHORIZATION header when generating encoded key for extra security. (Submitted by Artem)
30+
2331
# 1.2.0
2432
**[Dropped support]**
2533

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bundle: static_analysis coverage
3535
poetry build
3636

3737
release-test:
38-
poetry run twine upload --repository-url https://test.pypi.org/legacy/ dist/django-idempotency-key-1.2.0.tar.gz
38+
poetry run twine upload --repository-url https://test.pypi.org/legacy/ dist/django_idempotency_key-1.3.0.tar.gz
3939

4040
release: static_analysis coverage
4141
poetry run twine upload dist/*

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ nothing new is created.
2121

2222
Django idempotency key requires the following:
2323

24-
Python (3.7, 3.8, 3.9, 3.10)
24+
Python (3.7 to 3.11)
2525

26-
Django (2.2, 3.2, 4.0)
26+
Django (2.2, 3.2, 4.0, 4.1, 4.2)
2727

28-
NOTE: M1 Apple laptops are yet to be tested but are expected to work with this library.
28+
The following is a list of Django versions and the respective
29+
DjangoRestFramework and python versions that it supports.
2930

30-
The following is a list of DjangoRestFramework versions and the respective
31-
Django and python versions that it supports.
32-
33-
Python | Django | DRF
34-
--- | --- | ---
35-
\>=3.7 | 2.2 | \>=3.8
36-
\>=3.7 | 3.2 | \>=3.11
37-
\>=3.8 | 4.0 | \>=3.13
31+
Python | Django | DRF
32+
--------|--------|--------
33+
\>=3.7 | 2.2 | \>=3.8
34+
\>=3.7 | 3.2 | \>=3.11
35+
\>=3.8 | 4.0 | \>=3.13
36+
\>=3.8 | 4.1 | \>=3.14
37+
\>=3.8 | 4.2 | \>=3.14
3838

3939
## Installation
4040

@@ -58,8 +58,8 @@ MIDDLEWARE = [
5858
non-safe HTTP methods to supply an idempotency key specified in the request header
5959
under HTTP_IDEMPOTENCY_KEY. If this is missing then a 400 BAD REQUEST is returned.
6060

61-
However, if you prefer that all view functions are exempt by default and you will
62-
out-in on a per view function basis then use the following:
61+
However, if you prefer that all view functions are exempt by default, and you will
62+
opt in on a per view function basis then use the following:
6363

6464
```
6565
MIDDLEWARE = [

idempotency_key/decorators.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from idempotency_key import utils
44

55
# NOTE:
6-
# The following decorators must be specified BEFORE the @api_view decorator or the function will not be marked
7-
# correctly.
6+
# The following decorators must be specified BEFORE the @api_view decorator or the
7+
# function will not be marked correctly.
88
#
99
# i.e:
1010
#
@@ -16,17 +16,20 @@
1616

1717
def idempotency_key(*args, optional=False, cache_name=None):
1818
"""
19-
Allows an optional cache name to be specified so that different cache settings can be used on a per-view function
20-
basis.
21-
:param args: optional arguments. This can contain the view function object if cache_name is not specified
19+
Allows an optional cache name to be specified so that different cache settings can
20+
be used on a per-view function basis.
21+
:param args: optional arguments. This can contain the view function object if
22+
cache_name is not specified
2223
:param optional: Mark idempotency key header as optional
23-
:param cache_name: The name of the cache to use from the settings file under CACHES={...}
24+
:param cache_name: The name of the cache to use from the settings file under
25+
CACHES={...}
2426
:return: wrapped function
2527
"""
2628

2729
def _idempotency_key(view_func):
2830
"""
29-
Mark a view function as requiring idempotency key protection but the view should control the response.
31+
Mark a view function as requiring idempotency key protection but the view
32+
should control the response.
3033
"""
3134

3235
@wraps(view_func)
@@ -42,8 +45,8 @@ def wrapped_view(*args, **kwargs):
4245

4346
return wrapped_view
4447

45-
# if there is an argument passed and it is a callable then this will be the view function object so pass it to
46-
# the wrapper
48+
# if there is an argument passed and it is a callable then this will be the view
49+
# function object so pass it to the wrapper
4750
if len(args) > 0 and callable(args[0]):
4851
return _idempotency_key(args[0])
4952

@@ -65,7 +68,8 @@ def wrapped_view(*args, **kwargs):
6568

6669
def idempotency_key_manual(view_func):
6770
"""
68-
Mark a view function as requiring idempotency key protection but the view should control the response.
71+
Mark a view function as requiring idempotency key protection but the view should
72+
control the response.
6973
"""
7074

7175
def wrapped_view(*args, **kwargs):

0 commit comments

Comments
 (0)