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 support for Python 3.8 #9692

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
4 changes: 0 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ tests_task:

env:
matrix:
- PYTHON: python3.8
PYTHON_VERSION: 3.8
PYTHON_PACKAGE: python38
SQLITE_PACKAGE: py38-sqlite3
- PYTHON: python3.9
PYTHON_VERSION: 3.9
PYTHON_PACKAGE: python39
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
image: windows-2022
- name: macOS aarch64
image: macos-14
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false

status:
Expand Down
35 changes: 2 additions & 33 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Changelog = "https://python-poetry.org/history/"

# Requirements
[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"

poetry-core = { git = "https://github.com/python-poetry/poetry-core.git", branch = "main" }
poetry-plugin-export = "^1.8.0"
Expand Down Expand Up @@ -105,7 +105,7 @@ extend-exclude = [
]
fix = true
line-length = 88
target-version = "py38"
target-version = "py39"

[tool.ruff.lint]
extend-select = [
Expand Down
5 changes: 2 additions & 3 deletions src/poetry/console/commands/env/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from cleo.helpers import option

from poetry.console.commands.command import Command
from poetry.utils._compat import is_relative_to


if TYPE_CHECKING:
Expand Down Expand Up @@ -55,8 +54,8 @@ def handle(self) -> int:
self.line(f"Deleted virtualenv: <comment>{venv.path}</comment>")
if remove_all_envs or is_in_project:
for venv in manager.list():
if not is_in_project or is_relative_to(
venv.path, self.poetry.pyproject_path.parent
if not is_in_project or venv.path.is_relative_to(
self.poetry.pyproject_path.parent
):
manager.remove_venv(venv.path)
self.line(f"Deleted virtualenv: <comment>{venv.path}</comment>")
Expand Down
5 changes: 2 additions & 3 deletions src/poetry/console/commands/init.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from __future__ import annotations

from collections.abc import Mapping
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import ClassVar
from typing import Dict
from typing import Mapping
from typing import Union

from cleo.helpers import option
Expand All @@ -26,7 +25,7 @@

from poetry.repositories import RepositoryPool

Requirements = Dict[str, Union[str, Mapping[str, Any]]]
Requirements = dict[str, Union[str, Mapping[str, Any]]]


class InitCommand(Command):
Expand Down
6 changes: 3 additions & 3 deletions src/poetry/inspection/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Mapping
from typing import Sequence

import pkginfo

Expand All @@ -31,6 +29,8 @@

if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Mapping
from collections.abc import Sequence

from packaging.metadata import RawMetadata
from packaging.utils import NormalizedName
Expand Down Expand Up @@ -523,7 +523,7 @@ def from_path(cls, path: Path) -> PackageInfo:
return cls.from_sdist(path=path)


@functools.lru_cache(maxsize=None)
@functools.cache
def get_pep517_metadata(path: Path) -> PackageInfo:
"""
Helper method to use PEP-517 library to build and read package metadata.
Expand Down
3 changes: 1 addition & 2 deletions src/poetry/mixology/version_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from typing import TYPE_CHECKING
from typing import Optional
from typing import Tuple

from poetry.core.packages.dependency import Dependency

Expand All @@ -32,7 +31,7 @@
_conflict = object()


DependencyCacheKey = Tuple[
DependencyCacheKey = tuple[
str, Optional[str], Optional[str], Optional[str], Optional[str]
]

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/packages/direct_origin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from poetry.utils.cache import ArtifactCache


@functools.lru_cache(maxsize=None)
@functools.cache
def _get_package_from_git(
url: str,
branch: str | None = None,
Expand Down
3 changes: 1 addition & 2 deletions src/poetry/packages/package_collection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from typing import List

from poetry.packages.dependency_package import DependencyPackage

Expand All @@ -13,7 +12,7 @@
from poetry.core.packages.package import Package


class PackageCollection(List[DependencyPackage]):
class PackageCollection(list[DependencyPackage]):
def __init__(
self,
dependency: Dependency,
Expand Down
4 changes: 1 addition & 3 deletions src/poetry/puzzle/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from collections import defaultdict
from contextlib import contextmanager
from typing import TYPE_CHECKING
from typing import FrozenSet
from typing import Tuple

from poetry.mixology import resolve_version
from poetry.mixology.failure import SolveFailure
Expand Down Expand Up @@ -197,7 +195,7 @@ def _solve(self) -> tuple[list[Package], list[int]]:
return final_packages, depths


DFSNodeID = Tuple[str, FrozenSet[str], bool]
DFSNodeID = tuple[str, frozenset[str], bool]


class DFSNode:
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/repositories/http_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Iterator

import requests
import requests.adapters
Expand Down Expand Up @@ -36,6 +35,8 @@


if TYPE_CHECKING:
from collections.abc import Iterator

from packaging.utils import NormalizedName
from poetry.core.packages.utils.link import Link

Expand Down
5 changes: 2 additions & 3 deletions src/poetry/repositories/link_sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from functools import cached_property
from typing import TYPE_CHECKING
from typing import ClassVar
from typing import DefaultDict
from typing import List

from poetry.core.constraints.version import Version
from poetry.core.packages.package import Package
Expand All @@ -18,12 +16,13 @@


if TYPE_CHECKING:
from collections import defaultdict
from collections.abc import Iterator

from packaging.utils import NormalizedName
from poetry.core.packages.utils.link import Link

LinkCache = DefaultDict[NormalizedName, DefaultDict[Version, List[Link]]]
LinkCache = defaultdict[NormalizedName, defaultdict[Version, list[Link]]]


logger = logging.getLogger(__name__)
Expand Down
22 changes: 0 additions & 22 deletions src/poetry/utils/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
import sys

from contextlib import suppress
from typing import TYPE_CHECKING


if TYPE_CHECKING:
from pathlib import Path


if sys.version_info < (3, 11):
Expand Down Expand Up @@ -60,28 +55,11 @@ def getencoding() -> str:
return locale.getencoding()


def is_relative_to(this: Path, other: Path) -> bool:
"""
Return whether `this` path is relative to the `other` path. This is compatibility wrapper around
`PurePath.is_relative_to()` method. This method was introduced only in Python 3.9.

See: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.is_relative_to
"""
if sys.version_info < (3, 9):
with suppress(ValueError):
this.relative_to(other)
return True
return False

return this.is_relative_to(other)


__all__ = [
"WINDOWS",
"decode",
"encode",
"getencoding",
"is_relative_to",
"metadata",
"tomllib",
]
4 changes: 1 addition & 3 deletions src/poetry/utils/dependency_specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

from pathlib import Path
from typing import TYPE_CHECKING
from typing import Dict
from typing import List
from typing import TypeVar
from typing import Union
from typing import cast
Expand All @@ -26,7 +24,7 @@
from poetry.utils.env import Env


DependencySpec = Dict[str, Union[str, bool, Dict[str, Union[str, bool]], List[str]]]
DependencySpec = dict[str, Union[str, bool, dict[str, Union[str, bool]], list[str]]]
BaseSpec = TypeVar("BaseSpec", DependencySpec, InlineTable)

GIT_URL_SCHEMES = {"git+http", "git+https", "git+ssh"}
Expand Down
4 changes: 1 addition & 3 deletions src/poetry/utils/env/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@


if TYPE_CHECKING:
from typing import Tuple

from packaging.tags import Tag
from poetry.core.version.markers import BaseMarker
from virtualenv.seed.wheels.util import Wheel

from poetry.utils.env.generic_env import GenericEnv

PythonVersion = Tuple[int, int, int, str, int]
PythonVersion = tuple[int, int, int, str, int]


class Env:
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/utils/isolated_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from contextlib import redirect_stdout
from io import StringIO
from typing import TYPE_CHECKING
from typing import Collection
from typing import Iterator

from build.env import IsolatedEnv as BaseIsolatedEnv

Expand All @@ -17,6 +15,8 @@


if TYPE_CHECKING:
from collections.abc import Collection
from collections.abc import Iterator
from pathlib import Path

from build import DistributionType
Expand Down
Loading