Documentation for pip the python package (rather than the command line tool)

Question:

When you install pip, you get a Python package as well as a command line tool. For example, you can print a list of Python packages like this:

import pip

print pip.get_installed_distributions()

However I can’t find any documentation for this package. Searching some of the function names doesn’t come up with anything, and sites like PyPi and Wikipedia link to the command line docs.

Is using pip via import pip documented?

Asked By: bckygldstn

||

Answers:

No, the pip API is neither documented nor guaranteed to be stable. There are proposals to rectify this, but not much progress.

If you’re looking to play around with the internals, there are some examples of usage here, but beware that the API could change in later versions.

Update, October 2022:

The documentation now states:

While it is implemented in Python, and so is available from your Python code via import pip, you must not use pip’s internal APIs in this way.

Answered By: Kim
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.