Skip to content

Commit 7d5aadb

Browse files
authored
feat!: drop Python 3.9 support (#1328)
* feat!: drop support for Python 3.9 * refactor: remove obsolete stdlib behaviour * refactor: remove obsolete script to generate stdlibs * test: require Python `>=3.10`
1 parent b650466 commit 7d5aadb

File tree

32 files changed

+405
-1660
lines changed

32 files changed

+405
-1660
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ jobs:
7070
- name: windows
7171
image: windows-2025
7272
python-version:
73-
- '3.9'
7473
- '3.10'
7574
- '3.11'
7675
- '3.12'

pyproject.toml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.1"
44
description = "A command line utility to check for unused, missing and transitive dependencies in a Python project."
55
authors = [{ name = "Florian Maas", email = "[email protected]" }]
66
maintainers = [{ name = "Mathieu Kniewallner", email = "[email protected]" }]
7-
requires-python = ">=3.9"
7+
requires-python = ">=3.10"
88
license = { file = "LICENSE" }
99
readme = "README.md"
1010
classifiers = [
@@ -14,7 +14,6 @@ classifiers = [
1414
"Topic :: Software Development :: Libraries :: Python Modules",
1515
"Topic :: Software Development :: Quality Assurance",
1616
"Programming Language :: Python",
17-
"Programming Language :: Python :: 3.9",
1817
"Programming Language :: Python :: 3.10",
1918
"Programming Language :: Python :: 3.11",
2019
"Programming Language :: Python :: 3.12",
@@ -103,7 +102,7 @@ source = ["python/deptry"]
103102

104103
[tool.mypy]
105104
mypy_path = "python"
106-
files = ["python/deptry", "scripts", "tests"]
105+
files = ["python/deptry", "tests"]
107106
explicit_package_bases = true
108107
exclude = ["tests/fixtures"]
109108
disallow_any_unimported = true
@@ -123,11 +122,7 @@ module = ["xdist.*"]
123122
ignore_missing_imports = true
124123

125124
[tool.deptry]
126-
extend_exclude = [
127-
"docs",
128-
"tests",
129-
"scripts",
130-
]
125+
extend_exclude = ["docs", "tests"]
131126

132127
[tool.deptry.per_rule_ignores]
133128
DEP001 = ["tomllib"]

python/deptry/core.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
from typing import TYPE_CHECKING
88

99
from deptry.dependency_getter.builder import DependencyGetterBuilder
10-
from deptry.exceptions import UnsupportedPythonVersionError
1110
from deptry.imports.extract import get_imported_modules_from_list_of_files
1211
from deptry.module import ModuleBuilder, ModuleLocations
1312
from deptry.python_file_finder import get_all_python_files_in
1413
from deptry.reporters import JSONReporter, TextReporter
15-
from deptry.stdlibs import STDLIBS_PYTHON
1614
from deptry.violations.finder import find_violations
1715

1816
if TYPE_CHECKING:
@@ -139,13 +137,7 @@ def _directory_has_python_files(self, path: Path) -> bool:
139137

140138
@staticmethod
141139
def _get_standard_library_modules() -> frozenset[str]:
142-
if sys.version_info[:2] >= (3, 10):
143-
return sys.stdlib_module_names
144-
145-
try: # type: ignore[unreachable, unused-ignore]
146-
return STDLIBS_PYTHON[f"{sys.version_info[0]}{sys.version_info[1]}"]
147-
except KeyError as e:
148-
raise UnsupportedPythonVersionError((sys.version_info[0], sys.version_info[1])) from e
140+
return sys.stdlib_module_names
149141

150142
def _log_config(self) -> None:
151143
logging.debug("Running with the following configuration:")

python/deptry/exceptions.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ def __init__(self, directory: Path) -> None:
2121
super().__init__(f"No file `pyproject.toml` found in directory {directory}")
2222

2323

24-
class UnsupportedPythonVersionError(ValueError):
25-
def __init__(self, version: tuple[int, int]) -> None:
26-
super().__init__(
27-
f"Python version {version[0]}.{version[1]} is not supported. Only versions >= 3.9 are supported."
28-
)
29-
30-
3124
class InvalidPyprojectTOMLOptionsError(UsageError):
3225
def __init__(self, invalid_options: list[str]) -> None:
3326
super().__init__(

python/deptry/stdlibs.py

Lines changed: 0 additions & 229 deletions
This file was deleted.

0 commit comments

Comments
 (0)