# pip-manage
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/realshouzy/pip-manage/main.svg)](https://results.pre-commit.ci/latest/github/realshouzy/pip-manage/main)
[![pylint status](https://github.com/realshouzy/pip-manage/actions/workflows/pylint.yaml/badge.svg)](https://github.com/realshouzy/pip-manage/actions/workflows/pylint.yaml)
[![tests status](https://github.com/realshouzy/pip-manage/actions/workflows/test.yaml/badge.svg)](https://github.com/realshouzy/pip-manage/actions/workflows/test.yaml)
[![CodeQL](https://github.com/realshouzy/pip-manage/actions/workflows/codeql.yaml/badge.svg)](https://github.com/realshouzy/pip-manage/actions/workflows/codeql.yaml)
[![PyPI - Version](https://img.shields.io/pypi/v/pip-manage)](https://github.com/realshouzy/pip-manage/releases/latest)
[![Python versions](https://img.shields.io/pypi/pyversions/pip-manage.svg)](https://pypi.org/project/pip-manage/)
[![Licens](https://img.shields.io/pypi/l/pip-manage)](https://github.com/realshouzy/pip-review/blob/main/LICENSE)
[![semantic-release](https://img.shields.io/badge/%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/realshouzy/pip-manage/releases)
[![PyPI - Format](https://img.shields.io/pypi/format/pip-manage)](https://pypi.org/project/pip-manage/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
**`pip-manage` lets you smoothly manage your installed packages.**
## Installation
To install, simply use pip:
```shell
pip install pip-manage
```
Alternatively:
```shell
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`](#pip-review) and [`pip-purge`](#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:
```console
$ 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:
```console
$ pip-review --raw
requests==0.13.4
redis==2.4.13
rq==0.3.2
```
Example, actually install everything:
```console
$ pip-review --auto
... <pip install output>
```
Example, run interactively, ask to upgrade for each package:
```console
$ 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:
```console
$ 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.
```console
$ 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`):
```console
$ 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:
```console
$ cat ~/.config/pip/pip.conf
[global]
constraint = /home/username/constraints.txt
```
- Windows:
```console
$ 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:
```console
$ 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:
```console
$ pip-purge --requirement requirements.txt
...
```
If you want to exclude certain packages, you can do that as follows:
```console
$ 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:
```console
$ 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`:
```console
$ 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.
```console
$ 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](/CONTRIBUTING.md) 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](https://github.com/jgonggrijp/pip-review).
Included from the original project:
`pip-review` was originally part of
[pip-tools](https://github.com/nvie/pip-tools/) but has been
[discontinued](https://github.com/nvie/pip-tools/issues/185) as such.
See [Pin Your Packages](http://nvie.com/posts/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.
Raw data
{
"_id": null,
"home_page": null,
"name": "pip-manage",
"maintainer": "realshouzy",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pip, pip-purge, pip-review, update, autoupdate, autouninstall, dependencies",
"author": "realshouzy, Vincent Driessen",
"author_email": "Julian Gonggrijp <j.gonggrijp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c6/9e/3ac553668d8d67d600642211dde025e0317f48d277e5b8b3d5406b442d01/pip_manage-1.1.2.tar.gz",
"platform": "any",
"description": "# pip-manage\n\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/realshouzy/pip-manage/main.svg)](https://results.pre-commit.ci/latest/github/realshouzy/pip-manage/main)\n[![pylint status](https://github.com/realshouzy/pip-manage/actions/workflows/pylint.yaml/badge.svg)](https://github.com/realshouzy/pip-manage/actions/workflows/pylint.yaml)\n[![tests status](https://github.com/realshouzy/pip-manage/actions/workflows/test.yaml/badge.svg)](https://github.com/realshouzy/pip-manage/actions/workflows/test.yaml)\n[![CodeQL](https://github.com/realshouzy/pip-manage/actions/workflows/codeql.yaml/badge.svg)](https://github.com/realshouzy/pip-manage/actions/workflows/codeql.yaml)\n[![PyPI - Version](https://img.shields.io/pypi/v/pip-manage)](https://github.com/realshouzy/pip-manage/releases/latest)\n[![Python versions](https://img.shields.io/pypi/pyversions/pip-manage.svg)](https://pypi.org/project/pip-manage/)\n[![Licens](https://img.shields.io/pypi/l/pip-manage)](https://github.com/realshouzy/pip-review/blob/main/LICENSE)\n[![semantic-release](https://img.shields.io/badge/%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/realshouzy/pip-manage/releases)\n[![PyPI - Format](https://img.shields.io/pypi/format/pip-manage)](https://pypi.org/project/pip-manage/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n\n**`pip-manage` lets you smoothly manage your installed packages.**\n\n## Installation\n\nTo install, simply use pip:\n\n```shell\npip install pip-manage\n```\n\nAlternatively:\n\n```shell\npip install git+https://github.com/realshouzy/pip-manage\n```\n\nDecide for yourself whether you want to install the tool system-wide, or\ninside a virtual env. Both are supported.\n\n## Documentation\n\n`pip-manage` includes two tools [`pip-review`](#pip-review) and [`pip-purge`](#pip-purge).\n\n### pip-review\n\n`pip-review` is a convenience wrapper around `pip`. It can list\navailable updates by deferring to `pip list --outdated`. It can also\nautomatically or interactively install available updates for you by\ndeferring to `pip install`.\n\nExample, report-only:\n\n```console\n$ pip-review\nrequests==0.13.4 is available (you have 0.13.2)\nredis==2.4.13 is available (you have 2.4.9)\nrq==0.3.2 is available (you have 0.3.0)\n```\n\nYou can also print raw lines:\n\n```console\n$ pip-review --raw\nrequests==0.13.4\nredis==2.4.13\nrq==0.3.2\n```\n\nExample, actually install everything:\n\n```console\n$ pip-review --auto\n... <pip install output>\n```\n\nExample, run interactively, ask to upgrade for each package:\n\n```console\n$ pip-review --interactive\nrequests==0.14.0 is available (you have 0.13.2)\nUpgrade now? [Y]es, [N]o, [A]ll, [Q]uit y\n...\nredis==2.6.2 is available (you have 2.4.9)\nUpgrade now? [Y]es, [N]o, [A]ll, [Q]uit n\nrq==0.3.2 is available (you have 0.3.0)\nUpgrade now? [Y]es, [N]o, [A]ll, [Q]uit y\n...\n```\n\nExample, preview for update target list by `pip list --outdated` format,\nwith run interactively or install everything:\n\n```console\n$ pip-review --interactive --preview\nPackage Version Latest Type\n-----------------------------\nredis 2.4.9 2.6.2 wheel\nrequests 0.13.2 0.14.0 wheel\nrq 0.3.0 0.3.4 wheel\n-----------------------------\n... < --interactive processing >\n```\n\nYou can also freeze the packages that will be upgraded to a file before actually upgrading them.\n\n```console\n$ pip-review --auto --freeze-outdated-packages\n... <pip install output>\n```\n\nBy default it will safe them to `backup.txt` in the current directory, but you can specify the file path using the `--freeze-file` option.\n\nRun `pip-review -h` for a complete overview of the options.\n\nNote: If you want to pin specific packages to prevent them from\nautomatically being upgraded, you can use a constraint file (similar to\n`requirements.txt`):\n\n```console\n$ export PIP_CONSTRAINT=\"${HOME}/constraints.txt\"\n$ cat $PIP_CONSTRAINT\npyarrow==0.14.1\npandas<0.24.0\n\n$ pip-review --auto\n...\n```\n\nSet this variable in `.bashrc` or `.zshenv` to make it persistent.\n\n- Linux:\n\n```console\n$ cat ~/.config/pip/pip.conf\n[global]\nconstraint = /home/username/constraints.txt\n```\n\n- Windows:\n\n```console\n$ cat $HOME\\AppData\\Roaming\\pip\\pip.ini\n[global]\nconstraint = '$HOME\\Roaming\\pip\\constraints.txt'\n```\n\nThe conf file are dependent of the user, so If you use multiple users\nyou must define config file for each of them.\n<https://pip.pypa.io/en/stable/user_guide/#constraints-files>\n\nAlternatively, since arguments that are also options for `pip install` or `pip list --outdated` will be forwarded,\nyou can pass the constraint files directly as an argument using the `--constraint` option of `pip install`.\n\nLike `pip`, `pip-review` updates **all** upgradeable packages, including `pip` and\n`pip-manage`.\n\n### pip-purge\n\n`pip-purge` enables you to uninstall a package along with all its dependencies that are not required by any other packages.\nSimply 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.\nIt uses the `importlib.metadata` module to resolve the dependencies and then deferres to `pip uninstall`.\n\nExample:\n\n```console\n$ pip-purge requests\nThe following packages will be uninstalled: certifi, charset-normalizer, idna, requests, urllib3\nRunning: ...\n```\n\nYou can also read from a requirements file. The read packages will be purged:\n\n```console\n$ pip-purge --requirement requirements.txt\n...\n```\n\nIf you want to exclude certain packages, you can do that as follows:\n\n```console\n$ pip-purge requests --exclude urllib3\nThe following packages will be uninstalled: certifi, charset-normalizer, idna, requests\nRunning: ...\n```\n\nSometimes packages have extra / optional dependencies. These are considered by default, but can be ignored:\n\n```console\n$ pip-purge requests --ignore-extra\n...\n```\n\nIt's recommended to do a dry run first, which performs all operations normally but doesn't defer to `pip uninstall`:\n\n```console\n$ pip-purge requests --dry-run\nThe following packages will be uninstalled: certifi, charset-normalizer, idna, requests, urllib3\nWould run: ...\n```\n\nYou can also freeze the packages that will be uninstalled to a file before actually purging them.\n\n```console\n$ pip-review requests --freeze-purged-packages\n...\n```\n\nBy default it will safe them to `backup.txt` in the current directory, but you can specify the file path using the `--freeze-file` option.\n\nRun `pip-purge -h` for a complete overview of the options.\n\n## Contributing\n\nIf you are interested in contributing to this project, please refer [here](/CONTRIBUTING.md) for more information.\n\n## Origins and credit\n\n`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](https://github.com/jgonggrijp/pip-review).\n\nIncluded from the original project:\n`pip-review` was originally part of\n[pip-tools](https://github.com/nvie/pip-tools/) but has been\n[discontinued](https://github.com/nvie/pip-tools/issues/185) as such.\nSee [Pin Your Packages](http://nvie.com/posts/pin-your-packages/) by\nVincent Driessen for the original introduction. Since there are still\nuse cases, the tool now lives on as a separate package.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "pip-manage lets you smoothly manage your installed packages.",
"version": "1.1.2",
"project_urls": {
"Source": "https://github.com/realshouzy/pip-manage"
},
"split_keywords": [
"pip",
" pip-purge",
" pip-review",
" update",
" autoupdate",
" autouninstall",
" dependencies"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "53d66e4139042bc808af702376949dcccccb1a4879f3076dbaab8b64ba60a567",
"md5": "51ef7bfa97f1c6e14f0da8579a190877",
"sha256": "dd5639d69909ecf591c256a5bc9d2c20e3163e7209ed7de5ba14f5e25e94944c"
},
"downloads": -1,
"filename": "pip_manage-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51ef7bfa97f1c6e14f0da8579a190877",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 15517,
"upload_time": "2024-07-13T21:43:41",
"upload_time_iso_8601": "2024-07-13T21:43:41.872346Z",
"url": "https://files.pythonhosted.org/packages/53/d6/6e4139042bc808af702376949dcccccb1a4879f3076dbaab8b64ba60a567/pip_manage-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c69e3ac553668d8d67d600642211dde025e0317f48d277e5b8b3d5406b442d01",
"md5": "cdb4503288fd7825f3b6eb59ae4870e9",
"sha256": "5b8c947e0459c0b1e079a6b01872c66788e87c2094bbd36881bc33c31d0cb918"
},
"downloads": -1,
"filename": "pip_manage-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "cdb4503288fd7825f3b6eb59ae4870e9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 16486,
"upload_time": "2024-07-13T21:43:43",
"upload_time_iso_8601": "2024-07-13T21:43:43.198231Z",
"url": "https://files.pythonhosted.org/packages/c6/9e/3ac553668d8d67d600642211dde025e0317f48d277e5b8b3d5406b442d01/pip_manage-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-13 21:43:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "realshouzy",
"github_project": "pip-manage",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "pip-manage"
}