Skip to main content

A drop-in replacement for pip

Project description

pipim: PIP IMproved

Drop-in replacement for pip with behavior that imitates other popular languages packages managers.

Installing

pip install --user pipim

Then, if you wish for pipim to be invoked when you simply type pip, you can use pipim replace-pip to create a script in ~/.local/bin/pip that will run pipim.

Rationale

When you work on Python projects, you often find yourself creating virtual environments, and having to manually activate them or install dependencies in them.

This is not something you typically do with other languages, where the package manager is smart enough to know if you meant to install packages at the user level or at the project level.

This is more or less in line with the Zen of Python: explicit is better than implicit. However I grew tired of having this behavior available everywhere except with Python, so I decided to write a simple wrapper around pip that will use virtual environments by default, unless --user is passed.

Features

By default, pipim will be installed as pipim, however, you can use it as a drop-in replacement of pip, and the following examples assume you did.

Automatic use of virtual environments

The following commands will automatically create a virtual environment called .venv/ if one does not exist already, and then the actual commands inside of it:

pip install package1 [package2...]
pip uninstall package1 [package2...]

If you wish to work outside of a virtual environment, you can use the --user flag. This will try to use pipus if it is found in your PATH, and will resort to regular pip otherwise.

Install packages from requirements.txt

If you do not specify any package, this will run pip install -r requirements.txt in the virtual environment. As with other install commands, this will create the venv first if it does not exist already.

Simply run:

pip
# or
pip install

Easily installs itself as a replacement

You can use pipim replace-pip once to create a simple script in ~/.local/bin/pip that will invoke pipim instead of pip. This will allow you to forget about pipim and just run pip like you always did before, except that now it comes with extra perks ✨✨.

Run a command inside the virtual environment

pip run <command> [arguments...]

The first argument will be invoked from .venv/bin/, everything that follows is passed to it. For example:

pip run flask --help

Always fallback to regular pip

Every unmatched flags are passed down to pip, any unrecognized command will run pip too.

Contributing

Noticed a bug? Want to request a feature? Simply open a new Issue.

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

pipim-1.2.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipim-1.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pipim-1.2.0.tar.gz.

File metadata

  • Download URL: pipim-1.2.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for pipim-1.2.0.tar.gz
Algorithm Hash digest
SHA256 02e77a0366c8c4aa24e08e5de1f4abebb7227a65bcf2fefb29a2a88c452c2d1a
MD5 203836ec3290fff63292f08c5b1ffb74
BLAKE2b-256 42cee49595f4953e366dad5b6f36c50df020ba2bfc9c71ace119adad034d7fb4

See more details on using hashes here.

File details

Details for the file pipim-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pipim-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for pipim-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a38656fb43ae814b544a148f4bd4f8411e44a76082c897cfe1e4d0b0a63f1428
MD5 aedf495e03c51fdc64d31023e03779be
BLAKE2b-256 5ebb6c1fabcb373033cf43d3dd6864b6e02caf334e2809158078f155e6f8d818

See more details on using hashes here.

Supported by

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