Skip to main content

Pip Tree

Get the dependency tree of your Python virtual environment via Pip.

Build Status Coverage Status PyPi Licence

Showcase

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": [
            "itsdangerous>=2.0",
            "click>=7.1.2",
            "Werkzeug>=2.0",
            "Jinja2>=3.0"
        ],
        "required_by": []
    }
]

Pip Tree report complete! 40 dependencies found for "path/to/my_project/venv/lib/python3.9/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.9/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

Metadata

Release files for pip-tree 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pip-tree 3.0.0
File Size Uploaded Provenance Actions
pip-tree-3.0.0.tar.gz 5.7 kB Without provenance Details for pip-tree-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pip-tree 3.0.0
File Interpreter ABI Platform Actions
pip_tree-3.0.0-py3-none-any.whl Python 3 none any Details for pip_tree-3.0.0-py3-none-any.whl

Total release size: 12.4 kB

Release files / pip-tree-3.0.0.tar.gz

Download URL pip-tree-3.0.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
06029a30e5a24a2d324405e9e5edb8a170ddb7a8428f82855aa5211f7d576ec7
BLAKE2b-256 checksum
How to use checksums
34f46b830a4c4610ed5440485b55d8a2e389311dc68b2bf7c2819248ef174e48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / pip_tree-3.0.0-py3-none-any.whl

Download URL pip_tree-3.0.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc71d52048522623f3a8c3cefb4d6f15d225915ccca8173f957a0e86d9fe23ba
BLAKE2b-256 checksum
How to use checksums
1d50133710ee61fcefcf6b8e71482761fde964917c2d63b9d0419eb8ba84a54a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.4

Security for pip-tree 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page