Skip to content

Commit

Permalink
Drop support for 3.8, which is near EOL.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Sep 11, 2024
1 parent 076df8f commit ee03ec4
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 41 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: |
3.8
3.9
3.10
3.11
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v4.24.0
=======

* Support for Python 3.8 has been dropped, as it is nearing end-of-life.

v4.23.0
=======

Expand Down
4 changes: 1 addition & 3 deletions jsonschema/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
_FormatCheckCallable = typing.Callable[[object], bool]
#: A format checker callable.
_F = typing.TypeVar("_F", bound=_FormatCheckCallable)
_RaisesType = typing.Union[
typing.Type[Exception], typing.Tuple[typing.Type[Exception], ...],
]
_RaisesType = typing.Union[type[Exception], tuple[type[Exception], ...]]

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

Expand Down
6 changes: 5 additions & 1 deletion jsonschema/_types.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from __future__ import annotations

from typing import Any, Callable, Mapping
from typing import TYPE_CHECKING
import numbers

from attrs import evolve, field, frozen
from rpds import HashTrieMap

from jsonschema.exceptions import UndefinedTypeCheck

if TYPE_CHECKING:
from collections.abc import Mapping
from typing import Any, Callable


# unfortunately, the type of HashTrieMap is generic, and if used as an attrs
# converter, the generic type is presented to mypy, which then fails to match
Expand Down
5 changes: 3 additions & 2 deletions jsonschema/_typing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""
Some (initially private) typing helpers for jsonschema's types.
"""
from typing import Any, Callable, Iterable, Protocol, Tuple, Union
from collections.abc import Iterable
from typing import Any, Callable, Protocol, Union

import referencing.jsonschema

Expand All @@ -24,5 +25,5 @@ def __call__(

ApplicableValidators = Callable[
[referencing.jsonschema.Schema],
Iterable[Tuple[str, Any]],
Iterable[tuple[str, Any]],
]
11 changes: 2 additions & 9 deletions jsonschema/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@

from __future__ import annotations

from typing import (
TYPE_CHECKING,
Any,
ClassVar,
Iterable,
Protocol,
runtime_checkable,
)
from typing import TYPE_CHECKING, ClassVar, Protocol, runtime_checkable

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

import referencing.jsonschema

Expand Down
24 changes: 3 additions & 21 deletions jsonschema/tests/test_jsonschema_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
See https://github.com/json-schema-org/JSON-Schema-Test-Suite for details.
"""

import sys

from jsonschema.tests._suite import Suite
import jsonschema
Expand Down Expand Up @@ -66,18 +65,6 @@ def complex_email_validation(test):
)(test)


if sys.version_info < (3, 9): # pragma: no cover
message = "Rejecting leading zeros is 3.9+"
allowed_leading_zeros = skip(
message=message,
subject="ipv4",
description="invalid leading zeroes, as they are treated as octals",
)
else:
def allowed_leading_zeros(test): # pragma: no cover
return


def leap_second(test):
message = "Leap seconds are unsupported."
return skip(
Expand Down Expand Up @@ -149,8 +136,7 @@ def leap_second(test):
Validator=jsonschema.Draft4Validator,
format_checker=jsonschema.Draft4Validator.FORMAT_CHECKER,
skip=lambda test: (
allowed_leading_zeros(test)
or leap_second(test)
leap_second(test)
or missing_format(jsonschema.Draft4Validator)(test)
or complex_email_validation(test)
),
Expand All @@ -167,8 +153,7 @@ def leap_second(test):
Validator=jsonschema.Draft6Validator,
format_checker=jsonschema.Draft6Validator.FORMAT_CHECKER,
skip=lambda test: (
allowed_leading_zeros(test)
or leap_second(test)
leap_second(test)
or missing_format(jsonschema.Draft6Validator)(test)
or complex_email_validation(test)
),
Expand All @@ -187,8 +172,7 @@ def leap_second(test):
Validator=jsonschema.Draft7Validator,
format_checker=jsonschema.Draft7Validator.FORMAT_CHECKER,
skip=lambda test: (
allowed_leading_zeros(test)
or leap_second(test)
leap_second(test)
or missing_format(jsonschema.Draft7Validator)(test)
or complex_email_validation(test)
),
Expand Down Expand Up @@ -224,7 +208,6 @@ def leap_second(test):
format_checker=jsonschema.Draft201909Validator.FORMAT_CHECKER,
skip=lambda test: (
complex_email_validation(test)
or allowed_leading_zeros(test)
or leap_second(test)
or missing_format(jsonschema.Draft201909Validator)(test)
or complex_email_validation(test)
Expand Down Expand Up @@ -261,7 +244,6 @@ def leap_second(test):
format_checker=jsonschema.Draft202012Validator.FORMAT_CHECKER,
skip=lambda test: (
complex_email_validation(test)
or allowed_leading_zeros(test)
or leap_second(test)
or missing_format(jsonschema.Draft202012Validator)(test)
or complex_email_validation(test)
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"The Unlicense (Unlicense)",
]

SUPPORTED = ["3.8", "3.9", "3.10", "pypy3.10", "3.11", "3.12", "3.13"]
SUPPORTED = ["3.9", "3.10", "pypy3.10", "3.11", "3.12", "3.13"]
LATEST_STABLE = "3.12"

nox.options.sessions = []
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source = "vcs"
[project]
name = "jsonschema"
description = "An implementation of JSON Schema validation for Python"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = {text = "MIT"}
keywords = [
"validation",
Expand All @@ -26,7 +26,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -198,7 +197,7 @@ ignore = [
"SLF001", # Private usage within this package itself is fine
"TD", # These TODO style rules are also silly
"TRY003", # Some exception classes are essentially intended for free-form
"UP007", # We support 3.8 + 3.9
"UP007", # We support 3.9
]

[tool.ruff.lint.flake8-pytest-style]
Expand Down

0 comments on commit ee03ec4

Please sign in to comment.