PyPI Versions (ppv)
PyPI Versions (ppv) is a command-line interface (CLI) tool designed to interact with the Python Package Index (PyPI). It allows users to fetch package versions, detailed metadata, and dependencies of specified Python packages directly from the terminal.
Docs
Features
- Fetch Available Versions: Retrieve all available versions of one or more Python packages from PyPI.
- Latest Version: Display only the latest stable version of a package.
- Pre-release Versions: Optionally include pre-release versions in the output.
- JSON Output: Get outputs in JSON format for easy integration with other tools and scripts.
- Package Metadata: Access detailed metadata of Python packages, including summaries, authors, licenses, and more.
- Dependencies: View dependencies of specific versions of Python packages.
Installation
Prerequisites
- Go: Ensure you have Go installed (version 1.18 or higher).
Install via go install
go install github.com/Dencyuman/pypi-versions@latest
This command will install the ppv binary to your $GOPATH/bin. Make sure this directory is added to your system's PATH to access ppv from anywhere in your terminal.
Using Homebrew (macOS and Linux)
If you are using Homebrew, you can install ppv with:
brew tap Dencyuman/pypi-versions
brew install pypi-versions
Note: Ensure that the Homebrew tap is available. If not, you might need to create a Homebrew formula for ppv.
Usage
The general syntax for using ppv is:
ppv [command] [flags] [arguments]
Global Flags
--prerelease
, -p
: Include pre-release versions in the output.
--latest
, -l
: Show only the latest stable version.
--json
, -j
: Output the results in JSON format.
--help
, -h
: Display help for specific commands.
Commands
versions
Display available versions of specified PyPI packages.
Usage:
ppv versions [packages...] [flags]
ppv [packages...] [flags] # The versions command can be omitted.
metadata
Display detailed metadata of specified Python packages from PyPI.
Usage:
ppv metadata [packages...] [flags]
deps
Display dependencies of specific versions of Python packages from PyPI.
Usage:
ppv deps [package] [version] ... [flags]
help
Display overall help information.
ppv help
Examples
Display All Available Versions of a Package
ppv versions pandas
ppv pandas
Output:
Available versions for pandas:
1.0.0
1.1.0
1.2.0
...
Display Only the Latest Stable Version
ppv versions pandas --latest
ppv pandas -l
Output:
Latest version of pandas: 1.5.3
Include Pre-release Versions
ppv versions pandas --prerelease
ppv pandas -p
Output:
Available versions for pandas:
1.0.0
1.1.0
1.2.0
1.3.0-beta
1.4.0
1.5.0-rc1
1.5.3
ppv versions pandas --json
ppv pandas -j
Output:
{
"package": "pandas",
"versions": [
"1.0.0",
"1.1.0",
"1.2.0",
"1.3.0",
"1.4.0",
"1.5.3"
]
}
ppv metadata pandas
Output:
Metadata for pandas:
Name: pandas
Version: 1.5.3
Summary: Powerful data structures for data analysis, time series, and statistics
Author: The pandas development team
Author Email: pandas-dev@python.org
License: BSD License
Home Page: https://pandas.pydata.org/
Repository URL: https://github.com/pandas-dev/pandas
To include the description in the output, use the '--description' flag.
Display Dependencies of a Specific Version
ppv deps pandas 1.5.3
Output:
Dependencies for pandas version 1.5.3:
- numpy>=1.20.0
- python-dateutil>=2.7.3
- pytz>=2017.3
ppv deps pandas latest --json
Output:
{
"package": "pandas",
"version": "1.5.3",
"dependencies": [
"numpy>=1.20.0",
"python-dateutil>=2.7.3",
"pytz>=2017.3"
]
}
License
This project is licensed under the MIT License.
© 2024 Dencyuman