pip-index
Manage Python package indexes
TLDR
List all available versions of a package
List versions from a specific index
Include pre-release versions
Include an additional index
List versions for a specific platform
SYNOPSIS
For searching packages:
pip index search [options] <query>
For listing package versions:
pip index versions [options] <package-name>
PARAMETERS
<query>
The keyword or partial name used to search for packages with pip index search.
<package-name>
The exact name of the package for which to list all available versions using pip index versions.
-i, --index-url <url>
Base URL of the Python Package Index to use (defaults to https://pypi.org/simple). Can be overridden.
--extra-index-url <url>
Add an additional index URL to search for packages, besides the primary --index-url.
--pre
Include pre-release and development versions when searching or listing package versions.
--trusted-host <hostname>
Mark this host as trusted, even if it does not have valid HTTPS certificates. Use with caution.
--timeout <seconds>
Set the socket timeout in seconds for network operations (default is 15 seconds).
--no-color
Suppress colored output from the command.
-v, --verbose
Give more output. Can be specified multiple times to increase verbosity.
-q, --quiet
Give less output. Can be specified multiple times to decrease verbosity.
DESCRIPTION
The pip index command is a powerful utility within the pip ecosystem for interacting with Python package indexes, primarily PyPI (Python Package Index). It serves as the primary tool for discovering available Python packages, their descriptions, and version histories. Introduced to replace the deprecated pip search, pip index offers a more structured and robust interface.
It provides two main subcommands:
search: Used to query the package index for packages matching specific keywords or names. It's invaluable for developers looking for libraries to solve particular problems or exploring the vast collection of open-source Python projects.
versions: Allows users to retrieve a comprehensive list of all available versions for a given package, including pre-releases if specified. This is crucial for understanding a package's development history, compatibility, and for specifying exact versions during installation.
While pip index primarily queries remote indexes, it also supports specifying custom index URLs, making it flexible for corporate or private package repositories.
CAVEATS
The pip index command requires an active internet connection to query remote package indexes like PyPI. The accuracy and comprehensiveness of search results are dependent on the capabilities of the queried index. While pip index versions provides structured output, the output of pip index search is primarily for human readability and is not guaranteed to be stable for programmatic parsing. It fully replaced the older, less feature-rich pip search command.
USAGE EXAMPLES
To search for packages containing 'flask':pip index search flask
To list all versions of the 'requests' package, including pre-releases:pip index versions --pre requests
To search for a package on a specific private index:pip index search -i https://private.pypi.example.com/simple my-private-package
OUTPUT FORMAT
pip index search: Presents a list of packages matching the query, typically showing the package name, its latest version, and a brief description. The output is formatted for human readability and is designed for quick discovery.
pip index versions: Displays a chronological list of all available versions for the specified package, often including release dates or upload times. This output is more structured and can be easier to process programmatically, for example, when scripting version checks.
HISTORY
The functionality now encapsulated by pip index was originally provided by the pip search command. However, due to limitations and the desire for a more robust and extensible interface for interacting with package indexes, pip index was introduced. It first appeared as an experimental command in pip version 21.2 (released July 2021) and officially replaced pip search, with the latter being deprecated and eventually removed, in pip 22.0 (released January 2022). This evolution aimed to provide distinct subcommands (search and versions) for clearer and more targeted interactions with PyPI and other package indexes.


