Get the dependency tree of your Python virtual environment via Pip.
Project description
There is no simple, native way to get the dependency tree of a Python virtual environment using the Pip package manager for Python. Pip Tree fixes this problem by retrieving every package from your virtual environment and returning a list of JSON objects that include the package name, version installed, date updated, and which packages are required by each package (the tree).
Install
# Install Pip Tree globally
pip3 install pip-tree
# Install Pip Tree into the virtual environment of the project you want to run it on
venv/bin/pip install pip-tree
# Install locally
just install
Usage
Virtual Env Usage:
pip-tree
Global Usage:
pip-tree --path "path/to/my_project/venv/lib/python3.9/site-packages"
Options:
-h, --help show this help message and exit
-p PATH, --path PATH The path to the site-packages directory of a Python virtual environment. If a path is not provided, the virtual environment Pip Tree is run from will be used.
Sample Output
Generating Pip Tree Report...
[
{
"name": "docopt",
"version": "0.6.2",
"updated": "2021-05-12",
"requires": [],
"required_by": [
"coveralls"
]
},
{
"name": "flake8",
"version": "3.9.2",
"updated": "2021-05-12",
"requires": [
"mccabe<0.7.0,>=0.6.0",
"pyflakes<2.4.0,>=2.3.0",
"pycodestyle<2.8.0,>=2.7.0"
],
"required_by": []
},
{
"name": "Flask",
"version": "2.0.0",
"updated": "2021-05-12",
"requires": [
"click>=7.1.2",
"itsdangerous>=2.0",
"Jinja2>=3.0"
"Werkzeug>=2.0",
],
"required_by": []
}
]
Pip Tree report complete! 40 dependencies found for "path/to/my_project/venv/lib/python3.12/site-packages".
Package
In addition to the CLI tool, you can use functions to retrieve the list of packages and their details from a Python virtual environment in your own code:
import pip_tree
path = 'path/to/my_project/venv/lib/python3.12/site-packages'
package_list = pip_tree.get_pip_package_list(path)
for package in package_list:
package_details = pip_tree.get_package_details(package)
print(package_details['name'])
Development
# Get a comprehensive list of development tools
just --list
Project details
Release history Release notifications | RSS feed
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_tree-4.0.0.tar.gz
.
File metadata
- Download URL: pip_tree-4.0.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce0655dcf2252e78d5c5736fb03430c5c08362febab673c28036e381f756b964 |
|
MD5 | 51ba2dc514012ecfc0e832a58d3d1ac7 |
|
BLAKE2b-256 | 9b3ae6313406a7a5bafdb2cff14d6434cf5485d2afbc74a4331d9392d189e78f |
File details
Details for the file pip_tree-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: pip_tree-4.0.0-py3-none-any.whl
- Upload date:
- Size: 7.1 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 | b18cac8ab2348045db15d25f7e27e2700d14ddcc4b084d4992163b2cbb613c1f |
|
MD5 | 9471202c0bd0d75cd6cb2117b3051601 |
|
BLAKE2b-256 | 8531e70cd42e767d6c56ff3ca61e157c6f5f8fa38973c91070e6bcdd7f3bb1c9 |