PyPI Extractor is a Python package designed to fetch and process detailed information about packages hosted on the Python Package Index (PyPI). This package is particularly useful for users who want to retrieve and analyze metadata for packages maintained by a specific PyPI user.
- Retrieve a list of packages maintained by a specific PyPI user.
- Fetch detailed metadata for each package, including versions, author information, dependencies, and more.
- Custom exceptions for handling errors gracefully.
- Option to set the PyPI username after initializing the class.
You can install the package using pip:
pip install wolfsoftware.pypi-extractor
Here's a basic example of how to use the PyPI Extractor:
from wolfsoftware.pypi_extractor import PyPiExtractor
# Initialize without username
pypi_info = PyPiExtractor()
# Set username later
pypi_info.set_username("your_pypi_username")
# Get detailed information for all packages
try:
packages_details = pypi_info.get_all_packages_details()
print(packages_details)
except PyPiExtractorError as e:
print(f"An error occurred: {e.message}")
You can also set the username during initialization:
pypi_info = PyPiExtractor("your_pypi_username")
You can retrieve a list of packages maintained by a specific user:
packages = pypi_info.get_user_packages()
print(packages)
To get detailed information about a specific package:
package_details = pypi_info.get_package_details("package_name")
print(package_details)
A class to fetch and process package details for a given PyPI user.
- Initializes the
PyPiExtractor
with a username. - Parameters:
username
(str): The PyPI username.
- Raises:
PyPiExtractorError
: If the username is not provided.
- Sets the PyPI username.
- Parameters:
username
(str): The PyPI username.
- Raises:
PyPiExtractorError
: If the username is not provided.
- Fetches the list of packages for the given PyPI user.
- Returns:
list
: A list of dictionaries containing package names and summaries.
- Raises:
PyPiExtractorError
: If there is an error fetching or parsing the user profile.
- Fetches detailed information for a specific package.
- Parameters:
package_name
(str): The name of the package.
- Returns:
dict
: A dictionary containing detailed information about the package.
- Raises:
PyPiExtractorError
: If there is an error fetching or parsing the package details.
- Fetches detailed information for all packages of the given PyPI user.
- Returns:
list
: A list of dictionaries containing detailed information about each package.
- Raises:
PyPiExtractorError
: If there is an error fetching or processing the package details.
Custom exception class for PyPiExtractor
errors.