Run some python before your pip commands.
Project description
Run some python code just before your pip commands.
Use cases
- Before installing a package, check it against a list of known malicious packages.
- Upgrade pip automatically before installing a package.
- Inject pip proxy settings into the environment before installing a package.
You can use it to run any custom python code before a pip command is executed.
Supported shells
The following shells are currently supported:
zshbash
I'm currently working on adding support for powershell and will thereafter look at fish.
Contributions for any other shells are welcome.
Installation
pip install pre-pip
There is potential to make this pipx installable.
Usage
Install pre-pip into your .*rc file using:
pre-pip install
Register a custom demo hook
Create a new file called hook.py in your current directory with the following content:
# hook.py
from rich import print as rprint
def main(args):
rprint(
f"This [italic green]pre-pip[/italic green] hook received: [italic cyan]{args}[/italic cyan]",
)
Register the hook using:
pre-pip add hook.py
You can view the list of registered hooks using:
pre-pip list
Uninstall
Uninstall pre-pip using:
pre-pip uninstall
This will remove the pre-pip hook from your .*rc file as well as all registered hooks.
To remove the pre-pip package, use:
pip uninstall pre-pip
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pre_pip-0.1.3.tar.gz.
File metadata
- Download URL: pre_pip-0.1.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbf446b535401622d6338acd69a237a608f27c02d74c16ad50a2416605bcf97b
|
|
| MD5 |
7036acfc8c28a1a595c39eb1939b7c20
|
|
| BLAKE2b-256 |
ecd7cc698967f57f0b17c9f9b9e694f1837193397de6d1a16248eaa93f5ffe2c
|
File details
Details for the file pre_pip-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pre_pip-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1aa4430e14084338fc28b3bf368d3efd403073e318fa570cac34e8ae1e11fc3
|
|
| MD5 |
6a8be2f476d69a3bdfda7116da28a6c2
|
|
| BLAKE2b-256 |
0f03eec098e25c5e902850834b6c334629c978c718585193452a089be0901bbd
|