pip-manage lets you smoothly manage your installed packages.
Project description
pip-manage
pip-manage
lets you smoothly manage your installed packages.
Installation
To install, simply use pip:
pip install pip-manage
Alternatively:
pip install git+https://github.com/realshouzy/pip-manage
Decide for yourself whether you want to install the tool system-wide, or inside a virtual env. Both are supported.
Documentation
pip-manage
includes two tools pip-review
and pip-purge
.
pip-review
pip-review
is a convenience wrapper around pip
. It can list
available updates by deferring to pip list --outdated
. It can also
automatically or interactively install available updates for you by
deferring to pip install
.
Example, report-only:
$ pip-review
requests==0.13.4 is available (you have 0.13.2)
redis==2.4.13 is available (you have 2.4.9)
rq==0.3.2 is available (you have 0.3.0)
You can also print raw lines:
$ pip-review --raw
requests==0.13.4
redis==2.4.13
rq==0.3.2
Example, actually install everything:
$ pip-review --auto
... <pip install output>
Example, run interactively, ask to upgrade for each package:
$ pip-review --interactive
requests==0.14.0 is available (you have 0.13.2)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit y
...
redis==2.6.2 is available (you have 2.4.9)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit n
rq==0.3.2 is available (you have 0.3.0)
Upgrade now? [Y]es, [N]o, [A]ll, [Q]uit y
...
Example, preview for update target list by pip list --outdated
format,
with run interactively or install everything:
$ pip-review --interactive --preview
Package Version Latest Type
-----------------------------
redis 2.4.9 2.6.2 wheel
requests 0.13.2 0.14.0 wheel
rq 0.3.0 0.3.4 wheel
-----------------------------
... < --interactive processing >
You can also freeze the packages that will be upgraded to a file before actually upgrading them.
$ pip-review --auto --freeze-outdated-packages
... <pip install output>
By default it will safe them to backup.txt
in the current directory, but you can specify the file path using the --freeze-file
option.
Run pip-review -h
for a complete overview of the options.
Note: If you want to pin specific packages to prevent them from
automatically being upgraded, you can use a constraint file (similar to
requirements.txt
):
$ export PIP_CONSTRAINT="${HOME}/constraints.txt"
$ cat $PIP_CONSTRAINT
pyarrow==0.14.1
pandas<0.24.0
$ pip-review --auto
...
Set this variable in .bashrc
or .zshenv
to make it persistent.
- Linux:
$ cat ~/.config/pip/pip.conf
[global]
constraint = /home/username/constraints.txt
- Windows:
$ cat $HOME\AppData\Roaming\pip\pip.ini
[global]
constraint = '$HOME\Roaming\pip\constraints.txt'
The conf file are dependent of the user, so If you use multiple users you must define config file for each of them. https://pip.pypa.io/en/stable/user_guide/#constraints-files
Alternatively, since arguments that are also options for pip install
or pip list --outdated
will be forwarded,
you can pass the constraint files directly as an argument using the --constraint
option of pip install
.
Like pip
, pip-review
updates all upgradeable packages, including pip
and
pip-manage
.
pip-purge
pip-purge
enables you to uninstall a package along with all its dependencies that are not required by any other packages.
Simply specify the packages you want to purge, and pip-purge
will handle the dependency resolution for you, ensuring that no other packages are broken in the process.
It uses the importlib.metadata
module to resolve the dependencies and then deferres to pip uninstall
.
Example:
$ pip-purge requests
The following packages will be uninstalled: certifi, charset-normalizer, idna, requests, urllib3
Running: ...
You can also read from a requirements file. The read packages will be purged:
$ pip-purge --requirement requirements.txt
...
If you want to exclude certain packages, you can do that as follows:
$ pip-purge requests --exclude urllib3
The following packages will be uninstalled: certifi, charset-normalizer, idna, requests
Running: ...
Sometimes packages have extra / optional dependencies. These are considered by default, but can be ignored:
$ pip-purge requests --ignore-extra
...
It's recommended to do a dry run first, which performs all operations normally but doesn't defer to pip uninstall
:
$ pip-purge requests --dry-run
The following packages will be uninstalled: certifi, charset-normalizer, idna, requests, urllib3
Would run: ...
You can also freeze the packages that will be uninstalled to a file before actually purging them.
$ pip-review requests --freeze-purged-packages
...
By default it will safe them to backup.txt
in the current directory, but you can specify the file path using the --freeze-file
option.
Run pip-purge -h
for a complete overview of the options.
Contributing
If you are interested in contributing to this project, please refer here for more information.
Origins and credit
pip-review
is derived from the original project of the same name created by Julian Gonggrijp. This fork is a refactored and enhanced version of the original.
Included from the original project:
pip-review
was originally part of
pip-tools but has been
discontinued as such.
See Pin Your Packages by
Vincent Driessen for the original introduction. Since there are still
use cases, the tool now lives on as a separate package.
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
File details
Details for the file pip_manage-1.1.2.tar.gz
.
File metadata
- Download URL: pip_manage-1.1.2.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b8c947e0459c0b1e079a6b01872c66788e87c2094bbd36881bc33c31d0cb918 |
|
MD5 | cdb4503288fd7825f3b6eb59ae4870e9 |
|
BLAKE2b-256 | c69e3ac553668d8d67d600642211dde025e0317f48d277e5b8b3d5406b442d01 |
File details
Details for the file pip_manage-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: pip_manage-1.1.2-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd5639d69909ecf591c256a5bc9d2c20e3163e7209ed7de5ba14f5e25e94944c |
|
MD5 | 51ef7bfa97f1c6e14f0da8579a190877 |
|
BLAKE2b-256 | 53d66e4139042bc808af702376949dcccccb1a4879f3076dbaab8b64ba60a567 |