Skip to content

Commit

Permalink
Add support for pip==23.2 where removed DEV_PKGS
Browse files Browse the repository at this point in the history
  • Loading branch information
atugushev committed Jul 9, 2023
1 parent 4b9cc32 commit d1fd324
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
9 changes: 8 additions & 1 deletion piptools/_compat/__init__.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit d1fd324

Please sign in to comment.