Skip to main content

Extract package information for a given user in PyPi.

Project description

DevelopersToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

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.

Features

  • 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.

Installation

You can install the package using pip:

pip install wolfsoftware.pypi-extractor

Usage

Basic Usage

Here's a basic example of how to use the PyPI Extractor:

from wolfsoftware.pypi_extractor import PyPIPackageInfo

# Initialize without username
pypi_info = PyPIPackageInfo()

# 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 PyPIPackageInfoError as e:
    print(f"An error occurred: {e.message}")

Setting Username During Initialization

You can also set the username during initialization:

pypi_info = PyPIPackageInfo("your_pypi_username")

Retrieving User Packages

You can retrieve a list of packages maintained by a specific user:

packages = pypi_info.get_user_packages()
print(packages)

Retrieving Package Details

To get detailed information about a specific package:

package_details = pypi_info.get_package_details("package_name")
print(package_details)

API Reference

Classes

PyPIPackageInfo

A class to fetch and process package details for a given PyPI user.

__init__(self, username: str)
  • Initializes the PyPIPackageInfo with a username.
  • Parameters:
    • username (str): The PyPI username.
  • Raises:
    • PyPIPackageInfoError: If the username is not provided.
set_username(self, username: str)
  • Sets the PyPI username.
  • Parameters:
    • username (str): The PyPI username.
  • Raises:
    • PyPIPackageInfoError: If the username is not provided.
get_user_packages(self) -> list
  • Fetches the list of packages for the given PyPI user.
  • Returns:
    • list: A list of dictionaries containing package names and summaries.
  • Raises:
    • PyPIPackageInfoError: If there is an error fetching or parsing the user profile.
get_package_details(self, package_name: str) -> dict
  • 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:
    • PyPIPackageInfoError: If there is an error fetching or parsing the package details.
get_all_packages_details(self) -> list
  • Fetches detailed information for all packages of the given PyPI user.
  • Returns:
    • list: A list of dictionaries containing detailed information about each package.
  • Raises:
    • PyPIPackageInfoError: If there is an error fetching or processing the package details.

PyPIPackageInfoError

Custom exception class for PyPIPackageInfo errors.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wolfsoftware_pypi_extractor-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file wolfsoftware_pypi_extractor-0.1.0.tar.gz.

File metadata

File hashes

Hashes for wolfsoftware_pypi_extractor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3330a3687883fff9fcdbed62c20c80dc0a4caf960178dd598834ec91fcce5c7b
MD5 bf4c1936eb377ca86b2046078a83fe45
BLAKE2b-256 1bf24f65e87e794fbb1a9a71c64e4eb5eeea4729a2450611fa8586013fdc8ff4

See more details on using hashes here.

File details

Details for the file wolfsoftware.pypi_extractor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wolfsoftware.pypi_extractor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6d5ce3bfb2c180f4ed42afc6110f230c89184119a05671f18a17884412c723a
MD5 927b13e11d4dc9f4cadb98568c51f2e1
BLAKE2b-256 1697854c8c7a4d0e596c73fc9d750b0f87cd7807be88356d38ad9ef14853d03e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page