Skip to content

Commit 99cdda2

Browse files
authored
Drop support for python 3.8 (#444)
Drops support for python 3.8 since it is EOL. The code refactoring is due to ruff's formatting rules for 3.9.
1 parent 8218e8c commit 99cdda2

15 files changed

+33
-21
lines changed

.github/workflows/check.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
- "3.11"
2727
- "3.10"
2828
- "3.9"
29-
- "3.8"
3029
- type
3130
- dev
3231
- pkg_meta

pyproject.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ maintainers = [
2121
{ name = "Bernát Gábor", email = "[email protected]" },
2222
{ name = "Vineet Naik", email = "[email protected]" },
2323
]
24-
requires-python = ">=3.8"
24+
requires-python = ">=3.9"
2525
classifiers = [
2626
"Development Status :: 5 - Production/Stable",
2727
"Environment :: Console",
@@ -30,7 +30,6 @@ classifiers = [
3030
"Operating System :: OS Independent",
3131
"Programming Language :: Python",
3232
"Programming Language :: Python :: 3 :: Only",
33-
"Programming Language :: Python :: 3.8",
3433
"Programming Language :: Python :: 3.9",
3534
"Programming Language :: Python :: 3.10",
3635
"Programming Language :: Python :: 3.11",
@@ -68,7 +67,6 @@ build.hooks.vcs.version-file = "src/pipdeptree/version.py"
6867
version.source = "vcs"
6968

7069
[tool.ruff]
71-
target-version = "py38"
7270
line-length = 120
7371
format.preview = true
7472
format.docstring-code-line-length = 100

src/pipdeptree/__main__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import sys
6-
from typing import Sequence
6+
from typing import TYPE_CHECKING
77

88
from pipdeptree._cli import get_options
99
from pipdeptree._detect_env import detect_active_interpreter
@@ -13,6 +13,9 @@
1313
from pipdeptree._validate import validate
1414
from pipdeptree._warning import WarningPrinter, WarningType, get_warning_printer
1515

16+
if TYPE_CHECKING:
17+
from collections.abc import Sequence
18+
1619

1720
def main(args: Sequence[str] | None = None) -> int | None:
1821
"""CLI - The main function called as entry point."""

src/pipdeptree/_cli.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
import enum
44
import sys
55
from argparse import Action, ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
6-
from typing import Any, Sequence, cast
6+
from typing import TYPE_CHECKING, Any, cast
77

88
from pipdeptree._warning import WarningType
99

1010
from .version import __version__
1111

12+
if TYPE_CHECKING:
13+
from collections.abc import Sequence
14+
1215

1316
class Options(Namespace):
1417
freeze: bool

src/pipdeptree/_discovery.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
import sys
77
from importlib.metadata import Distribution, distributions
88
from pathlib import Path
9-
from typing import Iterable, Tuple
9+
from typing import TYPE_CHECKING
1010

1111
from packaging.utils import canonicalize_name
1212

1313
from pipdeptree._warning import get_warning_printer
1414

15+
if TYPE_CHECKING:
16+
from collections.abc import Iterable
17+
1518

1619
def get_installed_distributions(
1720
interpreter: str = str(sys.executable),
@@ -103,7 +106,7 @@ def render_invalid_metadata_text(site_dirs_with_invalid_metadata: set[str]) -> N
103106
print(site_dir, file=sys.stderr) # noqa: T201
104107

105108

106-
FirstSeenWithDistsPair = Tuple[Distribution, Distribution]
109+
FirstSeenWithDistsPair = tuple[Distribution, Distribution]
107110

108111

109112
def render_duplicated_dist_metadata_text(

src/pipdeptree/_models/dag.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import sys
44
from collections import defaultdict, deque
5+
from collections.abc import Iterator, Mapping
56
from fnmatch import fnmatch
67
from itertools import chain
7-
from typing import TYPE_CHECKING, Iterator, List, Mapping
8+
from typing import TYPE_CHECKING
89

910
from packaging.utils import canonicalize_name
1011

@@ -25,7 +26,7 @@ def render_invalid_reqs_text(dist_name_to_invalid_reqs_dict: dict[str, list[str]
2526
print(f' Skipping "{invalid_req}"', file=sys.stderr) # noqa: T201
2627

2728

28-
class PackageDAG(Mapping[DistPackage, List[ReqPackage]]):
29+
class PackageDAG(Mapping[DistPackage, list[ReqPackage]]):
2930
"""
3031
Representation of Package dependencies as directed acyclic graph using a dict as the underlying datastructure.
3132

src/pipdeptree/_models/package.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
from importlib import import_module
55
from importlib.metadata import Distribution, PackageNotFoundError, metadata, version
66
from inspect import ismodule
7-
from typing import TYPE_CHECKING, Iterator
7+
from typing import TYPE_CHECKING
88

99
from packaging.requirements import InvalidRequirement, Requirement
1010
from packaging.utils import canonicalize_name
1111

1212
from pipdeptree._freeze import dist_to_frozen_repr
1313

1414
if TYPE_CHECKING:
15+
from collections.abc import Iterator
1516
from importlib.metadata import Distribution
1617

1718

tests/_models/test_dag.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from __future__ import annotations
22

33
from itertools import chain
4-
from typing import TYPE_CHECKING, Any, Callable, Iterator
4+
from typing import TYPE_CHECKING, Any, Callable
55

66
import pytest
77

88
from pipdeptree._models import DistPackage, PackageDAG, ReqPackage, ReversedPackageDAG
99

1010
if TYPE_CHECKING:
11+
from collections.abc import Iterator
1112
from unittest.mock import Mock
1213

1314
from tests.our_types import MockGraph

tests/conftest.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import locale
44
from pathlib import Path
55
from random import shuffle
6-
from typing import TYPE_CHECKING, Callable, Iterator
6+
from typing import TYPE_CHECKING, Callable
77
from unittest.mock import Mock
88

99
import pytest
1010

1111
from pipdeptree._models import PackageDAG
1212

1313
if TYPE_CHECKING:
14+
from collections.abc import Iterator
15+
1416
from tests.our_types import MockGraph
1517

1618

tests/our_types.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Dict, List, Tuple
4-
5-
MockGraph = Dict[Tuple[str, str], List[Tuple[str, List[Tuple[str, str]]]]]
3+
MockGraph = dict[tuple[str, str], list[tuple[str, list[tuple[str, str]]]]] # pragma: no cover
64

75
__all__ = [
86
"MockGraph",

tests/render/test_json_tree.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Callable, Iterator
3+
from typing import TYPE_CHECKING, Callable
44

55
import pytest
66

77
from pipdeptree._models.dag import PackageDAG
88
from pipdeptree._render.json_tree import render_json_tree
99

1010
if TYPE_CHECKING:
11+
from collections.abc import Iterator
1112
from unittest.mock import Mock
1213

1314
from tests.our_types import MockGraph

tests/render/test_mermaid.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from __future__ import annotations
22

33
from textwrap import dedent, indent
4-
from typing import TYPE_CHECKING, Callable, Iterator
4+
from typing import TYPE_CHECKING, Callable
55

66
from pipdeptree._models import PackageDAG
77
from pipdeptree._render.mermaid import render_mermaid
88

99
if TYPE_CHECKING:
10+
from collections.abc import Iterator
1011
from unittest.mock import Mock
1112

1213
from tests.our_types import MockGraph

tests/render/test_text.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Callable, Iterator
3+
from typing import TYPE_CHECKING, Callable
44

55
import pytest
66

@@ -9,6 +9,7 @@
99
from pipdeptree._render.text import render_text
1010

1111
if TYPE_CHECKING:
12+
from collections.abc import Iterator
1213
from unittest.mock import Mock
1314

1415
from tests.our_types import MockGraph

tests/test_validate.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Callable, Iterator
3+
from typing import TYPE_CHECKING, Callable
44

55
import pytest
66

77
from pipdeptree._models import PackageDAG
88
from pipdeptree._validate import conflicting_deps, cyclic_deps, render_conflicts_text, render_cycles_text, validate
99

1010
if TYPE_CHECKING:
11+
from collections.abc import Iterator
1112
from unittest.mock import Mock
1213

1314
from tests.our_types import MockGraph

tox.toml

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ env_list = [
66
"3.11",
77
"3.10",
88
"3.9",
9-
"3.8",
109
"type",
1110
"pkg_meta",
1211
]

0 commit comments

Comments
 (0)