Skip to content

Commit

Permalink
chore: update poetry-core to 1.3 and fix deprecations
Browse files Browse the repository at this point in the history
(cherry picked from commit 1215ba8)
  • Loading branch information
radoering authored and neersighted committed Oct 6, 2022
1 parent 017bc15 commit 67c505d
Show file tree
Hide file tree
Showing 43 changed files with 66 additions and 70 deletions.
18 changes: 7 additions & 11 deletions poetry.lock

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

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ generate-setup-file = false
[tool.poetry.dependencies]
python = "^3.7"

poetry-core = "1.2.0"
poetry-core = "1.3.1"
poetry-plugin-export = "^1.1.1"
"backports.cached-property" = { version = "^1.0.2", python = "<3.8" }
cachecontrol = { version = "^0.12.9", extras = ["filecache"] }
Expand Down Expand Up @@ -77,8 +77,6 @@ tox = "^3.18"
pre-commit = "^2.6"

[tool.poetry.group.test.dependencies]
# TODO: remove when bumping poetry-core to 1.3
poetry-core = { git = "https://github.com/finswimmer/core.git", branch = "fix/available-pythons" }
deepdiff = "^5.0"
flatdict = "^4.0.1"
httpretty = "^1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AddCommand(InstallerCommand, InitCommand):
loggers = ["poetry.repositories.pypi_repository", "poetry.inspection.info"]

def handle(self) -> int:
from poetry.core.semver.helpers import parse_constraint
from poetry.core.constraints.version import parse_constraint
from tomlkit import inline_table
from tomlkit import parse as parse_toml
from tomlkit import table
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/self/add.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version

