Giter VIP home page Giter VIP logo

pypi-extractor-package's Introduction

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 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}")

Setting Username During Initialization

You can also set the username during initialization:

pypi_info = PyPiExtractor("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

PyPiExtractor

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

__init__(self, username: str)
  • Initializes the PyPiExtractor with a username.
  • Parameters:
    • username (str): The PyPI username.
  • Raises:
    • PyPiExtractorError: If the username is not provided.
set_username(self, username: str)
  • Sets the PyPI username.
  • Parameters:
    • username (str): The PyPI username.
  • Raises:
    • PyPiExtractorError: 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:
    • PyPiExtractorError: 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:
    • PyPiExtractorError: 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:
    • PyPiExtractorError: If there is an error fetching or processing the package details.

PyPiExtractorError

Custom exception class for PyPiExtractor errors.


pypi-extractor-package's People

Contributors

dependabot[bot] avatar tgwolf avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.