A package to list all the installed Python packages and their dependencies
Project description
list_packages
A utility to retrieve a list of installed Python packages and their dependencies.
Link to the documentation.
Installation
pip install list-packages
Alternative:
pip install git+https://github.com/maurya-anand/py-list-packages.git
Usage
Terminal
After installing the package, you can run the list-packages command in the terminal to list all installed Python packages and their dependencies:
list_packages
Python Script/Notebook
To use list-packages in a Python notebook, you can import the list_packages module and call the list_installed_packages() function:
## import
from list_packages import list_installed_packages
Examples
Terminal
list_packages
Output
Package Dependency
setuptools==59.6.0 None
Jinja2==3.1.2 markupsafe>=2.0
requests==2.31.0 charset-normalizer<4,>=2,certifi>=2017.4.17,urllib3<3,>=1.21.1,idna<4,>=2.5
Python script/Notebook
By default, the function returns a list of dictionaries containing package information. Each dictionary has the following keys:
- package: Package name (str)
- version: Package version (str)
- depends: List of dictionaries containing package information (list)
from list_packages import list_installed_packages
installed_packages = list_installed_packages()
Output
[{'setuptools': '59.6.0', 'depends': None},{'package': 'Jinja2', 'version': '3.1.2', 'depends': [{'package': 'markupsafe', 'version': '>=2.0'}]}]
If you want the output in JSON format, you can pass the format='json' parameter to the list_installed_packages() function. It will return a JSON-formatted string representing the list of installed packages.
from list_packages import list_installed_packages
installed_packages = list_installed_packages('json')
Output
[
{
"package": "setuptools",
"version": "59.6.0",
"depends": null
},
{
"package": "Jinja2",
"version": "3.1.2",
"depends": [
{
"package": "markupsafe",
"version": ">=2.0"
}
]
}
]
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 list_packages-1.0.4.tar.gz
.
File metadata
- Download URL: list_packages-1.0.4.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eceee156b8a9698dd2edb9d77099c0ab763255e432a0852efc62433ccb436e4 |
|
MD5 | 18d6e40b1ae99756143c90e9406af9d8 |
|
BLAKE2b-256 | 9f76f5c8d502cd51ef8b8ba93508fae48f15842f4fddf8b73062e30b0dcb937e |
File details
Details for the file list_packages-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: list_packages-1.0.4-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b61818ad6a91d72e29c3df7aa764ffb7a203aec492d88146b2e08ee43b6ac2c5 |
|
MD5 | 95bafda317de1aa75f3dcee8925b83d6 |
|
BLAKE2b-256 | b8a3ac27c5c8e2a3de68b6ec24b256f2e8c3064fbb3da89c99222d23cf775487 |