from poetry.__version__ import __version__
from poetry.console.commands.add import AddCommand
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def find_latest_package(
return selector.find_best_candidate(name, f">={package.pretty_version}")

def get_update_status(self, latest: Package, package: Package) -> str:
from poetry.core.semver.helpers import parse_constraint
from poetry.core.constraints.version import parse_constraint

if latest.full_pretty_version == package.full_pretty_version:
return "up-to-date"
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/console/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


if TYPE_CHECKING:
from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version


class VersionCommand(Command):
Expand Down Expand Up @@ -91,7 +91,7 @@ def handle(self) -> int:
return 0

def increment_version(self, version: str, rule: str) -> Version:
from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version

try:
parsed = Version.parse(version)
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/installation/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@


if TYPE_CHECKING:
from poetry.core.constraints.version import Version
from poetry.core.packages.package import Package
from poetry.core.packages.utils.link import Link
from poetry.core.semver.version import Version

from poetry.repositories.pool import Pool
from poetry.utils.env import Env
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/installation/pip_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from typing import TYPE_CHECKING
from typing import Any

from poetry.core.constraints.version import Version
from poetry.core.pyproject.toml import PyProjectTOML
from poetry.core.semver.version import Version

from poetry.installation.base_installer import BaseInstaller
from poetry.repositories.http import HTTPRepository
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from pathlib import Path
from typing import TYPE_CHECKING

from poetry.core.constraints.version import Version
from poetry.core.masonry.builders.builder import Builder
from poetry.core.masonry.builders.sdist import SdistBuilder
from poetry.core.masonry.utils.package_include import PackageInclude
from poetry.core.semver.version import Version

from poetry.utils._compat import WINDOWS
from poetry.utils._compat import decode
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/mixology/failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING
from typing import cast

from poetry.core.semver.helpers import parse_constraint
from poetry.core.constraints.version import parse_constraint

from poetry.mixology.incompatibility_cause import ConflictCause
from poetry.mixology.incompatibility_cause import PythonCause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class PythonRequirementSolution(Solution): # type: ignore[misc]
def __init__(self, exception: SolverProblemError) -> None:
from poetry.core.semver.helpers import parse_constraint
from poetry.core.constraints.version import parse_constraint

from poetry.mixology.incompatibility_cause import PythonCause

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/mixology/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


if TYPE_CHECKING:
from poetry.core.constraints.version import VersionConstraint
from poetry.core.packages.dependency import Dependency
from poetry.core.semver.version_constraint import VersionConstraint


class Term:
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/packages/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from typing import cast

from packaging.utils import canonicalize_name
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import parse_constraint
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.package import Package
from poetry.core.semver.helpers import parse_constraint
from poetry.core.semver.version import Version
from poetry.core.toml.file import TOMLFile
from poetry.core.version.markers import parse_marker
from poetry.core.version.requirements import InvalidRequirement
Expand Down
8 changes: 5 additions & 3 deletions src/poetry/publishing/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests

from poetry.core.masonry.metadata import Metadata
from poetry.core.masonry.utils.helpers import escape_name
from poetry.core.masonry.utils.helpers import distribution_name
from requests import adapters
from requests.exceptions import ConnectionError
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -79,9 +79,11 @@ def files(self) -> list[Path]:
version = self._package.version.to_string()

wheels = list(
dist.glob(f"{escape_name(self._package.pretty_name)}-{version}-*.whl")
dist.glob(f"{distribution_name(self._package.name)}-{version}-*.whl")
)
tars = list(
dist.glob(f"{distribution_name(self._package.name)}-{version}.tar.gz")
)
tars = list(dist.glob(f"{self._package.pretty_name}-{version}.tar.gz"))

return sorted(wheels + tars)

Expand Down
6 changes: 3 additions & 3 deletions src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from typing import cast

from cleo.ui.progress_indicator import ProgressIndicator
from poetry.core.constraints.version import EmptyConstraint
from poetry.core.constraints.version import Version
from poetry.core.packages.utils.utils import get_python_constraint_from_marker
from poetry.core.semver.empty_constraint import EmptyConstraint
from poetry.core.semver.version import Version
from poetry.core.version.markers import AnyMarker
from poetry.core.version.markers import MarkerUnion

Expand All @@ -41,13 +41,13 @@
from collections.abc import Iterator

from cleo.io.io import IO
from poetry.core.constraints.version import VersionConstraint
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.directory_dependency import DirectoryDependency
from poetry.core.packages.file_dependency import FileDependency
from poetry.core.packages.package import Package
from poetry.core.packages.url_dependency import URLDependency
from poetry.core.packages.vcs_dependency import VCSDependency
from poetry.core.semver.version_constraint import VersionConstraint
from poetry.core.version.markers import BaseMarker

from poetry.repositories import Pool
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/repositories/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

from cachy import CacheManager
from packaging.utils import canonicalize_name
from poetry.core.semver.helpers import parse_constraint
from poetry.core.constraints.version import parse_constraint

from poetry.config.config import Config
from poetry.repositories.repository import Repository


if TYPE_CHECKING:
from packaging.utils import NormalizedName
from poetry.core.constraints.version import Version
from poetry.core.packages.package import Package
from poetry.core.semver.version import Version

from poetry.inspection.info import PackageInfo

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/repositories/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

import requests

from poetry.core.constraints.version import parse_constraint
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.utils.link import Link
from poetry.core.semver.helpers import parse_constraint
from poetry.core.utils.helpers import temporary_directory
from poetry.core.version.markers import parse_marker

Expand Down
4 changes: 2 additions & 2 deletions src/poetry/repositories/legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

if TYPE_CHECKING:
from packaging.utils import NormalizedName
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import VersionConstraint
from poetry.core.packages.utils.link import Link
from poetry.core.semver.version import Version
from poetry.core.semver.version_constraint import VersionConstraint

from poetry.config.config import Config

Expand Down
2 changes: 1 addition & 1 deletion src/poetry/repositories/link_sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from typing import List

from packaging.utils import canonicalize_name
from poetry.core.constraints.version import Version
from poetry.core.packages.package import Package
from poetry.core.semver.version import Version

from poetry.utils._compat import cached_property
from poetry.utils.patterns import sdist_file_re
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/repositories/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@


if TYPE_CHECKING:
from poetry.core.constraints.version import Version
from poetry.core.packages.dependency import Dependency
from poetry.core.packages.package import Package
from poetry.core.semver.version import Version


class Pool(Repository):
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

if TYPE_CHECKING:
from packaging.utils import NormalizedName
from poetry.core.semver.version import Version
from poetry.core.semver.version_constraint import VersionConstraint
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import VersionConstraint

SUPPORTED_PACKAGE_TYPES = {"sdist", "bdist_wheel"}

Expand Down
8 changes: 4 additions & 4 deletions src/poetry/repositories/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from typing import TYPE_CHECKING

from packaging.utils import canonicalize_name
from poetry.core.semver.helpers import parse_constraint
from poetry.core.semver.version import Version
from poetry.core.semver.version_constraint import VersionConstraint
from poetry.core.semver.version_range import VersionRange
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import VersionConstraint
from poetry.core.constraints.version import VersionRange
from poetry.core.constraints.version import parse_constraint

from poetry.repositories.exceptions import PackageNotFound

Expand Down
4 changes: 2 additions & 2 deletions src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
from packaging.tags import interpreter_name
from packaging.tags import interpreter_version
from packaging.tags import sys_tags
from poetry.core.semver.helpers import parse_constraint
from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version
from poetry.core.constraints.version import parse_constraint
from poetry.core.toml.file import TOMLFile
from poetry.core.utils.helpers import temporary_directory
from virtualenv.seed.wheels.embed import get_embed_wheel
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/utils/setup_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import Any

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version


class SetupReader:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/version/version_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import TYPE_CHECKING

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion tests/console/commands/env/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING
from typing import Any

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion tests/console/commands/env/test_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version

from tests.console.commands.env.helpers import check_output_wrapper

Expand Down
2 changes: 1 addition & 1 deletion tests/console/commands/env/test_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
import tomlkit

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version
from poetry.core.toml.file import TOMLFile

from poetry.utils.env import MockEnv
Expand Down
2 changes: 1 addition & 1 deletion tests/console/commands/self/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import pytest

from poetry.core.constraints.version import Version
from poetry.core.packages.package import Package
from poetry.core.semver.version import Version

from poetry.__version__ import __version__
from poetry.factory import Factory
Expand Down
2 changes: 1 addition & 1 deletion tests/console/commands/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest

from poetry.core.semver.version import Version
from poetry.core.constraints.version import Version

from poetry.repositories.legacy_repository import LegacyRepository
from tests.helpers import get_dependency
Expand Down
Loading

0 comments on commit 67c505d

Please sign in to comment.