pipwrap
A Python wrapper around pip install with support for multiple package indexes and direct URL installs.
Features
- Multi-index support — pass multiple index URLs; the first is used as
--index-url, the rest as --extra-index-url
- Direct URL installs — install packages from tar.gz URLs
- Debug logging — all commands and output are logged to a temp file for troubleshooting
- CLI and library — use as a command-line tool or import into your own code
Installation
pip install .
Or with uv:
uv pip install .
CLI Usage
Install packages from the default index:
pipwrap requests flask
Install from a private index with a fallback:
pipwrap requests \
--index-url https://private.pypi.org/simple \
--index-url https://pypi.org/simple
The first --index-url becomes the primary index. Any additional --index-url values are passed as --extra-index-url to pip.
Install directly from tar.gz URLs:
pipwrap --from-url https://example.com/packages/foo-1.0.tar.gz
Combine URL installs with custom indexes:
pipwrap --from-url https://example.com/foo-1.0.tar.gz \
--index-url https://private.pypi.org/simple
Library Usage
from pipwrap.installer import PInst
installer = PInst()
installer.install(["requests", "flask"])
installer.install(
["my-private-pkg"],
index_urls=[
"https://private.pypi.org/simple",
"https://pypi.org/simple",
],
)
installer.install_from_urls(["https://example.com/foo-1.0.tar.gz"])
Logging
All pip commands and their output are logged to a temporary file. To find the log:
from pipwrap.logger import get_log_path
print(get_log_path())
Development
uv sync
uv run pytest -q
uv run ruff check .
License
MIT