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

Add support for pip==23.2 where refactored out DEV_PKGS #1906

Merged
merged 1 commit into from
Jul 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion piptools/_compat/__init__.py
Expand Up @@ -4,7 +4,14 @@
PIP_VERSION,
Distribution,
create_wheel_cache,
get_dev_pkgs,
parse_requirements,
)

__all__ = ["PIP_VERSION", "Distribution", "parse_requirements", "create_wheel_cache"]
__all__ = [
"PIP_VERSION",
"Distribution",
"parse_requirements",
"create_wheel_cache",
"get_dev_pkgs",
]
13 changes: 12 additions & 1 deletion piptools/_compat/pip_compat.py
Expand Up @@ -2,7 +2,7 @@

import optparse
from dataclasses import dataclass
from typing import TYPE_CHECKING, Iterable, Iterator
from typing import TYPE_CHECKING, Iterable, Iterator, Set, cast

import pip
from pip._internal.cache import WheelCache
Expand Down Expand Up @@ -82,3 +82,14 @@ def create_wheel_cache(cache_dir: str, format_control: str | None = None) -> Whe
if PIP_VERSION[:2] <= (23, 0):
kwargs["format_control"] = format_control
return WheelCache(**kwargs)


def get_dev_pkgs() -> set[str]:
if PIP_VERSION[:2] <= (23, 1):
from pip._internal.commands.freeze import DEV_PKGS

return cast(Set[str], DEV_PKGS)

from pip._internal.commands.freeze import _dev_pkgs

return cast(Set[str], _dev_pkgs())
5 changes: 2 additions & 3 deletions piptools/sync.py
Expand Up @@ -8,7 +8,6 @@
from typing import Deque, Iterable, Mapping, ValuesView

import click
from pip._internal.commands.freeze import DEV_PKGS
from pip._internal.models.direct_url import ArchiveInfo
from pip._internal.req import InstallRequirement
from pip._internal.utils.compat import stdlib_pkgs
Expand All @@ -17,7 +16,7 @@
direct_url_from_link,
)

from ._compat import Distribution
from ._compat import Distribution, get_dev_pkgs
from .exceptions import IncompatibleRequirements
from .logging import log
from .utils import (
Expand All @@ -36,7 +35,7 @@
"pip-review",
"pkg-resources",
*stdlib_pkgs,
*DEV_PKGS,
*get_dev_pkgs(),
]


Expand Down