Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: drop Python 3.8 support #874

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
image: macos-14
- name: windows
image: windows-2022
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev', 'pypy3.10']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13-dev', 'pypy3.10']
fail-fast: false
runs-on: ${{ matrix.os.image }}
name: ${{ matrix.os.name }} (${{ matrix.python-version }})
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ encoding_rs = "=0.8.34"
ignore = "=0.4.23"
log = "=0.4.22"
path-slash = "=0.2.1"
pyo3 = { version = "=0.22.3", features = ["abi3-py38", "generate-import-lib"] }
pyo3 = { version = "=0.22.3", features = ["abi3-py39", "generate-import-lib"] }
pyo3-log = "=0.11.0"
rayon = "=1.10.0"
regex = "=1.10.6"
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.1"
description = "A command line utility to check for unused, missing and transitive dependencies in a Python project."
authors = [{ name = "Florian Maas", email = "[email protected]" }]
maintainers = [{ name = "Mathieu Kniewallner", email = "[email protected]" }]
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 3 - Alpha",
Expand All @@ -13,7 +13,6 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
"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
3 changes: 2 additions & 1 deletion python/deptry/dependency_getter/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Mapping
from typing import TYPE_CHECKING

from deptry.dependency_getter.pep621.base import PEP621DependencyGetter
from deptry.dependency_getter.pep621.pdm import PDMDependencyGetter
Expand All @@ -14,6 +14,7 @@
from deptry.utils import load_pyproject_toml

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

from deptry.dependency_getter.base import DependencyGetter
Expand Down
2 changes: 1 addition & 1 deletion python/deptry/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, directory: Path) -> None:
class UnsupportedPythonVersionError(ValueError):
def __init__(self, version: tuple[int, int]) -> None:
super().__init__(
f"Python version {version[0]}.{version[1]} is not supported. Only versions >= 3.8 are supported."
f"Python version {version[0]}.{version[1]} is not supported. Only versions >= 3.9 are supported."
)


Expand Down
2 changes: 1 addition & 1 deletion python/deptry/violations/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)

if TYPE_CHECKING:
from typing import Mapping
from collections.abc import Mapping

from deptry.dependency import Dependency
from deptry.module import ModuleLocations
Expand Down
14 changes: 9 additions & 5 deletions tests/unit/dependency_getter/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ def test_dependency_specification_not_found_raises_exception(tmp_path: Path, cap
with pyproject_toml_path.open("w") as f:
f.write('[build-system]\nrequires = ["maturin>=1.5,<2.0"]\nbuild-backend = "maturin"')

with caplog.at_level(logging.DEBUG), run_within_dir(tmp_path), pytest.raises(
DependencySpecificationNotFoundError,
match=re.escape(
"No file called 'pyproject.toml' with a [tool.poetry.dependencies], [tool.pdm] or [project] section or"
" file(s) called 'req/req.txt' found. Exiting."
with (
caplog.at_level(logging.DEBUG),
run_within_dir(tmp_path),
pytest.raises(
DependencySpecificationNotFoundError,
match=re.escape(
"No file called 'pyproject.toml' with a [tool.poetry.dependencies], [tool.pdm] or [project] section or"
" file(s) called 'req/req.txt' found. Exiting."
),
),
):
DependencyGetterBuilder(Path("pyproject.toml"), requirements_files=("req/req.txt",)).build()
Expand Down
11 changes: 7 additions & 4 deletions tests/unit/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ def test__get_stdlib_packages_with_stdlib_module_names_future_version(version_in
)
def test__get_stdlib_packages_unsupported(version_info: tuple[int | str, ...]) -> None:
"""It should raise an error when Python version is unsupported."""
with mock.patch("sys.version_info", version_info), pytest.raises(
UnsupportedPythonVersionError,
match=re.escape(
f"Python version {version_info[0]}.{version_info[1]} is not supported. Only versions >= 3.8 are supported."
with (
mock.patch("sys.version_info", version_info),
pytest.raises(
UnsupportedPythonVersionError,
match=re.escape(
f"Python version {version_info[0]}.{version_info[1]} is not supported. Only versions >= 3.9 are supported."
),
),
):
Core._get_standard_library_modules()
Expand Down
5 changes: 4 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
from contextlib import contextmanager
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Generator
from typing import TYPE_CHECKING, Any

from deptry.reporters.text import COLORS
from tests.functional.utils import DEPTRY_WHEEL_DIRECTORY

if TYPE_CHECKING:
from collections.abc import Generator


@dataclass
class _BaseVenvFactory:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist = true
envlist = py38, py39, py310, py311, py312, py313
envlist = py39, py310, py311, py312, py313

[testenv]
allowlist_externals = uv
Expand Down
Loading