Skip to main content

Compatibility shims for pip versions 8 thru current.

Project description Build Status!-1EAEDB.svg Documentation Status



The authors of pip do not condone the use of this package. Relying on pip’s internals is a dangerous idea for your software as they are broken intentionally and regularly. This package may not always be completely updated up PyPI, so relying on it may break your code! User beware!


Install from PyPI:

$ pipenv install pip-shims

Install from Github:

$ pipenv install -e git+


pip-shims is a set of compatibilty access shims to the pip internal API. pip-shims provides compatibility across several pip releases. The shims are provided using a lazy import strategy by hacking a module by overloading a class instance’s getattr method. This library exists due to my constant writing of the same set of import shims across many different libraries, including pipenv, pip-tools, requirementslib, and passa.

Pip Compatibility

Due to the fact that pip has adopted calver, this project provides shims for pip releases up to 2 years. pip earlier than that period MAY work but the compatibility isn’t guaranteed by the continous integration. For example, the support for pip==20.0 will be dropped at 1/1/2023.


Importing a shim

You can use pip-shims to expose elements of pip’s internal API by importing them:

>>> from pip_shims import Wheel
>>> mywheel = Wheel('/path/to/my/wheel.whl')

Resolving Dependencies

You can resolve the dependencies of a package using the shimmed resolver interface:

>>> 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 editable=False>
idna: <InstallRequirement object: idna<2.9,>=2.5 from (from requests>=2.20) editable=False>
urllib3: <InstallRequirement object: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 from (from requests>=2.20) editable=False>
chardet: <InstallRequirement object: chardet<3.1.0,>=3.0.2 from (from requests>=2.20) editable=False>
certifi: <InstallRequirement object: certifi>=2017.4.17 from (from requests>=2.20) editable=False>

Available Shims

pip-shims provides the following compatibility shims:

Import Path Import Name Former Path
__version__ pip_version  
<shimmed> build_wheel  
<shimmed> get_package_finder  
<shimmed> get_requirement_set  
<shimmed> get_resolver  
<shimmed> is_archive_file download
<shimmed> is_file_url download
<shimmed> make_preparer  
<shimmed> resolve  
<shimmed> shim_unpack  
cache WheelCache wheel
cli cmdoptions cmdoptions
cli.base_command Command basecommand
cli.cmdoptions index_group cmdoptions
cli.cmdoptions make_option_group cmdoptions
cli.parser ConfigOptionParser baseparser
cli.req_command SessionCommandMixin  
collector LinkCollector  
commands commands_dict  
commands.freeze DEV_PKGS  
commands.install InstallCommand  
distributions make_distribution_for_install_requirement operations.prepare.make_abstract_dist
distributions.base AbstractDistribution  
distributions.installed InstalledDistribution  
distributions.source SourceDistribution  
distributions.wheel WheelDistribution  
download path_to_url  
download unpack_url  
exceptions BadCommand  
exceptions BestVersionAlreadyInstalled  
exceptions CommandError  
exceptions DistributionNotFound  
exceptions DistributionNotFound  
exceptions InstallationError  
exceptions PipError  
exceptions PreviousBuildDirError  
exceptions RequirementsFileParseError  
exceptions UninstallationError  
index CandidateEvaluator  
index CandidatePreferences  
index LinkEvaluator  
index PackageFinder  
index parse_version  
locations USER_CACHE_DIR  
models FormatControl index
models.index PyPI Link index
models.search_scope SearchScope  
models.selection_prefs SelectionPreferences  
models.target_python TargetPython  
network.cache SafeFileCache download
operations.freeze FrozenRequirement <__init__>
operations.prepare Downloader  
operations.prepare make_abstract_dist req.req_set
operations.prepare RequirementPreparer  
pep425tags get_supported  
pep425tags get_tags  
req.constructors _strip_extras req.req_install
req.constructors install_req_from_editable req.req_install.InstallRequirement
req.constructors install_req_from_line req.req_install.InstallRequirement
req.constructors install_req_from_req_string  
req.req_file parse_requirements  
req.req_install InstallRequirement  
req.req_set RequirementSet  
req.req_tracker get_requirement_tracker  
req.req_tracker RequirementTracker  
req.req_uninstall UninstallPathSet  
resolve Resolver  
utils.compat stdlib_pkgs compat
utils.hashes FAVORITE_HASH  
utils.misc get_installed_distributions utils
utils.misc is_installable_dir utils
utils.temp_dir global_tempdir_manager  
utils.temp_dir TempDirectory  
utils.urls url_to_path download
vcs.versioncontrol VcsSupport vcs.VcsSupport
wheel Wheel  
wheel WheelBuilder  
wheel_builder build  
wheel_builder build_one  
wheel_builder build_one_inside_env  

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pip-shims, version 0.6.0
Filename, size File type Python version Upload date Hashes
Filename, size pip_shims-0.6.0.tar.gz (46.6 kB) File type Source Python version None Upload date Hashes View
Filename, size pip_shims-0.6.0-py2.py3-none-any.whl (34.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page