Skip to content

Commit 5ad4dc2

Browse files
committed
Update supported Python and Django versions
Supported Django versions: 4.2, 5.1, 5.2 See: https://endoflife.date/django Supported Python versions: 3.9, 3.10, 3.11, 3.12, 3.13 Note, Django 4.2 originally supported Python 3.8, but 3.8 is now EOL. See: https://endoflife.date/python
1 parent 206d1e8 commit 5ad4dc2

File tree

8 files changed

+57
-58
lines changed

8 files changed

+57
-58
lines changed

.github/workflows/tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ['3.8', '3.9', '3.10', '3.11']
14+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1515

1616
env:
1717
AWS_ACCESS_KEY_ID: minioadmin

minio_storage/policy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def bucket(
1818
@T.overload
1919
def bucket(
2020
self, bucket_name: str, *, json_encode: T.Literal[False]
21-
) -> T.Dict[str, T.Any]: ...
21+
) -> dict[str, T.Any]: ...
2222

2323
def bucket(
2424
self, bucket_name: str, *, json_encode: bool = True
25-
) -> T.Union[str, T.Dict[str, T.Any]]:
25+
) -> T.Union[str, dict[str, T.Any]]:
2626
policies = {
2727
Policy.get: _get,
2828
Policy.read: _read,
@@ -36,11 +36,11 @@ def bucket(
3636
return pol
3737

3838

39-
def _none(bucket_name: str) -> T.Dict[str, T.Any]:
39+
def _none(bucket_name: str) -> dict[str, T.Any]:
4040
return {"Version": "2012-10-17", "Statement": []}
4141

4242

43-
def _get(bucket_name: str) -> T.Dict[str, T.Any]:
43+
def _get(bucket_name: str) -> dict[str, T.Any]:
4444
return {
4545
"Version": "2012-10-17",
4646
"Statement": [
@@ -54,7 +54,7 @@ def _get(bucket_name: str) -> T.Dict[str, T.Any]:
5454
}
5555

5656

57-
def _read(bucket_name: str) -> T.Dict[str, T.Any]:
57+
def _read(bucket_name: str) -> dict[str, T.Any]:
5858
return {
5959
"Version": "2012-10-17",
6060
"Statement": [
@@ -80,7 +80,7 @@ def _read(bucket_name: str) -> T.Dict[str, T.Any]:
8080
}
8181

8282

83-
def _write(bucket_name: str) -> T.Dict[str, T.Any]:
83+
def _write(bucket_name: str) -> dict[str, T.Any]:
8484
return {
8585
"Version": "2012-10-17",
8686
"Statement": [
@@ -111,7 +111,7 @@ def _write(bucket_name: str) -> T.Dict[str, T.Any]:
111111
}
112112

113113

114-
def _read_write(bucket_name: str) -> T.Dict[str, T.Any]:
114+
def _read_write(bucket_name: str) -> dict[str, T.Any]:
115115
return {
116116
"Version": "2012-10-17",
117117
"Statement": [

minio_storage/storage.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
logger = getLogger("minio_storage")
2222

23-
ObjectMetadataType = T.Mapping[str, T.Union[str, T.List[str], T.Tuple[str]]]
23+
ObjectMetadataType = T.Mapping[str, T.Union[str, list[str], tuple[str]]]
2424

2525

2626
@deconstructible
@@ -40,7 +40,7 @@ def __init__(
4040
bucket_name: str,
4141
*,
4242
base_url: T.Optional[str] = None,
43-
file_class: T.Optional[T.Type[MinioStorageFile]] = None,
43+
file_class: T.Optional[type[MinioStorageFile]] = None,
4444
auto_create_bucket: bool = False,
4545
presign_urls: bool = False,
4646
auto_create_policy: bool = False,
@@ -224,7 +224,7 @@ def exists(self, name: str) -> bool:
224224
logger.error(error)
225225
return False
226226

227-
def listdir(self, path: str) -> T.Tuple[T.List, T.List]:
227+
def listdir(self, path: str) -> tuple[list, list]:
228228
# [None, "", "."] is supported to mean the configured root among various
229229
# implementations of Storage implementations so we copy that behaviour even if
230230
# maybe None should raise an exception instead.
@@ -239,8 +239,8 @@ def listdir(self, path: str) -> T.Tuple[T.List, T.List]:
239239
if not path.endswith("/"):
240240
path += "/"
241241

242-
dirs: T.List[str] = []
243-
files: T.List[str] = []
242+
dirs: list[str] = []
243+
files: list[str] = []
244244
try:
245245
objects = self.client.list_objects(self.bucket_name, prefix=path)
246246
for o in objects:
@@ -417,7 +417,7 @@ def __init__( # noqa: C901
417417
minio_client: T.Optional[minio.Minio] = None,
418418
bucket_name: T.Optional[str] = None,
419419
base_url: T.Optional[str] = None,
420-
file_class: T.Optional[T.Type[MinioStorageFile]] = None,
420+
file_class: T.Optional[type[MinioStorageFile]] = None,
421421
auto_create_bucket: T.Optional[bool] = None,
422422
presign_urls: T.Optional[bool] = None,
423423
auto_create_policy: T.Optional[bool] = None,
@@ -495,7 +495,7 @@ def __init__(
495495
minio_client: T.Optional[minio.Minio] = None,
496496
bucket_name: T.Optional[str] = None,
497497
base_url: T.Optional[str] = None,
498-
file_class: T.Optional[T.Type[MinioStorageFile]] = None,
498+
file_class: T.Optional[type[MinioStorageFile]] = None,
499499
auto_create_bucket: T.Optional[bool] = None,
500500
presign_urls: T.Optional[bool] = None,
501501
auto_create_policy: T.Optional[bool] = None,

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "django-minio-storage"
33
description = "Django file storage using the minio python client"
44
license = {file = "LICENSE"}
5-
requires-python = ">=3.8"
5+
requires-python = ">=3.9"
66
dependencies = [
7-
"django>=3.2",
7+
"django>=4.2",
88
"minio>=7.1.16",
99
]
1010
classifiers=[
@@ -41,7 +41,7 @@ write_to_template = '__version__ = "{version}"'
4141
tag_regex = "^v(?P<prefix>v)?(?P<version>[^\\+]+)(?P<suffix>.*)?$"
4242

4343
[tool.ruff]
44-
target-version = "py38"
44+
target-version = "py39"
4545
line-length = 88
4646

4747
[tool.ruff.lint]

pyrightconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"reportUnboundVariable": "error",
1414
"reportOptionalMemberAccess": "error",
1515
"reportOptionalIterable": "error",
16-
"pythonVersion": "3.8",
16+
"pythonVersion": "3.9",
1717
"pythonPlatform": "Linux"
1818
}

tests/test_app/tests/custom_storage_class_tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ def test_custom_storage(self):
9191
# use the with statement to ensure that both the input stream and output
9292
# files are closed after the copying is done.
9393
#
94-
with open(filename, "wb") as out_file, storage.open(
95-
storage_filename
96-
) as storage_file:
94+
with (
95+
open(filename, "wb") as out_file,
96+
storage.open(storage_filename) as storage_file,
97+
):
9798
# Copy the stream from the http stream to the out_file
9899
#
99100
assert storage_file.file

tests/test_app/tests/managementcommand_tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import typing as T
21
from io import StringIO
32

43
import minio
@@ -87,7 +86,7 @@ def ls_test(*args, expected):
8786
lines = out.read().splitlines()
8887
self.assertEqual(sorted(lines), sorted(expected))
8988

90-
test_data: T.List[T.Tuple[T.List[str], T.List[str]]] = [
89+
test_data: list[tuple[list[str], list[str]]] = [
9190
(
9291
["-r"],
9392
#

tox.ini

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
[tox]
22
envlist =
3-
{py38,py39,py310,py311}-django42-minioknown
4-
py311-django{32,42}-minioknown
5-
py311-django42-minio
6-
lint
7-
docs
8-
pyright
3+
# All Pythons, oldest Django
4+
{py39,py310,py311,py312,py313}-django42-minioknown
5+
# Newest Python, all Djangos
6+
py313-django{42,51,52}-minioknown
7+
# Newest PYthon, newest Django, newest Minio
8+
py313-django52-minio
9+
lint
10+
docs
11+
pyright
912

1013
[gh-actions]
1114
python =
12-
3.8: py38
13-
3.9: py39
14-
3.10: py310
15-
3.11: py311, lint, docs, pyright
15+
3.9: py39
16+
3.10: py310
17+
3.11: py311
18+
3.12: py312
19+
3.13: py313, lint, docs, pyright
1620

1721
[pytest]
1822
pythonpath = . tests
@@ -24,47 +28,44 @@ django_find_project = false
2428
[testenv]
2529
commands = pytest {posargs}
2630
setenv =
27-
PYTHONDONTWRITEBYTECODE=1
28-
MINIO_STORAGE_ENDPOINT={env:MINIO_STORAGE_ENDPOINT:localhost:9153}
29-
MINIO_STORAGE_ACCESS_KEY={env:MINIO_STORAGE_ACCESS_KEY:weak_access_key}
30-
MINIO_STORAGE_SECRET_KEY={env:MINIO_STORAGE_SECRET_KEY:weak_secret_key}
31-
TOX_ENVNAME={envname}
31+
PYTHONDONTWRITEBYTECODE=1
32+
MINIO_STORAGE_ENDPOINT={env:MINIO_STORAGE_ENDPOINT:localhost:9153}
33+
MINIO_STORAGE_ACCESS_KEY={env:MINIO_STORAGE_ACCESS_KEY:weak_access_key}
34+
MINIO_STORAGE_SECRET_KEY={env:MINIO_STORAGE_SECRET_KEY:weak_secret_key}
35+
TOX_ENVNAME={envname}
3236
deps =
33-
django32: Django==3.2.*
34-
django42: Django==4.2.*
35-
minio: minio
36-
minioknown: minio==7.1.12
37-
-rdev-requirements.txt
37+
django42: Django==4.2.*
38+
django51: Django==5.1.*
39+
django52: Django==5.2.*
40+
minio: minio
41+
minioknown: minio==7.1.12
42+
-rdev-requirements.txt
3843

39-
[testenv:py311-django42-minioknown]
44+
[testenv:py313-django52-minioknown]
4045
commands = pytest --cov --cov-append --cov-report=term-missing {posargs}
4146

4247
[testenv:coverage-report]
43-
basepython = python3.11
4448
deps = coverage[toml]
4549
skip_install = true
4650
commands =
4751
coverage report
4852
coverage html
49-
depends=py311-django42-minioknown
53+
depends=py313-django52-minioknown
5054

5155
[testenv:pyright]
52-
basepython = python3
5356
deps =
54-
pyright
55-
minio
56-
django-stubs==4.2.*
57-
Django==4.2.*
58-
types-requests
59-
-rdev-requirements.txt
57+
pyright
58+
minio
59+
django-stubs==4.2.*
60+
Django==4.2.*
61+
types-requests
62+
-rdev-requirements.txt
6063
commands =
6164
pyright --level WARNING
6265

63-
6466
[testenv:lint]
6567
setenv=
6668
PYTHONWARNINGS=ignore
67-
basepython = python3
6869
deps =
6970
ruff==0.11.8
7071
commands =
@@ -74,14 +75,12 @@ commands =
7475
[testenv:fmt]
7576
setenv=
7677
PYTHONWARNINGS=ignore
77-
basepython = python3
7878
deps =
7979
ruff==0.11.8
8080
commands =
8181
ruff check --fix-only
8282
ruff format
8383

8484
[testenv:docs]
85-
basepython = python3
8685
deps = mkdocs
8786
commands = mkdocs build

0 commit comments

Comments
 (0)