Skip to main content

PokerPy 0.7 - alpha (under development)

A new context manager is implemented to run a full hand cycle, composed of multiple betting rounds and the showdow with the structure of a Texas Hold'em game. This will feed the version demos which for the first time will attempt to simulate the button rotation logic. The betting round is no longer supporting input for minimum bet, starting player or stopping player. To update these parameters, the appropiate table methods have to be called directly. By now, players cannot leave or enter the table, once instantiated.

License

PokerPy is licensed under the Apache License 2.0. See the LICENSE.txt and NOTICE.txt files for details.

Disclaimer

This package is a general-purpose game logic tool intended for lawful use only. The author and the contributors make no representation about the legality of online poker or gambling in any given jurisdiction. You are solely responsible for ensuring that your use of this package complies with all applicable laws and regulations. The author and the contributors assume no liability whatsoever for how this software is used.

Model

A brief documentation is provided on structures and engines. Also, a diagram representing the communication between instances is available. See MODEL.md for details.

Usage example

import pokerpy as pk
import random


# Implement server

def await_client_device(player: pk.Player, available_actions: dict[str, range]):

    # Send current player and options to the client's device
    print(f'{player.name = }')
    print(f'{available_actions = }\n')

    # Receive the requested action from client's device
    action_name = random.choice(list(available_actions.keys()))
    amount = random.choice(available_actions[action_name])
    return pk.Action(action_name, amount)


# Instantiate players and table once

players = [
    pk.Player('Andy', stack=1000),
    pk.Player('Boa', stack=1000),
    pk.Player('Coral', stack=1000),
    pk.Player('Dino', stack=1000),
]

table = pk.Table(players)


# Run Texas Hold'em hand

hand_cycle = pk.HandCycle('hand 1', table=table)
with hand_cycle:
    for player in hand_cycle.listen():
        action_ranges = hand_cycle.betting_round.get_action_ranges()
        action = await_client_device(player, action_ranges)
        player.request_action(action)


# Or run a single betting round

with pk.BettingRound('flop', table=table) as betting_round:
    for player in betting_round.listen():
        action = await_client_device(player, betting_round.get_action_ranges())
        player.request_action(action)


# Results

print(f'POT: {table.pot}')
for player in players:
    print(f"{player.name}'s stack {player.stack}")

Current version

0.7.0

  • Detached from tag 0.6.0.
  • All version features are implemented.

0.7.1

  • Updated version due to PyPI restrictions with deleted packages.

Upcoming versions

  • 0.8 - beta: A context manager will be implemented to run a full No Limit Texas Hold'em cash game. This manager will implement the features that occur between hand cycles, such as button movement, players entering and leaving the table, and proper handling of heads-up situations. Also, a basic documentation will be provided to illustrate how to use the high level features.
  • 1.0 - stable: The first stable release. API classes will wrap the core classes, as a separate layer in charge of input validations. Besides this, no new features are planned for this release, though some adjustments or enhancements may arise from final testing and feedback. Also, a full documentation will be provided.

Metadata

Release files for pokerpy 0.7.1

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

Source distribution (sdist)

Source distribution for pokerpy 0.7.1
File Size Uploaded Provenance Actions
pokerpy-0.7.1.tar.gz 30.9 kB Without provenance Details for pokerpy-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pokerpy 0.7.1
File Interpreter ABI Platform Actions
pokerpy-0.7.1-py3-none-any.whl Python 3 none any Details for pokerpy-0.7.1-py3-none-any.whl

Total release size: 83.9 kB

Release files / pokerpy-0.7.1.tar.gz

Download URL pokerpy-0.7.1.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
78d8e8400158f3d332dc1701d41f82beb88159ab6c904369496b9e3ab250f03d
BLAKE2b-256 checksum
How to use checksums
ef28b45b7f58fcbd6348265e37726450e1dc8c7dc3880dffe5a11c4d568ca76b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / pokerpy-0.7.1-py3-none-any.whl

Download URL pokerpy-0.7.1-py3-none-any.whl
Size 53.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff8582cf0bd403c4447b3ee913ed143c3655e77d68d495ab8d4cab69b93a19dd
BLAKE2b-256 checksum
How to use checksums
44bf1254ab6453e3e0b12ff688539ed7f51b5d4178219fb15c3a881a68fd545c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for pokerpy 0.7.1

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