diff --git a/poetry.lock b/poetry.lock index 86ff01bd0aa..a9e6ace852d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,27 +1,28 @@ -# This file is automatically @generated by Poetry 1.9.0.dev0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "build" -version = "1.1.1" +version = "1.2.1" description = "A simple, correct Python build frontend" optional = false -python-versions = ">= 3.7" +python-versions = ">=3.8" files = [ - {file = "build-1.1.1-py3-none-any.whl", hash = "sha256:8ed0851ee76e6e38adce47e4bee3b51c771d86c64cf578d0c2245567ee200e73"}, - {file = "build-1.1.1.tar.gz", hash = "sha256:8eea65bb45b1aac2e734ba2cc8dad3a6d97d97901a395bd0ed3e7b46953d2a31"}, + {file = "build-1.2.1-py3-none-any.whl", hash = "sha256:75e10f767a433d9a86e50d83f418e83efc18ede923ee5ff7df93b6cb0306c5d4"}, + {file = "build-1.2.1.tar.gz", hash = "sha256:526263f4870c26f26c433545579475377b2b7588b6f1eac76a001e873ae3e19d"}, ] [package.dependencies] colorama = {version = "*", markers = "os_name == \"nt\""} importlib-metadata = {version = ">=4.6", markers = "python_full_version < \"3.10.2\""} -packaging = ">=19.0" +packaging = ">=19.1" pyproject_hooks = "*" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} [package.extras] docs = ["furo (>=2023.08.17)", "sphinx (>=7.0,<8.0)", "sphinx-argparse-cli (>=1.5)", "sphinx-autodoc-typehints (>=1.10)", "sphinx-issues (>=3.0.0)"] -test = ["filelock (>=3)", "pytest (>=6.2.4)", "pytest-cov (>=2.12)", "pytest-mock (>=2)", "pytest-rerunfailures (>=9.1)", "pytest-xdist (>=1.34)", "setuptools (>=42.0.0)", "setuptools (>=56.0.0)", "setuptools (>=56.0.0)", "setuptools (>=67.8.0)", "wheel (>=0.36.0)"] -typing = ["importlib-metadata (>=5.1)", "mypy (>=1.5.0,<1.6.0)", "tomli", "typing-extensions (>=3.7.4.3)"] +test = ["build[uv,virtualenv]", "filelock (>=3)", "pytest (>=6.2.4)", "pytest-cov (>=2.12)", "pytest-mock (>=2)", "pytest-rerunfailures (>=9.1)", "pytest-xdist (>=1.34)", "setuptools (>=42.0.0)", "setuptools (>=56.0.0)", "setuptools (>=56.0.0)", "setuptools (>=67.8.0)", "wheel (>=0.36.0)"] +typing = ["build[uv]", "importlib-metadata (>=5.1)", "mypy (>=1.9.0,<1.10.0)", "tomli", "typing-extensions (>=3.7.4.3)"] +uv = ["uv (>=0.1.18)"] virtualenv = ["virtualenv (>=20.0.35)"] [[package]] @@ -1595,4 +1596,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "f561c063b73aa744ed0b11d2e6e2b36dd5334e96607be8b3f2ebc895a5708870" +content-hash = "08e1102283e5a8d9a88aee8a081bb45cde8ca52731ea726053dd3cb84bb6d4c1" diff --git a/pyproject.toml b/pyproject.toml index 07265de94eb..ba9422df212 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ python = "^3.8" poetry-core = "1.9.0" poetry-plugin-export = "^1.7.0" -build = "^1.1.1" +build = "^1.2.1" cachecontrol = { version = "^0.14.0", extras = ["filecache"] } cleo = "^2.1.0" dulwich = "^0.21.2" diff --git a/src/poetry/__version__.py b/src/poetry/__version__.py index 13fa08fc202..2c9a2eac138 100644 --- a/src/poetry/__version__.py +++ b/src/poetry/__version__.py @@ -1,16 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING - from poetry.utils._compat import metadata -if TYPE_CHECKING: - from collections.abc import Callable - - -# The metadata.version that we import for Python 3.7 is untyped, work around -# that. -version: Callable[[str], str] = metadata.version - -__version__ = version("poetry") +__version__ = metadata.version("poetry") diff --git a/src/poetry/console/logging/formatters/formatter.py b/src/poetry/console/logging/formatters/formatter.py index 8b595137894..d18002be4b7 100644 --- a/src/poetry/console/logging/formatters/formatter.py +++ b/src/poetry/console/logging/formatters/formatter.py @@ -2,5 +2,5 @@ class Formatter: - def format(self, record: str) -> str: + def format(self, msg: str) -> str: raise NotImplementedError() diff --git a/src/poetry/installation/chef.py b/src/poetry/installation/chef.py index 79225c085a0..35586e42036 100644 --- a/src/poetry/installation/chef.py +++ b/src/poetry/installation/chef.py @@ -15,6 +15,8 @@ if TYPE_CHECKING: + from build import DistributionType + from poetry.repositories import RepositoryPool from poetry.utils.cache import ArtifactCache from poetry.utils.env import Env @@ -48,7 +50,7 @@ def _prepare( ) -> Path: from subprocess import CalledProcessError - distribution = "wheel" if not editable else "editable" + distribution: DistributionType = "editable" if editable else "wheel" # type: ignore[assignment] error: Exception | None = None try: diff --git a/src/poetry/json/__init__.py b/src/poetry/json/__init__.py index de4f1789866..ef3bdbe2495 100644 --- a/src/poetry/json/__init__.py +++ b/src/poetry/json/__init__.py @@ -7,7 +7,7 @@ import fastjsonschema -from fastjsonschema.exceptions import JsonSchemaException +from fastjsonschema.exceptions import JsonSchemaValueException from poetry.core.json import SCHEMA_DIR as CORE_SCHEMA_DIR @@ -27,7 +27,7 @@ def validate_object(obj: dict[str, Any]) -> list[str]: errors = [] try: validate(obj) - except JsonSchemaException as e: + except JsonSchemaValueException as e: errors = [e.message] core_schema = json.loads( diff --git a/src/poetry/puzzle/solver.py b/src/poetry/puzzle/solver.py index af107646876..9675bc1f6f0 100644 --- a/src/poetry/puzzle/solver.py +++ b/src/poetry/puzzle/solver.py @@ -20,6 +20,7 @@ if TYPE_CHECKING: from collections.abc import Collection from collections.abc import Iterator + from collections.abc import Sequence from cleo.io.io import IO from packaging.utils import NormalizedName @@ -207,7 +208,7 @@ def __init__(self, id: DFSNodeID, name: str, base_name: str) -> None: self.name = name self.base_name = base_name - def reachable(self: T) -> list[T]: + def reachable(self: T) -> Sequence[T]: return [] def visit(self, parents: list[PackageNode]) -> None: @@ -284,7 +285,7 @@ def __init__( package.name, ) - def reachable(self) -> list[PackageNode]: + def reachable(self) -> Sequence[PackageNode]: children: list[PackageNode] = [] for dependency in self.package.all_requires: diff --git a/src/poetry/utils/isolated_build.py b/src/poetry/utils/isolated_build.py index 2f46dfd37fe..5e7cc103cb4 100644 --- a/src/poetry/utils/isolated_build.py +++ b/src/poetry/utils/isolated_build.py @@ -19,6 +19,7 @@ if TYPE_CHECKING: from pathlib import Path + from build import DistributionType from build import ProjectBuilder from poetry.repositories import RepositoryPool @@ -107,7 +108,7 @@ def install(self, requirements: Collection[str]) -> None: @contextmanager def isolated_builder( source: Path, - distribution: str = "wheel", + distribution: DistributionType = "wheel", python_executable: Path | None = None, pool: RepositoryPool | None = None, ) -> Iterator[ProjectBuilder]: diff --git a/tests/installation/test_installer.py b/tests/installation/test_installer.py index b90d24b2e78..dd384e10217 100644 --- a/tests/installation/test_installer.py +++ b/tests/installation/test_installer.py @@ -1625,7 +1625,7 @@ def test_run_install_duplicate_dependencies_different_constraints_with_lock( assert installer.executor.removals_count == 0 -def test_run_update_uninstalls_after_removal_transient_dependency( +def test_run_update_uninstalls_after_removal_transitive_dependency( installer: Installer, locker: Locker, repo: Repository, diff --git a/tests/puzzle/test_solver.py b/tests/puzzle/test_solver.py index b437fc07d71..36f41d88b05 100644 --- a/tests/puzzle/test_solver.py +++ b/tests/puzzle/test_solver.py @@ -1792,7 +1792,7 @@ def test_solver_duplicate_dependencies_ignore_overrides_with_empty_marker_inters solver: Solver, repo: Repository, package: ProjectPackage ) -> None: """ - Empty intersection between top level dependency and transient dependency. + Empty intersection between top level dependency and transitive dependency. """ package.add_dependency(Factory.create_dependency("A", {"version": "1.0"})) package.add_dependency( @@ -3307,7 +3307,7 @@ def test_solver_chooses_direct_dependency_from_explicit_if_explicit( assert ops[0].package.source_url is None -def test_solver_ignores_explicit_repo_for_transient_dependencies( +def test_solver_ignores_explicit_repo_for_transitive_dependencies( package: ProjectPackage, io: NullIO, legacy_repository: LegacyRepository, @@ -4358,7 +4358,7 @@ def test_solver_does_not_update_ref_of_locked_vcs_package( Factory.create_dependency("demo", {"git": "https://github.com/demo/demo.git"}) ) - # transient dependencies of demo + # transitive dependencies of demo pendulum = get_package("pendulum", "2.0.3") repo.add_package(pendulum) @@ -4404,7 +4404,7 @@ def test_solver_does_not_fetch_locked_vcs_package_with_ref( Factory.create_dependency("demo", {"git": "https://github.com/demo/demo.git"}) ) - # transient dependencies of demo + # transitive dependencies of demo pendulum = get_package("pendulum", "2.0.3") repo.add_package(pendulum) diff --git a/tests/repositories/fixtures/python_hosted.py b/tests/repositories/fixtures/python_hosted.py index 0bddf929a7b..a00f494e916 100644 --- a/tests/repositories/fixtures/python_hosted.py +++ b/tests/repositories/fixtures/python_hosted.py @@ -24,23 +24,23 @@ @pytest.fixture def mock_files_python_hosted_factory(http: type[httpretty]) -> PythonHostedFileMocker: def factory( - distribution_locations: list[Path], metadata_locations: list[Path] | None = None + distribution_locations: list[Path], metadata_locations: list[Path] ) -> None: def file_callback( request: HTTPrettyRequest, uri: str, headers: dict[str, Any] ) -> list[int | dict[str, Any] | bytes | str]: name = Path(urlparse(uri).path).name - if metadata_locations and name.endswith(".metadata"): - for location in metadata_locations: - fixture = location / name - if fixture.exists(): - return [200, headers, fixture.read_text()] - else: - for location in distribution_locations: - fixture = location / name - if fixture.exists(): - return [200, headers, fixture.read_bytes()] + locations = ( + metadata_locations + if name.endswith(".metadata") + else distribution_locations + ) + + for location in locations: + fixture = location / name + if fixture.exists(): + return [200, headers, fixture.read_bytes()] return [404, headers, b"Not Found"] @@ -68,7 +68,7 @@ def mock_file_callback( def mock_files_python_hosted( mock_files_python_hosted_factory: PythonHostedFileMocker, package_distribution_locations: list[Path], - package_metadata_locations: list[Path] | None, + package_metadata_locations: list[Path], ) -> Iterator[None]: mock_files_python_hosted_factory( distribution_locations=package_distribution_locations, diff --git a/tests/types.py b/tests/types.py index c334664af30..840545bf27f 100644 --- a/tests/types.py +++ b/tests/types.py @@ -96,7 +96,7 @@ class PythonHostedFileMocker(Protocol): def __call__( self, distribution_locations: list[Path], - metadata_locations: list[Path] | None = None, + metadata_locations: list[Path], ) -> None: ...