Skip to main content

pyhandel

Python wrapper for building bots for the Kuh-Handel online bot coding challenge. Wraps the core Rust implementation via PyO3.

Installation

pip install pyhandel

Type stubs for better IDE support:

pip install pyhandel pyhandel-stubs

Usage

Implement the PlayerActions class and connect to the game server via Client:

import asyncio
from pyhandel.client import Client
from pyhandel.messages.actions import (
    AuctionDecision, Bidding, InitialTrade, NoAction,
    PlayerTurnDecision, SendMoney, TradeOpponentDecision,
)
from pyhandel.messages.game_updates import AuctionRound, GameUpdate, TradeOffer
from pyhandel.player.player_actions import PlayerActions


class Bot(PlayerActions):

    def setup(self):
        pass  # initialize your bot here

    def _draw_or_trade(self) -> PlayerTurnDecision:
        raise NotImplementedError

    def _trade(self) -> InitialTrade:
        raise NotImplementedError

    def _provide_bidding(self, state: AuctionRound) -> Bidding:
        raise NotImplementedError

    def _buy_or_sell(self, state: AuctionRound) -> AuctionDecision:
        raise NotImplementedError

    def _send_money_to_player(self, player: str, amount: int) -> SendMoney:
        raise NotImplementedError

    def _respond_to_trade(self, offer: TradeOffer) -> TradeOpponentDecision:
        raise NotImplementedError

    def _receive_game_update(self, update: GameUpdate) -> NoAction:
        raise NotImplementedError


async def run(client, num_rounds):
    for _ in range(num_rounds):
        await client.play_one_round("pvp_games")

if __name__ == "__main__":
    bot = Bot()
    bot.setup()
    client = Client("your_bot_name", "your_token", bot, "s://ufuk-guenes.com", True)
    asyncio.run(run(client, 1))

Documentation

License

MIT

Metadata

Release files for pyhandel 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyhandel 0.2.5
File Size Uploaded Provenance
pyhandel-0.2.5.tar.gz 42.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyhandel 0.2.5
File Interpreter ABI Platform
pyhandel-0.2.5-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details

Total release size: 4.0 MB

Release files / pyhandel-0.2.5.tar.gz

Download URL pyhandel-0.2.5.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8a3d0c041e94fbde5e66304476eab2f57511c10b855a2388bde13e192e364016
BLAKE2b-256 checksum
How to use checksums
6d2907e62c83504c3992127365624fd7eb6975384380603599275b3834c1c266
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Release files / pyhandel-0.2.5-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL pyhandel-0.2.5-cp313-cp313-manylinux_2_34_x86_64.whl
Size 4.0 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
aba1f0725a2aa8e77fd4e515f6aedbd64f9fea9269cc015dfc1327f66a2ccef1
BLAKE2b-256 checksum
How to use checksums
6f0c4b0ae920b130be2f9605457e6251a6c93ef7c068ff5c47c8818d0f7c8c2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.9.6

Security for pyhandel 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page