gcpipwrap
Advanced tools
+13
-0
| """Wrapper around pip install with multi-index and URL support.""" | ||
| import subprocess | ||
| import site | ||
| import os | ||
@@ -96,1 +98,12 @@ from pipwrap.logger import setup_logger | ||
| return result | ||
| def reset_environment(self) -> None: | ||
| """Reset the environment to the state it was in before the installer was created.""" | ||
| if "PYTHONPATH" in os.environ: | ||
| os.environ.pop("PYTHONPATH") | ||
| if "PYTHONNOUSERSITE" in os.environ: | ||
| os.environ.pop("PYTHONNOUSERSITE") | ||
| if "PYTHONUSERBASE" in os.environ: | ||
| os.environ.pop("PYTHONUSERBASE") | ||
| site.addsitedir(site.getusersitepackages()) |
+101
-1
| Metadata-Version: 2.4 | ||
| Name: gcpipwrap | ||
| Version: 0.1.2 | ||
| Version: 0.1.3 | ||
| Summary: Wrapper around pip with multi-index and URL install support | ||
| Requires-Python: >=3.13 | ||
| Description-Content-Type: text/markdown | ||
| # 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 | ||
| ```bash | ||
| pip install . | ||
| ``` | ||
| Or with [uv](https://docs.astral.sh/uv/): | ||
| ```bash | ||
| uv pip install . | ||
| ``` | ||
| ## CLI Usage | ||
| Install packages from the default index: | ||
| ```bash | ||
| pipwrap requests flask | ||
| ``` | ||
| Install from a private index with a fallback: | ||
| ```bash | ||
| 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: | ||
| ```bash | ||
| pipwrap --from-url https://example.com/packages/foo-1.0.tar.gz | ||
| ``` | ||
| Combine URL installs with custom indexes: | ||
| ```bash | ||
| pipwrap --from-url https://example.com/foo-1.0.tar.gz \ | ||
| --index-url https://private.pypi.org/simple | ||
| ``` | ||
| ## Library Usage | ||
| ```python | ||
| from pipwrap.installer import PInst | ||
| installer = PInst() | ||
| # Install packages | ||
| installer.install(["requests", "flask"]) | ||
| # Install with custom indexes | ||
| installer.install( | ||
| ["my-private-pkg"], | ||
| index_urls=[ | ||
| "https://private.pypi.org/simple", | ||
| "https://pypi.org/simple", | ||
| ], | ||
| ) | ||
| # Install from direct URLs | ||
| 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: | ||
| ```python | ||
| from pipwrap.logger import get_log_path | ||
| print(get_log_path()) # e.g. /tmp/pipwrap.log | ||
| ``` | ||
| ## Development | ||
| ```bash | ||
| uv sync | ||
| uv run pytest -q | ||
| uv run ruff check . | ||
| ``` | ||
| ## License | ||
| MIT |
+2
-1
@@ -7,4 +7,5 @@ [build-system] | ||
| name = "gcpipwrap" | ||
| version = "0.1.2" | ||
| version = "0.1.3" | ||
| description = "Wrapper around pip with multi-index and URL install support" | ||
| readme = "README.md" | ||
| requires-python = ">=3.13" | ||
@@ -11,0 +12,0 @@ dependencies = [] |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
22605
12.79%424
2.66%