Skip to content

Commit ee03ec4

Browse files
committed
Drop support for 3.8, which is near EOL.
1 parent 076df8f commit ee03ec4

File tree

9 files changed

+22
-41
lines changed

9 files changed

+22
-41
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ jobs:
8282
uses: actions/setup-python@v5
8383
with:
8484
python-version: |
85-
3.8
8685
3.9
8786
3.10
8887
3.11

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v4.24.0
2+
=======
3+
4+
* Support for Python 3.8 has been dropped, as it is nearing end-of-life.
5+
16
v4.23.0
27
=======
38

jsonschema/_format.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
_FormatCheckCallable = typing.Callable[[object], bool]
1414
#: A format checker callable.
1515
_F = typing.TypeVar("_F", bound=_FormatCheckCallable)
16-
_RaisesType = typing.Union[
17-
typing.Type[Exception], typing.Tuple[typing.Type[Exception], ...],
18-
]
16+
_RaisesType = typing.Union[type[Exception], tuple[type[Exception], ...]]
1917

2018
_RE_DATE = re.compile(r"^\d{4}-\d{2}-\d{2}$", re.ASCII)
2119

jsonschema/_types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
from __future__ import annotations
22

3-
from typing import Any, Callable, Mapping
3+
from typing import TYPE_CHECKING
44
import numbers
55

66
from attrs import evolve, field, frozen
77
from rpds import HashTrieMap
88

99
from jsonschema.exceptions import UndefinedTypeCheck
1010

11+
if TYPE_CHECKING:
12+
from collections.abc import Mapping
13+
from typing import Any, Callable
14+
1115

1216
# unfortunately, the type of HashTrieMap is generic, and if used as an attrs
1317
# converter, the generic type is presented to mypy, which then fails to match

jsonschema/_typing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""
22
Some (initially private) typing helpers for jsonschema's types.
33
"""
4-
from typing import Any, Callable, Iterable, Protocol, Tuple, Union
4+
from collections.abc import Iterable
5+
from typing import Any, Callable, Protocol, Union
56

67
import referencing.jsonschema
78

@@ -24,5 +25,5 @@ def __call__(
2425

2526
ApplicableValidators = Callable[
2627
[referencing.jsonschema.Schema],
27-
Iterable[Tuple[str, Any]],
28+
Iterable[tuple[str, Any]],
2829
]

jsonschema/protocols.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,14 @@
77

88
from __future__ import annotations
99

10-
from typing import (
11-
TYPE_CHECKING,
12-
Any,
13-
ClassVar,
14-
Iterable,
15-
Protocol,
16-
runtime_checkable,
17-
)
10+
from typing import TYPE_CHECKING, ClassVar, Protocol, runtime_checkable
1811

1912
# in order for Sphinx to resolve references accurately from type annotations,
2013
# it needs to see names like `jsonschema.TypeChecker`
2114
# therefore, only import at type-checking time (to avoid circular references),
2215
# but use `jsonschema` for any types which will otherwise not be resolvable
2316
if TYPE_CHECKING:
24-
from collections.abc import Mapping
17+
from collections.abc import Any, Iterable, Mapping
2518

2619
import referencing.jsonschema
2720

jsonschema/tests/test_jsonschema_test_suite.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
See https://github.com/json-schema-org/JSON-Schema-Test-Suite for details.
77
"""
88

9-
import sys
109

1110
from jsonschema.tests._suite import Suite
1211
import jsonschema
@@ -66,18 +65,6 @@ def complex_email_validation(test):
6665
)(test)
6766

6867

69-
if sys.version_info < (3, 9): # pragma: no cover
70-
message = "Rejecting leading zeros is 3.9+"
71-
allowed_leading_zeros = skip(
72-
message=message,
73-
subject="ipv4",
74-
description="invalid leading zeroes, as they are treated as octals",
75-
)
76-
else:
77-
def allowed_leading_zeros(test): # pragma: no cover
78-
return
79-
80-
8168
def leap_second(test):
8269
message = "Leap seconds are unsupported."
8370
return skip(
@@ -149,8 +136,7 @@ def leap_second(test):
149136
Validator=jsonschema.Draft4Validator,
150137
format_checker=jsonschema.Draft4Validator.FORMAT_CHECKER,
151138
skip=lambda test: (
152-
allowed_leading_zeros(test)
153-
or leap_second(test)
139+
leap_second(test)
154140
or missing_format(jsonschema.Draft4Validator)(test)
155141
or complex_email_validation(test)
156142
),
@@ -167,8 +153,7 @@ def leap_second(test):
167153
Validator=jsonschema.Draft6Validator,
168154
format_checker=jsonschema.Draft6Validator.FORMAT_CHECKER,
169155
skip=lambda test: (
170-
allowed_leading_zeros(test)
171-
or leap_second(test)
156+
leap_second(test)
172157
or missing_format(jsonschema.Draft6Validator)(test)
173158
or complex_email_validation(test)
174159
),
@@ -187,8 +172,7 @@ def leap_second(test):
187172
Validator=jsonschema.Draft7Validator,
188173
format_checker=jsonschema.Draft7Validator.FORMAT_CHECKER,
189174
skip=lambda test: (
190-
allowed_leading_zeros(test)
191-
or leap_second(test)
175+
leap_second(test)
192176
or missing_format(jsonschema.Draft7Validator)(test)
193177
or complex_email_validation(test)
194178
),
@@ -224,7 +208,6 @@ def leap_second(test):
224208
format_checker=jsonschema.Draft201909Validator.FORMAT_CHECKER,
225209
skip=lambda test: (
226210
complex_email_validation(test)
227-
or allowed_leading_zeros(test)
228211
or leap_second(test)
229212
or missing_format(jsonschema.Draft201909Validator)(test)
230213
or complex_email_validation(test)
@@ -261,7 +244,6 @@ def leap_second(test):
261244
format_checker=jsonschema.Draft202012Validator.FORMAT_CHECKER,
262245
skip=lambda test: (
263246
complex_email_validation(test)
264-
or allowed_leading_zeros(test)
265247
or leap_second(test)
266248
or missing_format(jsonschema.Draft202012Validator)(test)
267249
or complex_email_validation(test)

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"The Unlicense (Unlicense)",
3636
]
3737

38-
SUPPORTED = ["3.8", "3.9", "3.10", "pypy3.10", "3.11", "3.12", "3.13"]
38+
SUPPORTED = ["3.9", "3.10", "pypy3.10", "3.11", "3.12", "3.13"]
3939
LATEST_STABLE = "3.12"
4040

4141
nox.options.sessions = []

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source = "vcs"
88
[project]
99
name = "jsonschema"
1010
description = "An implementation of JSON Schema validation for Python"
11-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1212
license = {text = "MIT"}
1313
keywords = [
1414
"validation",
@@ -26,7 +26,6 @@ classifiers = [
2626
"License :: OSI Approved :: MIT License",
2727
"Operating System :: OS Independent",
2828
"Programming Language :: Python",
29-
"Programming Language :: Python :: 3.8",
3029
"Programming Language :: Python :: 3.9",
3130
"Programming Language :: Python :: 3.10",
3231
"Programming Language :: Python :: 3.11",
@@ -198,7 +197,7 @@ ignore = [
198197
"SLF001", # Private usage within this package itself is fine
199198
"TD", # These TODO style rules are also silly
200199
"TRY003", # Some exception classes are essentially intended for free-form
201-
"UP007", # We support 3.8 + 3.9
200+
"UP007", # We support 3.9
202201
]
203202

204203
[tool.ruff.lint.flake8-pytest-style]

0 commit comments

Comments
 (0)