
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
A utility to retrieve a list of installed Python packages and their dependencies.
pip install list-packages
Alternative:
pip install git+https://github.com/maurya-anand/py-list-packages.git
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
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
The output can also be obtained in json
format by using the following command in the terminal
list_packages json
To use list-packages in a Python notebook, you can import the list_packages module and call the list_installed_packages() function.
By default, the function returns a list of dictionaries containing package information. Each dictionary has the following keys:
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"
}
]
}
]
FAQs
A package to list all the installed Python packages and their dependencies
We found that list-packages demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.