Skip to content

Commit e7b42de

Browse files
authored
feat: drop Python 3.8 (#1157)
1 parent 9bfe549 commit e7b42de

16 files changed

Lines changed: 58 additions & 44 deletions

.github/workflows/perf.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
name: Install Pythons
2626
with:
2727
python-version: |
28-
3.8
2928
3.9
3029
3.10
3130
3.11

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
matrix:
2525
os: [Ubuntu, Windows, macOS]
2626
python_version:
27-
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.13t", "3.14t", "pypy3.8", "pypy3.9", "pypy3.10", "pypy3.11"]
27+
["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.13t", "3.14t", "pypy3.9", "pypy3.10", "pypy3.11"]
2828
include:
2929
- os: Ubuntu
3030
python_version: "3.11.0"

asv.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
"PYTHONHASHSEED": ["0"]
1616
}
1717
},
18-
"pythons": ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
18+
"pythons": ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
1919
}

noxfile.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
import time
2121
import urllib.request
2222
from pathlib import Path
23-
from typing import IO, Generator
23+
from typing import IO, TYPE_CHECKING
2424

2525
import nox
2626

2727
import packaging.version # will always be present with nox
2828

29+
if TYPE_CHECKING:
30+
from collections.abc import Generator
31+
2932
nox.needs_version = ">=2025.02.09"
3033
nox.options.reuse_existing_virtualenvs = True
3134
nox.options.default_venv_backend = "uv|virtualenv"
@@ -39,7 +42,6 @@
3942
*PYTHON_VERSIONS,
4043
"3.13t",
4144
"3.14t",
42-
"pypy3.8",
4345
"pypy3.9",
4446
"pypy3.10",
4547
"pypy3.11",

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ description = "Core utilities for Python packages"
99
dynamic = ["version"]
1010
license = "Apache-2.0 OR BSD-2-Clause"
1111
readme = "README.rst"
12-
requires-python = ">=3.8"
12+
requires-python = ">=3.9"
1313
authors = [{name = "Donald Stufft", email = "donald@stufft.io"}]
1414
classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"Intended Audience :: Developers",
1717
"Programming Language :: Python",
1818
"Programming Language :: Python :: 3",
1919
"Programming Language :: Python :: 3 :: Only",
20-
"Programming Language :: Python :: 3.8",
2120
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",
2322
"Programming Language :: Python :: 3.11",
@@ -48,7 +47,6 @@ test = [
4847
]
4948
docs = [
5049
"furo",
51-
"typing-extensions>=4.1.0; python_version < '3.9'",
5250
]
5351
benchmark = [
5452
"asv",
@@ -111,7 +109,7 @@ markers = ["property: property-based tests (opt-in)"]
111109
strict = true
112110
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
113111
warn_unused_ignores = true
114-
python_version = "3.8"
112+
python_version = "3.9"
115113
files = ["src", "tests", "noxfile.py"]
116114

117115
[[tool.mypy.overrides]]

src/packaging/_manylinux.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
import re
88
import sys
99
import warnings
10-
from typing import Generator, Iterator, NamedTuple, Sequence
10+
from typing import TYPE_CHECKING, NamedTuple
1111

1212
from ._elffile import EIClass, EIData, ELFFile, EMachine
1313

14+
if TYPE_CHECKING:
15+
from collections.abc import Generator, Iterator, Sequence
16+
1417
EF_ARM_ABIMASK = 0xFF000000
1518
EF_ARM_ABI_VER5 = 0x05000000
1619
EF_ARM_ABI_FLOAT_HARD = 0x00000400

src/packaging/_musllinux.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
import re
1111
import subprocess
1212
import sys
13-
from typing import Iterator, NamedTuple, Sequence
13+
from typing import TYPE_CHECKING, NamedTuple
1414

1515
from ._elffile import ELFFile
1616

17+
if TYPE_CHECKING:
18+
from collections.abc import Iterator, Sequence
19+
1720

1821
class _MuslVersion(NamedTuple):
1922
major: int

src/packaging/_parser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from __future__ import annotations
88

99
import ast
10-
from typing import List, Literal, NamedTuple, Sequence, Tuple, Union
10+
from collections.abc import Sequence
11+
from typing import Literal, NamedTuple, Union
1112

1213
from ._tokenizer import DEFAULT_RULES, Tokenizer
1314

@@ -79,9 +80,9 @@ def serialize(self) -> str:
7980

8081
MarkerLogical = Literal["and", "or"]
8182
MarkerVar = Union[Variable, Value]
82-
MarkerItem = Tuple[MarkerVar, Op, MarkerVar]
83+
MarkerItem = tuple[MarkerVar, Op, MarkerVar]
8384
MarkerAtom = Union[MarkerItem, Sequence["MarkerAtom"]]
84-
MarkerList = List[Union["MarkerList", MarkerAtom, MarkerLogical]]
85+
MarkerList = list[Union["MarkerList", MarkerAtom, MarkerLogical]]
8586

8687

8788
class ParsedRequirement(NamedTuple):

src/packaging/_tokenizer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
import contextlib
44
import re
55
from dataclasses import dataclass
6-
from typing import Generator, Mapping, NoReturn
6+
from typing import TYPE_CHECKING, NoReturn
77

88
from .specifiers import Specifier
99

10+
if TYPE_CHECKING:
11+
from collections.abc import Generator, Mapping
12+
1013

1114
@dataclass
1215
class Token:

src/packaging/markers.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
import os
99
import platform
1010
import sys
11-
from typing import AbstractSet, Callable, Literal, Mapping, TypedDict, Union, cast
11+
from collections.abc import Set as AbstractSet
12+
from typing import TYPE_CHECKING, Callable, Literal, TypedDict, Union, cast
1213

1314
from ._parser import MarkerAtom, MarkerList, Op, Value, Variable
1415
from ._parser import parse_marker as _parse_marker
1516
from ._tokenizer import ParserSyntaxError
1617
from .specifiers import InvalidSpecifier, Specifier
1718
from .utils import canonicalize_name
1819

20+
if TYPE_CHECKING:
21+
from collections.abc import Mapping
22+
1923
__all__ = [
2024
"Environment",
2125
"EvaluateContext",
@@ -459,14 +463,15 @@ def evaluate(
459463
"dict[str, str | AbstractSet[str]]", default_environment()
460464
)
461465
if context == "lock_file":
462-
current_environment.update(
463-
extras=frozenset(), dependency_groups=frozenset()
464-
)
466+
current_environment |= {
467+
"extras": frozenset(),
468+
"dependency_groups": frozenset(),
469+
}
465470
elif context == "metadata":
466471
current_environment["extra"] = ""
467472

468473
if environment is not None:
469-
current_environment.update(environment)
474+
current_environment |= environment
470475
if "extra" in current_environment:
471476
# The API used to allow setting extra to None. We need to handle
472477
# this case for backwards compatibility. Also skip running

0 commit comments

Comments
 (0)