di / pip-api

An unofficial, importable pip API
https://pypi.org/p/pip-api
Apache License 2.0
110 stars 15 forks source link

GitHub - License PyPI - Python Version PyPI - Package Version Conda - Platform Conda (channel only) Conda Recipe

Since pip is a command-line-tool, it does not have an official, supported, importable API.

However, this does not mean that people haven't tried to import pip, usually to end up with much headache when pip's maintainers do routine refactoring.

Goal

The goal of this project is to provide an importable pip API, which is fully compliant with the recommended method of using pip from your program.

How? By providing an importable API that wraps command-line calls to pip, this library can be used as a drop-in replacement for existing uses of pip's internal API.

Scope

This goal means that any new API added here must have the following equivalents:

Any functionality that is not currently possible from internal pip API or CLI calls is out of scope.

Installation

You can install pip-api with either pip or with conda.

With pip:

python -m pip install pip-api

With conda:

conda install -c conda-forge pip-api

Supported Commands

Not all commands are supported in all versions of pip and on all platforms. If the command you are trying to use is not compatible, pip_api will raise a pip_api.exceptions.Incompatible exception for your program to catch.

Available with all pip versions:

Use cases

This library is in use by a number of other tools, including: