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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file py_codeforce-1.3.tar.gz.

File metadata

  • Download URL: py_codeforce-1.3.tar.gz
  • Upload date:
  • Size: 50.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for py_codeforce-1.3.tar.gz
Algorithm Hash digest
SHA256 92b2485c765723d4e398ff8bd0d71c1b0614c1e12aa40dc704ad44a24cbc614f
MD5 3ce40275a402d92457b8729ab40b3363
BLAKE2b-256 3a5747ba1015a089469543b77b3bcdff706c6f9c7b81802d29e5a845f1691b8f

See more details on using hashes here.

File details

Details for the file py_codeforce-1.3-py3-none-any.whl.

File metadata

  • Download URL: py_codeforce-1.3-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for py_codeforce-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ba3b8f618300de92f68410678e6f3a30be88d37c574903c561a8f0e3cb2a9e3e
MD5 59ec769d6b922a2fcb2e843d3b4d08d4
BLAKE2b-256 2b8f13d163332bb60fa0ba346825047ff5d7b3eaf0c711f03629a23a6fee43f8

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