Skip to content

Commit

Permalink
drop support for Python 3.8 (#9692)
Browse files Browse the repository at this point in the history
Co-authored-by: Randy Döring <[email protected]>
Co-authored-by: Sven van Ashbrook <[email protected]>
  • Loading branch information
3 people authored Oct 20, 2024
1 parent d31b3ac commit ab0880c
Show file tree
Hide file tree
Showing 32 changed files with 70 additions and 115 deletions.
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
6 changes: 5 additions & 1 deletion .github/workflows/.tests-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ jobs:

- name: Use local poetry
working-directory: poetry-plugin-export
run: poetry add --lock --group dev ../poetry
# Replace the python version to avoid conflicts
# if the plugin still supports a wider range than Poetry itself.
run: |
perl -pi -e 's/^python =.*$/python = "~${{ inputs.python-version }}"/' pyproject.toml
poetry add --lock --group dev ../poetry
# This step can be removed after having released a poetry-plugin-export version
# that has cffi>=1.17.0 in its lock file.
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:
- name: macOS aarch64
image: macos-14
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
Expand Down
24 changes: 2 additions & 22 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" }
build = "^1.2.1"
Expand Down Expand Up @@ -104,7 +104,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 @@ -27,7 +26,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
5 changes: 1 addition & 4 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ def _serialize(
self._shutdown = True

if self._shutdown:
# Cancelling further tasks from being executed
[task.cancel() for task in tasks]
self._executor.shutdown(wait=True)

self._executor.shutdown(wait=True, cancel_futures=True)
break

for warning in self._yanked_warnings:
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
2 changes: 1 addition & 1 deletion src/poetry/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Sequence

import tomlkit

Expand All @@ -30,6 +29,7 @@


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

from cleo.io.io import IO
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 SolveFailureError
Expand Down Expand Up @@ -195,7 +193,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 @@ -23,15 +23,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(ABC):
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

0 comments on commit ab0880c

Please sign in to comment.