pip_shims.compat module

Backports and helper functionality to support using new functionality.

class pip_shims.compat.CandidateEvaluator(project_name, supported_tags, specifier, prefer_binary=False, allow_all_prereleases=False, hashes=None)[source]

Bases: object

classmethod create(project_name, target_python=None, prefer_binary=False, allow_all_prereleases=False, specifier=None, hashes=None)[source]
class pip_shims.compat.CandidatePreferences(prefer_binary=False, allow_all_prereleases=False)[source]

Bases: object

exception pip_shims.compat.InvalidWheelFilename[source]

Bases: Exception

Wheel Filename is Invalid

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class pip_shims.compat.LinkCollector(session=None, search_scope=None)[source]

Bases: object

class pip_shims.compat.LinkEvaluator(allow_yanked, project_name, canonical_name, formats, target_python, ignore_requires_python=False, ignore_compatibility=True)[source]

Bases: object

class pip_shims.compat.SearchScope(find_links=None, index_urls=None)[source]

Bases: object

classmethod create(find_links=None, index_urls=None)[source]
class pip_shims.compat.SelectionPreferences(allow_yanked=True, allow_all_prereleases=False, format_control=None, prefer_binary=False, ignore_requires_python=False)[source]

Bases: object

class pip_shims.compat.TargetPython(platform=None, py_version_info=None, abi=None, implementation=None)[source]

Bases: object

fallback_get_tags = <pip_shims.models.ShimmedPathCollection object>
get_tags()[source]
class pip_shims.compat.Wheel(filename)[source]

Bases: object

get_formatted_file_tags()[source]

Return the wheel’s tags as a sorted list of strings.

support_index_min(tags)[source]

Return the lowest index that one of the wheel’s file_tag combinations achieves in the given list of supported tags.

For example, if there are 8 supported tags and one of the file tags is first in the list, then return 0.

Parameters:tags – the PEP 425 tags to check the wheel against, in order with most preferred first.
Raises:ValueError – If none of the wheel’s file tags match one of the supported tags.
supported(tags)[source]

Return whether the wheel is compatible with one of the given tags.

Parameters:tags – the PEP 425 tags to check the wheel against.
wheel_file_re = re.compile('^(?P<namever>(?P<name>.+?)-(?P<ver>.*?))\n ((-(?P<build>\\d[^-]*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)\n \\.whl|\\.dist-info)$', re.VERBOSE)
pip_shims.compat._ensure_finder(finder=None, finder_provider=None, install_cmd=None, options=None, session=None)[source]
pip_shims.compat._ensure_wheel_cache(wheel_cache=None, wheel_cache_provider=None, format_control=None, format_control_provider=None, options=None, cache_dir=None)[source]
pip_shims.compat.build_wheel(req=None, reqset=None, output_dir=None, preparer=None, wheel_cache=None, build_options=None, global_options=None, check_binary_allowed=None, no_clean=False, session=None, finder=None, install_command=None, req_tracker=None, build_dir=None, src_dir=None, download_dir=None, wheel_download_dir=None, cache_dir=None, use_user_site=False, use_pep517=None, verify=False, editable=False, format_control_provider=None, wheel_cache_provider=None, preparer_provider=None, wheel_builder_provider=None, build_one_provider=None, build_one_inside_env_provider=None, build_many_provider=None, install_command_provider=None, finder_provider=None, reqset_provider=None)[source]

Build a wheel or a set of wheels

Raises:

TypeError – Raised when no requirements are provided

