Skip to main content

Py-Codeforces is a high-performance and type-safe Python library designed for seamless interaction with Codeforces. It offers both asynchronous and synchronous client handlers, allowing developers to choose the appropriate method based on their requirements.

Project description

Py-Codeforce

Faster | Better | Type-Safe

Ruff Passing Package Static Badge

image

Py-Codeforces

Py-Codeforces is a high-performance and type-safe Python library designed for seamless interaction with Codeforces. It offers both asynchronous and synchronous client handlers, allowing developers to choose the appropriate method based on their requirements.

Key Features:

  1. Client Handlers:

    • Synchronous Handler: SyncMethod
    • Asynchronous Handler: AsyncMethod
  2. Functionality:

    Both client handlers offer the same set of functionalities, ensuring consistency and flexibility in usage.

  3. Authentication:

    To access user-related attributes, authentication must be enabled by setting the enable_auth parameter to True.

  4. API Documentation:

    This library is built entirely based on the official Codeforces API Documentation, ensuring reliability and adherence to best practices.

Example Usage:

Asynchronous usage:

import asyncio
import pycodeforces

async def main():
    api = pycodeforces.AsyncMethod()
    users = await api.get_user_info(handles="DmitriyH;Fefer_Ivan")
    # use `;` to add multiple parameters.
    async for user in users:
        print(user.avatar)

asyncio.run(main())

Synchronous usage:

import pycodeforces

async def main():
    get = pycodeforces.SyncMethod()
    users = get.get_user_info(handles="DmitriyH;Fefer_Ivan")
    # use `;` to add multiple parameters.
    for user in users:
        print(user.avatar)

Features

  • Is 100% type safe.
  • For customisation in types, a specific module abc has been provided within the head module.
  • Dual modes for specific requirements regarding auth. -- Can be enabled by passing a True to Method constructor

Uses:

  1. msgspec - for data validation and then serialisation.
  2. ruff - for linear code formatting and consistency.

Installation

Installing as a user:

pip install py-codeforce

Installing as a developer:

pip install py-codeforce[dev]

Open Source Contribution:

Want to contribute? Great! Check the Issues for getting to know about further updates and solutions to occurring problems. Maintain the type-checking as strict. Stack a PR to the production

Thank you for checking out the repo. Give it a star if you've found it worthy.

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

py_codeforce-1.3.tar.gz (50.9 kB view hashes)

Uploaded Source

Built Distribution

py_codeforce-1.3-py3-none-any.whl (40.1 kB view hashes)

Uploaded Python 3

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