Skip to main content

No project description provided

Project description

Run some python code just before your pip commands.

Publish Package version


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

Currently only zsh is supported, I'm currently working on adding support bash and powershell.

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 demo_hook.py in your current directory with the following content:

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 register ./demo_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

MIT

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

pre_pip-0.1.1.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

pre_pip-0.1.1-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page