Parameters:
  • req (Optional[TInstallRequirement]) – An InstallRequirement to build
  • reqset (Optional[TReqSet]) – A RequirementSet instance (pip<10) or an iterable of InstallRequirement instances (pip>=10) to build
  • output_dir (Optional[str]) – Target output directory, only useful when building one wheel using pip>=20.0
  • preparer (Optional[TPreparer]) – A preparer instance, defaults to None
  • wheel_cache (Optional[TWheelCache]) – A wheel cache instance, defaults to None
  • build_options (Optional[List[str]]) – A list of build options to pass in
  • global_options (Optional[List[str]]) – A list of global options to pass in
  • bool]] check_binary_allowed (Optional[Callable[TInstallRequirement,) – A callable to check whether we are allowed to build and cache wheels for an ireq
  • no_clean (bool) – Whether to avoid cleaning up wheels
  • session (Optional[TSession]) – A PipSession instance to pass to create a finder if necessary
  • finder (Optional[TFinder]) – A PackageFinder instance to use for generating a WheelBuilder instance on pip<20
  • install_command (Optional[TCommandInstance]) – The install command used to create the finder, session, and options if needed, defaults to None.
  • req_tracker (Optional[TReqTracker]) – An optional requirement tracker instance, if one already exists
  • build_dir (Optional[str]) – Passthrough parameter for building preparer
  • src_dir (Optional[str]) – Passthrough parameter for building preparer
  • download_dir (Optional[str]) – Passthrough parameter for building preparer
  • wheel_download_dir (Optional[str]) – Passthrough parameter for building preparer
  • cache_dir (Optional[str]) – Passthrough cache directory for wheel cache options
  • use_user_site (bool) – Whether to use the user site directory when preparing install requirements on pip<20
  • use_pep517 (Optional[bool]) – When set to True or False, prefers building with or without pep517 as specified, otherwise uses requirement preference. Only works for single requirements.
  • format_control_provider (Optional[TShimmedFunc]) – A provider for the FormatControl class
  • wheel_cache_provider (Optional[TShimmedFunc]) – A provider for the WheelCache class
  • preparer_provider (Optional[TShimmedFunc]) – A provider for the RequirementPreparer class
  • wheel_builder_provider (Optional[TShimmedFunc]) – A provider for the WheelBuilder class, if it exists
  • build_one_provider (Optional[TShimmedFunc]) – A provider for the _build_one function, if it exists
  • build_one_inside_env_provider (Optional[TShimmedFunc]) – A provider for the _build_one_inside_env function, if it exists
  • build_many_provider (Optional[TShimmedFunc]) – A provider for the build function, if it exists
  • install_command_provider (Optional[TShimmedFunc]) – A shim for providing new install command instances
  • finder_provider (TShimmedFunc) – A provider to package finder instances
  • reqset_provider (TShimmedFunc) – A provider for requirement set generation
Returns:

A tuple of successful and failed install requirements or else a path to a wheel

Return type:

Optional[Union[str, Tuple[List[TInstallRequirement], List[TInstallRequirement]]]]

pip_shims.compat.ensure_resolution_dirs(**kwargs)[source]

Ensures that the proper directories are scaffolded and present in the provided kwargs for performing dependency resolution via pip.

Returns:A new kwargs dictionary with scaffolded directories for build_dir, src_dir, download_dir, and wheel_download_dir added to the key value pairs.
Return type:Dict[str, Any]
pip_shims.compat.get_ireq_output_path(wheel_cache, ireq)[source]
pip_shims.compat.get_package_finder(install_cmd=None, options=None, session=None, platform=None, python_versions=None, abi=None, implementation=None, target_python=None, ignore_requires_python=None, target_python_builder=None, install_cmd_provider=None)[source]

Shim for compatibility to generate package finders.

Build and return a PackageFinder instance using the InstallCommand helper method to construct the finder, shimmed with backports as needed for compatibility.

Parameters:
  • install_cmd_provider (ShimmedPathCollection) – A shim for providing new install command instances.
  • install_cmd – A InstallCommand instance which is used to generate the finder.
  • options (optparse.Values) – An optional optparse.Values instance generated by calling install_cmd.parser.parse_args() typically.
  • session – An optional session instance, can be created by the install_cmd.
  • platform (Optional[str]) – An optional platform string, e.g. linux_x86_64
  • ..]] python_versions (Optional[Tuple[str,) – A tuple of 2-digit strings representing python versions, e.g. (“27”, “35”, “36”, “37”…)
  • abi (Optional[str]) – The target abi to support, e.g. “cp38”
  • implementation (Optional[str]) – An optional implementation string for limiting searches to a specific implementation, e.g. “cp” or “py”
  • target_python – A TargetPython instance (will be translated to alternate arguments if necessary on incompatible pip versions).
  • ignore_requires_python (Optional[bool]) – Whether to ignore requires_python on resulting candidates, only valid after pip version 19.3.1
  • target_python_builder – A ‘TargetPython’ builder (e.g. the class itself, uninstantiated)
Returns:

A pip._internal.index.package_finder.PackageFinder instance

Return type:

pip._internal.index.package_finder.PackageFinder

Example:
>>> from pip_shims.shims import InstallCommand, get_package_finder
>>> install_cmd = InstallCommand()
>>> finder = get_package_finder(
...     install_cmd, python_versions=("27", "35", "36", "37", "38"), implementation="
cp"
... )
>>> candidates = finder.find_all_candidates("requests")
>>> requests_222 = next(iter(c for c in candidates if c.version.public == "2.22.0"))
>>> requests_222
<InstallationCandidate('requests', <Version('2.22.0')>, <Link https://files.pythonhos
ted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/r
equests-2.22.0-py2.py3-none-any.whl#sha256=9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9
a590f48c010551dc6c4b31 (from https://pypi.org/simple/requests/) (requires-python:>=2.
7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*)>)>
pip_shims.compat.get_requirement_set(install_command=None, req_set_provider=None, build_dir=None, src_dir=None, download_dir=None, wheel_download_dir=None, session=None, wheel_cache=None, upgrade=False, upgrade_strategy=None, ignore_installed=False, ignore_dependencies=False, force_reinstall=False, use_user_site=False, isolated=False, ignore_requires_python=False, require_hashes=None, cache_dir=None, options=None, install_cmd_provider=None, wheel_cache_provider=None)[source]

Creates a requirement set from the supplied parameters.

Not all parameters are passed through for all pip versions, but any invalid parameters will be ignored if they are not needed to generate a requirement set on the current pip version.

:param ShimmedPathCollection wheel_cache_provider: A
context manager provider which resolves to a WheelCache instance
Parameters:install_command – A InstallCommand instance which is used to generate the finder.
:param ShimmedPathCollection req_set_provider: A provider
to build requirement set instances.
Parameters:
  • build_dir (str) – The directory to build requirements in. Removed in pip 10, defeaults to None
  • source_dir (str) – The directory to use for source requirements. Removed in pip 10, defaults to None
  • download_dir (str) – The directory to download requirement artifacts to. Removed in pip 10, defaults to None
  • wheel_download_dir (str) – The directory to download wheels to. Removed in pip 10, defaults ot None
:param Session session: The pip session to use. Removed in pip 10,
defaults to None
Parameters:
  • wheel_cache (WheelCache) – The pip WheelCache instance to use for caching wheels. Removed in pip 10, defaults to None
  • upgrade (bool) – Whether to try to upgrade existing requirements. Removed in pip 10, defaults to False.
  • upgrade_strategy (str) – The upgrade strategy to use, e.g. “only-if-needed”. Removed in pip 10, defaults to None.
  • ignore_installed (bool) – Whether to ignore installed packages when resolving. Removed in pip 10, defaults to False.
  • ignore_dependencies (bool) – Whether to ignore dependencies of requirements when resolving. Removed in pip 10, defaults to False.
  • force_reinstall (bool) – Whether to force reinstall of packages when resolving. Removed in pip 10, defaults to False.
  • use_user_site (bool) – Whether to use user site packages when resolving. Removed in pip 10, defaults to False.
  • isolated (bool) – Whether to resolve in isolation. Removed in pip 10, defaults to False.
  • ignore_requires_python (bool) – Removed in pip 10, defaults to False.
  • require_hashes (bool) – Whether to require hashes when resolving. Defaults to False.
  • options (Values) – An Values instance from an install cmd
  • install_cmd_provider (ShimmedPathCollection) – A shim for providing new install command instances.
Returns:

A new requirement set instance

Return type:

RequirementSet

pip_shims.compat.get_resolver(resolver_fn, install_req_provider=None, format_control_provider=None, wheel_cache_provider=None, finder=None, upgrade_strategy='to-satisfy-only', force_reinstall=None, ignore_dependencies=None, ignore_requires_python=None, ignore_installed=True, use_user_site=False, isolated=None, wheel_cache=None, preparer=None, session=None, options=None, make_install_req=None, install_cmd_provider=None, install_cmd=None, use_pep517=True)[source]

A resolver creation compatibility shim for generating a resolver.

Consumes any argument that was previously used to instantiate a resolver, discards anything that is no longer valid.

Note

This is only valid for pip >= 10.0.0

Raises:
  • ValueError – A session is required but not provided and one cannot be created
  • ValueError – A finder is required but not provided and one cannot be created
  • ValueError – An install requirement provider is required and has not been provided
Parameters:
  • resolver_fn (TShimmedFunc) – The resolver function used to create new resolver instances.
  • install_req_provider (TShimmedFunc) – The provider function to use to generate install requirements if needed.
  • format_control_provider (TShimmedFunc) – The provider function to use to generate a format_control instance if needed.
  • wheel_cache_provider (TShimmedFunc) – The provider function to use to generate a wheel cache if needed.
  • finder (Optional[TFinder]) – The package finder to use during resolution, defaults to None.
  • upgrade_strategy (str) – Upgrade strategy to use, defaults to only-if-needed.
  • force_reinstall (Optional[bool]) – Whether to simulate or assume package reinstallation during resolution, defaults to None
  • ignore_dependencies (Optional[bool]) – Whether to ignore package dependencies, defaults to None
  • ignore_requires_python (Optional[bool]) – Whether to ignore indicated required_python versions on packages, defaults to None
  • ignore_installed (bool) – Whether to ignore installed packages during resolution, defaults to True
  • use_user_site (bool) – Whether to use the user site location during resolution, defaults to False
  • isolated (Optional[bool]) – Whether to isolate the resolution process, defaults to None
  • wheel_cache (Optional[TWheelCache]) – The wheel cache to use, defaults to None
  • preparer (Optional[TPreparer]) – The requirement preparer to use, defaults to None
  • session (Optional[TSession]) – Existing session to use for getting requirements, defaults to None
  • options (Optional[Values]) – Pip options to use if needed, defaults to None
  • make_install_req (Optional[functools.partial]) – The partial function to pass in to the resolver for actually generating install requirements, if necessary
  • install_cmd (Optional[TCommandInstance]) – The install command used to create the finder, session, and options if needed, defaults to None.
  • use_pep517 (bool) – Whether to use the pep517 build process.
Returns:

A new resolver instance.

Return type:

Resolver

Example:
>>> import os
>>> from tempdir import TemporaryDirectory
>>> from pip_shims.shims import (
...     InstallCommand, get_package_finder, make_preparer, get_requirement_tracker,
...     get_resolver, InstallRequirement, RequirementSet
... )
>>> install_cmd = InstallCommand()
>>> pip_options, _ = install_cmd.parser.parse_args([])
>>> session = install_cmd._build_session(pip_options)
>>> finder = get_package_finder(
...     install_cmd, session=session, options=pip_options
... )
>>> wheel_cache = WheelCache(USER_CACHE_DIR, FormatControl(None, None))
>>> with TemporaryDirectory() as temp_base:
...     reqset = RequirementSet()
...     ireq = InstallRequirement.from_line("requests")
...     ireq.is_direct = True
...     build_dir = os.path.join(temp_base, "build")
...     src_dir = os.path.join(temp_base, "src")
...     ireq.build_location(build_dir)
...     with make_preparer(
...         options=pip_options, finder=finder, session=session,
...         build_dir=build_dir, install_cmd=install_cmd,
...     ) as preparer:
...         resolver = get_resolver(
...             finder=finder, ignore_dependencies=False, ignore_requires_python=True,
...             preparer=preparer, session=session, options=pip_options,
...             install_cmd=install_cmd, wheel_cache=wheel_cache,
...         )
...         resolver.require_hashes = False
...         reqset.add_requirement(ireq)
...         results = resolver.resolve(reqset)
...         #reqset.cleanup_files()
...         for result_req in reqset.requirements:
...             print(result_req)
requests
chardet
certifi
urllib3
idna
pip_shims.compat.get_session(install_cmd_provider=None, install_cmd=None, options=None)[source]
pip_shims.compat.get_tracker(tracker_creator=None, tracker_type='REQ')[source]
pip_shims.compat.make_preparer(preparer_fn, build_tracker_fn=None, req_tracker_fn=None, build_dir=None, src_dir=None, download_dir=None, wheel_download_dir=None, progress_bar='off', build_isolation=False, session=None, finder=None, options=None, require_hashes=None, use_user_site=None, req_tracker=None, build_tracker=None, install_cmd_provider=None, downloader_provider=None, install_cmd=None, finder_provider=None, verbosity=0, check_build_deps=False)[source]

Creates a requirement preparer for preparing pip requirements.

Provides a compatibilty shim that accepts all previously valid arguments and discards any that are no longer used.

Raises:
  • TypeError – No requirement tracker provided and one cannot be generated
  • TypeError – No valid sessions provided and one cannot be generated
  • TypeError – No valid finders provided and one cannot be generated
Parameters:
  • preparer_fn (TShimmedFunc) – Callable or shim for generating preparers.
  • req_tracker_fn (Optional[TShimmedFunc]) – Callable or shim for generating requirement trackers, defualts to None
  • build_dir (Optional[str]) – Directory for building packages and wheels, defaults to None
  • src_dir (Optional[str]) – Directory to find or extract source files, defaults to None
  • download_dir (Optional[str]) – Target directory to download files, defaults to None
  • wheel_download_dir (Optional[str]) – Target directoryto download wheels, defaults to None
  • progress_bar (str) – Whether to display a progress bar, defaults to off
  • build_isolation (bool) – Whether to build requirements in isolation, defaults to False
  • session (Optional[TSession]) – Existing session to use for getting requirements, defaults to None
  • finder (Optional[TFinder]) – The package finder to use during resolution, defaults to None
  • options (Optional[Values]) – Pip options to use if needed, defaults to None
  • require_hashes (Optional[bool]) – Whether to require hashes for preparation
  • use_user_site (Optional[bool]) – Whether to use the user site directory for preparing requirements
  • TShimmedFunc]] req_tracker (Optional[Union[TReqTracker,) – The requirement tracker to use for building packages, defaults to None
  • TShimmedFunc]] build_tracker (Optional[Union[TBuildTracker,) – The build tracker to use for building packages, defaults to None and fallsback to req_tracker.
  • downloader_provider (Optional[TShimmedFunc]) – A downloader provider
  • install_cmd (Optional[TCommandInstance]) – The install command used to create the finder, session, and options if needed, defaults to None
  • finder_provider (Optional[TShimmedFunc]) – A package finder provider
Yield:

A new requirement preparer instance

Return type:

ContextManager[RequirementPreparer]

Example:
>>> from pip_shims.shims import (
...     InstallCommand, get_package_finder, make_preparer, get_requirement_tracker
... )
>>> install_cmd = InstallCommand()
>>> pip_options, _ = install_cmd.parser.parse_args([])
>>> session = install_cmd._build_session(pip_options)
>>> finder = get_package_finder(
...     install_cmd, session=session, options=pip_options
... )
>>> with make_preparer(
...     options=pip_options, finder=finder, session=session, install_cmd=ic
... ) as preparer:
...     print(preparer)
<pip._internal.operations.prepare.RequirementPreparer object at 0x7f8a2734be80>
pip_shims.compat.partial_command(shimmed_path, cmd_mapping=None)[source]

Maps a default set of arguments across all members of a ShimmedPath instance, specifically for Command instances which need summary and name arguments.

:param ShimmedPath shimmed_path: A
ShimmedCollection instance
Parameters:cmd_mapping (Any) – A reference to use for mapping against, e.g. an import that depends on pip also
Returns:A dictionary mapping new arguments to their default values
Return type:Dict[str, str]
pip_shims.compat.populate_options(install_command=None, options=None, **kwargs)[source]
pip_shims.compat.resolve(ireq, reqset_provider=None, req_tracker_provider=None, install_cmd_provider=None, install_command=None, finder_provider=None, resolver_provider=None, wheel_cache_provider=None, format_control_provider=None, make_preparer_provider=None, tempdir_manager_provider=None, options=None, session=None, resolver=None, finder=None, upgrade_strategy='to-satisfy-only', force_reinstall=None, ignore_dependencies=None, ignore_requires_python=None, ignore_installed=True, use_user_site=False, isolated=None, build_dir=None, source_dir=None, download_dir=None, cache_dir=None, wheel_download_dir=None, wheel_cache=None, require_hashes=None, check_supported_wheels=True)[source]

Resolves the provided InstallRequirement, returning a dictionary.

Maps a dictionary of names to corresponding InstallRequirement values.

:param InstallRequirement ireq: An
InstallRequirement to initiate the resolution process
:param ShimmedPathCollection reqset_provider: A provider
to build requirement set instances.
:param ShimmedPathCollection req_tracker_provider: A
provider to build requirement tracker instances
Parameters:
  • install_cmd_provider (ShimmedPathCollection) – A shim for providing new install command instances.
  • install_command (Optional[TCommandInstance]) – The install command used to create the finder, session, and options if needed, defaults to None.
:param ShimmedPathCollection finder_provider: A provider
to package finder instances.
:param ShimmedPathCollection resolver_provider: A provider
to build resolver instances
Parameters:
  • wheel_cache_provider (TShimmedFunc) – The provider function to use to generate a wheel cache if needed.
  • format_control_provider (TShimmedFunc) – The provider function to use to generate a format_control instance if needed.
  • make_preparer_provider (TShimmedFunc) – Callable or shim for generating preparers.
  • tempdir_manager_provider (Optional[TShimmedFunc]) – Shim for generating tempdir manager for pip temporary directories
  • options (Optional[Values]) – Pip options to use if needed, defaults to None
  • session (Optional[TSession]) – Existing session to use for getting requirements, defaults to None
:param Resolver resolver: A pre-existing
resolver instance to use for resolution
Parameters:
  • finder (Optional[TFinder]) – The package finder to use during resolution, defaults to None.
  • upgrade_strategy (str) – Upgrade strategy to use, defaults to only-if-needed.
  • force_reinstall (Optional[bool]) – Whether to simulate or assume package reinstallation during resolution, defaults to None
  • ignore_dependencies (Optional[bool]) – Whether to ignore package dependencies, defaults to None
  • ignore_requires_python (Optional[bool]) – Whether to ignore indicated required_python versions on packages, defaults to None
  • ignore_installed (bool) – Whether to ignore installed packages during resolution, defaults to True
  • use_user_site (bool) – Whether to use the user site location during resolution, defaults to False
  • isolated (Optional[bool]) – Whether to isolate the resolution process, defaults to None
  • build_dir (Optional[str]) – Directory for building packages and wheels, defaults to None
  • source_dir (str) – The directory to use for source requirements. Removed in pip 10, defaults to None
  • download_dir (Optional[str]) – Target directory to download files, defaults to None
  • cache_dir (str) – The cache directory to use for caching artifacts during resolution
  • wheel_download_dir (Optional[str]) – Target directoryto download wheels, defaults to None
  • wheel_cache (Optional[TWheelCache]) – The wheel cache to use, defaults to None
  • require_hashes (bool) – Whether to require hashes when resolving. Defaults to False.
  • check_supported_wheels (bool) – Whether to check support of wheels before including them in resolution.
Returns:

A dictionary mapping requirements to corresponding :class:`~pip._internal.req.req_install.InstallRequirement`s

Return type:

InstallRequirement

Example:
>>> from pip_shims.shims import resolve, InstallRequirement
>>> ireq = InstallRequirement.from_line("requests>=2.20")
>>> results = resolve(ireq)
>>> for k, v in results.items():
...    print("{0}: {1!r}".format(k, v))
requests: <InstallRequirement object: requests>=2.20 from https://files.pythonhosted.
org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/reque
sts-2.22.0-py2.py3-none-any.whl#sha256=9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590
f48c010551dc6c4b31 editable=False>
idna: <InstallRequirement object: idna<2.9,>=2.5 from https://files.pythonhosted.org/
packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-
py2.py3-none-any.whl#sha256=ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432
f7e4a3c (from requests>=2.20) editable=False>
urllib3: <InstallRequirement object: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 from htt
ps://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f19
3a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl#sha256=a8a318824cc77d1fd4b2bec
2ded92646630d7fe8619497b142c84a9e6f5a7293 (from requests>=2.20) editable=False>
chardet: <InstallRequirement object: chardet<3.1.0,>=3.0.2 from https://files.pythonh
osted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8
/chardet-3.0.4-py2.py3-none-any.whl#sha256=fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed
4531e3e15460124c106691 (from requests>=2.20) editable=False>
certifi: <InstallRequirement object: certifi>=2017.4.17 from https://files.pythonhost
ed.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/ce
rtifi-2019.9.11-py2.py3-none-any.whl#sha256=fd7c7c74727ddcf00e9acd26bba8da604ffec95bf
1c2144e67aff7a8b50e6cef (from requests>=2.20) editable=False>
pip_shims.compat.resolve_possible_shim(target)[source]
pip_shims.compat.shim_unpack(unpack_fn, download_dir, tempdir_manager_provider, ireq=None, link=None, location=None, hashes=None, progress_bar='off', only_download=None, downloader_provider=None, session=None, verbosity=0)[source]

Accepts all parameters that have been valid to pass to pip._internal.download.unpack_url() and selects or drops parameters as needed before invoking the provided callable.

Parameters:
  • unpack_fn (Callable) – A callable or shim referring to the pip implementation
  • download_dir (str) – The directory to download the file to
  • tempdir_manager_provider (TShimmedFunc) – A callable or shim referring to global_tempdir_manager function from pip or a shimmed no-op context manager
:param Optional[InstallRequirement] ireq:
an Install Requirement instance, defaults to None
:param Optional[Link] link: A Link instance,
defaults to None.
Parameters:
  • location (Optional[str]) – A location or source directory if the target is a VCS url, defaults to None.
  • hashes (Optional[Any]) – A Hashes instance, defaults to None
  • progress_bar (str) – Indicates progress par usage during download, defatuls to off.
  • only_download (Optional[bool]) – Whether to skip install, defaults to None.
  • downloader_provider (Optional[ShimmedPathCollection]) – A downloader class to instantiate, if applicable.
  • session (Optional[Session]) – A PipSession instance, defaults to None.
  • verbosity (Optional[int]) – 1 or 0 to indicate verbosity flag, defaults to 0.
Returns:

The result of unpacking the url.

Return type:

None

pip_shims.compat.temp_environ()[source]

Allow the ability to set os.environ temporarily

pip_shims.compat.wheel_cache(cache_dir=None, format_control=None, wheel_cache_provider=None, format_control_provider=None, tempdir_manager_provider=None)[source]