<div align="center">
# Pip Tree
Get the dependency tree of your Python virtual environment via Pip.
[![Build Status](https://github.com/Justintime50/pip-tree/workflows/build/badge.svg)](https://github.com/Justintime50/pip-tree/actions)
[![Coverage Status](https://coveralls.io/repos/github/Justintime50/pip-tree/badge.svg?branch=main)](https://coveralls.io/github/Justintime50/pip-tree?branch=main)
[![PyPi](https://img.shields.io/pypi/v/pip-tree)](https://pypi.org/project/pip-tree/)
[![Licence](https://img.shields.io/github/license/justintime50/pip-tree)](LICENSE)
<img src="https://raw.githubusercontent.com/justintime50/assets/main/src/pip-tree/showcase.png" alt="Showcase">
</div>
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
```bash
# 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
```text
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
```text
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:
```python
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
```bash
# Get a comprehensive list of development tools
just --list
```
Raw data
{
"_id": null,
"home_page": "http://github.com/justintime50/pip-tree",
"name": "pip-tree",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Justintime50",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/9b/3a/e6313406a7a5bafdb2cff14d6434cf5485d2afbc74a4331d9392d189e78f/pip_tree-4.0.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n# Pip Tree\n\nGet the dependency tree of your Python virtual environment via Pip.\n\n[![Build Status](https://github.com/Justintime50/pip-tree/workflows/build/badge.svg)](https://github.com/Justintime50/pip-tree/actions)\n[![Coverage Status](https://coveralls.io/repos/github/Justintime50/pip-tree/badge.svg?branch=main)](https://coveralls.io/github/Justintime50/pip-tree?branch=main)\n[![PyPi](https://img.shields.io/pypi/v/pip-tree)](https://pypi.org/project/pip-tree/)\n[![Licence](https://img.shields.io/github/license/justintime50/pip-tree)](LICENSE)\n\n<img src=\"https://raw.githubusercontent.com/justintime50/assets/main/src/pip-tree/showcase.png\" alt=\"Showcase\">\n\n</div>\n\nThere 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).\n\n## Install\n\n```bash\n# Install Pip Tree globally\npip3 install pip-tree\n\n# Install Pip Tree into the virtual environment of the project you want to run it on\nvenv/bin/pip install pip-tree\n\n# Install locally\njust install\n```\n\n## Usage\n\n```text\nVirtual Env Usage:\n pip-tree\n\nGlobal Usage:\n pip-tree --path \"path/to/my_project/venv/lib/python3.9/site-packages\"\n\nOptions:\n -h, --help show this help message and exit\n -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.\n```\n\n### Sample Output\n\n```text\nGenerating Pip Tree Report...\n\n[\n {\n \"name\": \"docopt\",\n \"version\": \"0.6.2\",\n \"updated\": \"2021-05-12\",\n \"requires\": [],\n \"required_by\": [\n \"coveralls\"\n ]\n },\n {\n \"name\": \"flake8\",\n \"version\": \"3.9.2\",\n \"updated\": \"2021-05-12\",\n \"requires\": [\n \"mccabe<0.7.0,>=0.6.0\",\n \"pyflakes<2.4.0,>=2.3.0\",\n \"pycodestyle<2.8.0,>=2.7.0\"\n ],\n \"required_by\": []\n },\n {\n \"name\": \"Flask\",\n \"version\": \"2.0.0\",\n \"updated\": \"2021-05-12\",\n \"requires\": [\n \"click>=7.1.2\",\n \"itsdangerous>=2.0\",\n \"Jinja2>=3.0\"\n \"Werkzeug>=2.0\",\n ],\n \"required_by\": []\n }\n]\n\nPip Tree report complete! 40 dependencies found for \"path/to/my_project/venv/lib/python3.12/site-packages\".\n```\n\n### Package\n\nIn 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:\n\n```python\nimport pip_tree\n\npath = 'path/to/my_project/venv/lib/python3.12/site-packages'\n\npackage_list = pip_tree.get_pip_package_list(path)\nfor package in package_list:\n package_details = pip_tree.get_package_details(package)\n print(package_details['name'])\n```\n\n## Development\n\n```bash\n# Get a comprehensive list of development tools\njust --list\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Get the dependency tree of your Python virtual environment via Pip.",
"version": "4.0.0",
"project_urls": {
"Homepage": "http://github.com/justintime50/pip-tree"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8531e70cd42e767d6c56ff3ca61e157c6f5f8fa38973c91070e6bcdd7f3bb1c9",
"md5": "9471202c0bd0d75cd6cb2117b3051601",
"sha256": "b18cac8ab2348045db15d25f7e27e2700d14ddcc4b084d4992163b2cbb613c1f"
},
"downloads": -1,
"filename": "pip_tree-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9471202c0bd0d75cd6cb2117b3051601",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.8",
"size": 7109,
"upload_time": "2024-07-17T17:11:25",
"upload_time_iso_8601": "2024-07-17T17:11:25.708712Z",
"url": "https://files.pythonhosted.org/packages/85/31/e70cd42e767d6c56ff3ca61e157c6f5f8fa38973c91070e6bcdd7f3bb1c9/pip_tree-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b3ae6313406a7a5bafdb2cff14d6434cf5485d2afbc74a4331d9392d189e78f",
"md5": "51ba2dc514012ecfc0e832a58d3d1ac7",
"sha256": "ce0655dcf2252e78d5c5736fb03430c5c08362febab673c28036e381f756b964"
},
"downloads": -1,
"filename": "pip_tree-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "51ba2dc514012ecfc0e832a58d3d1ac7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.8",
"size": 6180,
"upload_time": "2024-07-17T17:11:26",
"upload_time_iso_8601": "2024-07-17T17:11:26.999050Z",
"url": "https://files.pythonhosted.org/packages/9b/3a/e6313406a7a5bafdb2cff14d6434cf5485d2afbc74a4331d9392d189e78f/pip_tree-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-17 17:11:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "justintime50",
"github_project": "pip-tree",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "pip-tree"
}