pkpython 0.7.0__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pkpython-0.7.0 → pkpython-0.8.0}/Cargo.lock +12 -12
- {pkpython-0.7.0 → pkpython-0.8.0}/Cargo.toml +2 -2
- {pkpython-0.7.0 → pkpython-0.8.0}/PKG-INFO +1 -1
- {pkpython-0.7.0 → pkpython-0.8.0}/src/lib.rs +36 -24
- {pkpython-0.7.0 → pkpython-0.8.0}/src/table_no_cell.rs +2 -3
- {pkpython-0.7.0 → pkpython-0.8.0}/.github/workflows/ci.yml +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/.github/workflows/publish.yml +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/.gitignore +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/CHANGELOG.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/LICENSE +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/Makefile +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/README.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/demo.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/docs/STACK.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/docs/pypi-publishing-plan.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/docs/superpowers/plans/2026-04-28-pkpy-0.0.52-upgrade.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/docs/superpowers/plans/2026-04-29-pkpy-pokersession-tablenocell.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/docs/superpowers/specs/2026-04-28-pkpy-0.0.52-upgrade-design.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/docs/superpowers/specs/2026-04-29-pkpy-pokersession-tablenocell-design.md +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/examples/calc.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/examples/gto.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/examples/the_hand.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/pyproject.toml +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/python/pkpy/__init__.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/src/bot.rs +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/src/hand_history.rs +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/src/session.rs +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/src/stats.rs +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/tests/test_pkpy.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/tests/test_session.py +0 -0
- {pkpython-0.7.0 → pkpython-0.8.0}/tests/test_table_no_cell.py +0 -0
|
@@ -224,7 +224,7 @@ dependencies = [
|
|
|
224
224
|
"heck",
|
|
225
225
|
"proc-macro2",
|
|
226
226
|
"quote",
|
|
227
|
-
"syn 3.0.
|
|
227
|
+
"syn 3.0.4",
|
|
228
228
|
]
|
|
229
229
|
|
|
230
230
|
[[package]]
|
|
@@ -352,7 +352,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
|
|
|
352
352
|
dependencies = [
|
|
353
353
|
"proc-macro2",
|
|
354
354
|
"quote",
|
|
355
|
-
"syn 3.0.
|
|
355
|
+
"syn 3.0.4",
|
|
356
356
|
]
|
|
357
357
|
|
|
358
358
|
[[package]]
|
|
@@ -828,9 +828,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
|
|
828
828
|
|
|
829
829
|
[[package]]
|
|
830
830
|
name = "pkcore"
|
|
831
|
-
version = "0.
|
|
831
|
+
version = "0.8.0"
|
|
832
832
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
833
|
-
checksum = "
|
|
833
|
+
checksum = "1d905a1b2518e89ff31fad5a4eb2d44ffc5c32fd6b1edea6fb1164249f1af994"
|
|
834
834
|
dependencies = [
|
|
835
835
|
"bint",
|
|
836
836
|
"bitvec",
|
|
@@ -869,7 +869,7 @@ checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
|
|
|
869
869
|
|
|
870
870
|
[[package]]
|
|
871
871
|
name = "pkpy"
|
|
872
|
-
version = "0.
|
|
872
|
+
version = "0.8.0"
|
|
873
873
|
dependencies = [
|
|
874
874
|
"pkcore",
|
|
875
875
|
"pyo3",
|
|
@@ -1016,9 +1016,9 @@ checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
|
|
1016
1016
|
|
|
1017
1017
|
[[package]]
|
|
1018
1018
|
name = "rand"
|
|
1019
|
-
version = "0.8.
|
|
1019
|
+
version = "0.8.8"
|
|
1020
1020
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1021
|
-
checksum = "
|
|
1021
|
+
checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
|
|
1022
1022
|
dependencies = [
|
|
1023
1023
|
"libc",
|
|
1024
1024
|
"rand_chacha 0.3.1",
|
|
@@ -1084,7 +1084,7 @@ dependencies = [
|
|
|
1084
1084
|
"clap",
|
|
1085
1085
|
"lazy_static",
|
|
1086
1086
|
"log",
|
|
1087
|
-
"rand 0.8.
|
|
1087
|
+
"rand 0.8.8",
|
|
1088
1088
|
"regex",
|
|
1089
1089
|
"rust-embed",
|
|
1090
1090
|
"titlecase",
|
|
@@ -1254,7 +1254,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
|
1254
1254
|
dependencies = [
|
|
1255
1255
|
"proc-macro2",
|
|
1256
1256
|
"quote",
|
|
1257
|
-
"syn 3.0.
|
|
1257
|
+
"syn 3.0.4",
|
|
1258
1258
|
]
|
|
1259
1259
|
|
|
1260
1260
|
[[package]]
|
|
@@ -1384,9 +1384,9 @@ dependencies = [
|
|
|
1384
1384
|
|
|
1385
1385
|
[[package]]
|
|
1386
1386
|
name = "syn"
|
|
1387
|
-
version = "3.0.
|
|
1387
|
+
version = "3.0.4"
|
|
1388
1388
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1389
|
-
checksum = "
|
|
1389
|
+
checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
|
|
1390
1390
|
dependencies = [
|
|
1391
1391
|
"proc-macro2",
|
|
1392
1392
|
"quote",
|
|
@@ -1432,7 +1432,7 @@ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
|
|
|
1432
1432
|
dependencies = [
|
|
1433
1433
|
"proc-macro2",
|
|
1434
1434
|
"quote",
|
|
1435
|
-
"syn 3.0.
|
|
1435
|
+
"syn 3.0.4",
|
|
1436
1436
|
]
|
|
1437
1437
|
|
|
1438
1438
|
[[package]]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "pkpy"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "Python bindings for pkcore, a high-performance poker analysis library"
|
|
6
6
|
license = "GPL-3.0-or-later"
|
|
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
|
|
|
12
12
|
|
|
13
13
|
[dependencies]
|
|
14
14
|
pyo3 = { version = "0.28", features = ["extension-module"] }
|
|
15
|
-
pkcore = { version = "0.
|
|
15
|
+
pkcore = { version = "0.8.0", features = ["store"] }
|
|
16
16
|
|
|
17
17
|
[profile.release]
|
|
18
18
|
lto = true
|
|
@@ -31,9 +31,8 @@ use pkcore::casino::dealer::{Dealer as PkDealer, DealerError as PkDealerError};
|
|
|
31
31
|
use pkcore::casino::equity::seat_equity::SeatEquity as PkSeatEquity;
|
|
32
32
|
use pkcore::casino::equity::seatbit::Seatbit as PkSeatbit;
|
|
33
33
|
use pkcore::casino::game::ForcedBets as PkForcedBets;
|
|
34
|
-
use pkcore::casino::player::Player as PkPlayer;
|
|
35
34
|
use pkcore::casino::state::PlayerState as PkPlayerState;
|
|
36
|
-
use pkcore::casino::
|
|
35
|
+
use pkcore::casino::table::Player as PkPlayer;
|
|
37
36
|
use pkcore::casino::winnings::{PotWin as PkPotWin, Winnings as PkWinnings};
|
|
38
37
|
use pkcore::deck::Deck as PkDeck;
|
|
39
38
|
use pkcore::games::kuhn::{
|
|
@@ -2473,7 +2472,7 @@ impl Player {
|
|
|
2473
2472
|
|
|
2474
2473
|
/// Current chip count (stack only, not including active bet).
|
|
2475
2474
|
fn chips(&self) -> usize {
|
|
2476
|
-
self.0.chips
|
|
2475
|
+
self.0.chips
|
|
2477
2476
|
}
|
|
2478
2477
|
|
|
2479
2478
|
/// Total chips (stack + any active bet).
|
|
@@ -2483,12 +2482,12 @@ impl Player {
|
|
|
2483
2482
|
|
|
2484
2483
|
/// Chips committed to the current hand.
|
|
2485
2484
|
fn chips_in_play(&self) -> usize {
|
|
2486
|
-
self.0.
|
|
2485
|
+
self.0.chips_in_play
|
|
2487
2486
|
}
|
|
2488
2487
|
|
|
2489
2488
|
/// Current action state.
|
|
2490
2489
|
fn state(&self) -> PlayerState {
|
|
2491
|
-
PlayerState(self.0.state
|
|
2490
|
+
PlayerState(self.0.state)
|
|
2492
2491
|
}
|
|
2493
2492
|
|
|
2494
2493
|
fn is_active(&self) -> bool {
|
|
@@ -2501,7 +2500,7 @@ impl Player {
|
|
|
2501
2500
|
self.0.is_in_hand()
|
|
2502
2501
|
}
|
|
2503
2502
|
fn is_ready(&self) -> bool {
|
|
2504
|
-
self.0.is_ready()
|
|
2503
|
+
self.0.state.is_ready()
|
|
2505
2504
|
}
|
|
2506
2505
|
fn is_out(&self) -> bool {
|
|
2507
2506
|
self.0.is_out()
|
|
@@ -2514,10 +2513,10 @@ impl Player {
|
|
|
2514
2513
|
}
|
|
2515
2514
|
|
|
2516
2515
|
fn __str__(&self) -> String {
|
|
2517
|
-
format!("{} ({})", self.0.handle, self.0.chips
|
|
2516
|
+
format!("{} ({})", self.0.handle, self.0.chips)
|
|
2518
2517
|
}
|
|
2519
2518
|
fn __repr__(&self) -> String {
|
|
2520
|
-
format!("Player('{}', {})", self.0.handle, self.0.chips
|
|
2519
|
+
format!("Player('{}', {})", self.0.handle, self.0.chips)
|
|
2521
2520
|
}
|
|
2522
2521
|
}
|
|
2523
2522
|
|
|
@@ -2760,28 +2759,41 @@ impl TableAction {
|
|
|
2760
2759
|
|
|
2761
2760
|
/// The event log for a poker table — an ordered list of TableAction records.
|
|
2762
2761
|
#[pyclass(unsendable, name = "TableLog")]
|
|
2763
|
-
pub struct TableLog(
|
|
2762
|
+
pub struct TableLog(Vec<PkTableAction>);
|
|
2764
2763
|
|
|
2765
2764
|
#[pymethods]
|
|
2766
2765
|
impl TableLog {
|
|
2767
2766
|
/// All events as a Python list of TableAction objects.
|
|
2768
2767
|
fn entries(&self) -> Vec<TableAction> {
|
|
2769
|
-
self.0.
|
|
2768
|
+
self.0.iter().copied().map(TableAction).collect()
|
|
2770
2769
|
}
|
|
2771
2770
|
|
|
2772
2771
|
/// The most recent event, or None.
|
|
2773
2772
|
fn last(&self) -> Option<TableAction> {
|
|
2774
|
-
self.0.last().map(TableAction)
|
|
2773
|
+
self.0.last().copied().map(TableAction)
|
|
2775
2774
|
}
|
|
2776
2775
|
|
|
2777
2776
|
/// The most recent player action (bet/fold/call/raise/check), or None.
|
|
2778
2777
|
fn last_player_action(&self) -> Option<TableAction> {
|
|
2779
|
-
self.0
|
|
2778
|
+
self.0
|
|
2779
|
+
.iter()
|
|
2780
|
+
.rev()
|
|
2781
|
+
.find(|action| action.is_player_action())
|
|
2782
|
+
.copied()
|
|
2783
|
+
.map(TableAction)
|
|
2780
2784
|
}
|
|
2781
2785
|
|
|
2782
2786
|
/// True if the blinds have been posted this hand.
|
|
2783
2787
|
fn have_posted_blinds(&self) -> bool {
|
|
2784
|
-
self
|
|
2788
|
+
let has_small_blind = self
|
|
2789
|
+
.0
|
|
2790
|
+
.iter()
|
|
2791
|
+
.any(|action| matches!(action, PkTableAction::ForcedBetSmallBlind(_, _)));
|
|
2792
|
+
let has_big_blind = self
|
|
2793
|
+
.0
|
|
2794
|
+
.iter()
|
|
2795
|
+
.any(|action| matches!(action, PkTableAction::ForcedBetBigBlind(_, _)));
|
|
2796
|
+
has_small_blind && has_big_blind
|
|
2785
2797
|
}
|
|
2786
2798
|
|
|
2787
2799
|
/// Number of events in the log.
|
|
@@ -2829,7 +2841,7 @@ impl Dealer {
|
|
|
2829
2841
|
// ---- Seating ----
|
|
2830
2842
|
|
|
2831
2843
|
/// Seat a player at the next available seat. Returns the seat number.
|
|
2832
|
-
fn seat_player(&self, player: &mut Player) -> PyResult<u8> {
|
|
2844
|
+
fn seat_player(&mut self, player: &mut Player) -> PyResult<u8> {
|
|
2833
2845
|
// Take the player out of the Python wrapper to give ownership to the table
|
|
2834
2846
|
let p = std::mem::replace(
|
|
2835
2847
|
&mut player.0,
|
|
@@ -2839,7 +2851,7 @@ impl Dealer {
|
|
|
2839
2851
|
}
|
|
2840
2852
|
|
|
2841
2853
|
/// Seat a player at a specific seat number (0-indexed).
|
|
2842
|
-
fn seat_player_at(&self, player: &mut Player, seat: u8) -> PyResult<()> {
|
|
2854
|
+
fn seat_player_at(&mut self, player: &mut Player, seat: u8) -> PyResult<()> {
|
|
2843
2855
|
let p = std::mem::replace(
|
|
2844
2856
|
&mut player.0,
|
|
2845
2857
|
PkPlayer::new_with_chips("__taken__".into(), 0),
|
|
@@ -2848,7 +2860,7 @@ impl Dealer {
|
|
|
2848
2860
|
}
|
|
2849
2861
|
|
|
2850
2862
|
/// Remove the player from the given seat. Returns the removed Player.
|
|
2851
|
-
fn remove_player(&self, seat: u8) -> PyResult<Player> {
|
|
2863
|
+
fn remove_player(&mut self, seat: u8) -> PyResult<Player> {
|
|
2852
2864
|
self.0.remove_player(seat).map(Player).map_err(dealer_err)
|
|
2853
2865
|
}
|
|
2854
2866
|
|
|
@@ -2872,7 +2884,7 @@ impl Dealer {
|
|
|
2872
2884
|
// ---- Player actions ----
|
|
2873
2885
|
|
|
2874
2886
|
/// Player at `seat` bets `amount` chips.
|
|
2875
|
-
fn bet(&self, seat: u8, amount: usize) -> PyResult<()> {
|
|
2887
|
+
fn bet(&mut self, seat: u8, amount: usize) -> PyResult<()> {
|
|
2876
2888
|
use pkcore::casino::dealer::DealerAction;
|
|
2877
2889
|
self.0
|
|
2878
2890
|
.act(DealerAction::Bet { seat, amount })
|
|
@@ -2880,19 +2892,19 @@ impl Dealer {
|
|
|
2880
2892
|
}
|
|
2881
2893
|
|
|
2882
2894
|
/// Player at `seat` calls the current bet.
|
|
2883
|
-
fn call(&self, seat: u8) -> PyResult<()> {
|
|
2895
|
+
fn call(&mut self, seat: u8) -> PyResult<()> {
|
|
2884
2896
|
use pkcore::casino::dealer::DealerAction;
|
|
2885
2897
|
self.0.act(DealerAction::Call { seat }).map_err(dealer_err)
|
|
2886
2898
|
}
|
|
2887
2899
|
|
|
2888
2900
|
/// Player at `seat` checks.
|
|
2889
|
-
fn check(&self, seat: u8) -> PyResult<()> {
|
|
2901
|
+
fn check(&mut self, seat: u8) -> PyResult<()> {
|
|
2890
2902
|
use pkcore::casino::dealer::DealerAction;
|
|
2891
2903
|
self.0.act(DealerAction::Check { seat }).map_err(dealer_err)
|
|
2892
2904
|
}
|
|
2893
2905
|
|
|
2894
2906
|
/// Player at `seat` raises to `amount` chips.
|
|
2895
|
-
fn raise_to(&self, seat: u8, amount: usize) -> PyResult<()> {
|
|
2907
|
+
fn raise_to(&mut self, seat: u8, amount: usize) -> PyResult<()> {
|
|
2896
2908
|
use pkcore::casino::dealer::DealerAction;
|
|
2897
2909
|
self.0
|
|
2898
2910
|
.act(DealerAction::Raise { seat, amount })
|
|
@@ -2900,19 +2912,19 @@ impl Dealer {
|
|
|
2900
2912
|
}
|
|
2901
2913
|
|
|
2902
2914
|
/// Player at `seat` goes all-in.
|
|
2903
|
-
fn all_in(&self, seat: u8) -> PyResult<()> {
|
|
2915
|
+
fn all_in(&mut self, seat: u8) -> PyResult<()> {
|
|
2904
2916
|
use pkcore::casino::dealer::DealerAction;
|
|
2905
2917
|
self.0.act(DealerAction::AllIn { seat }).map_err(dealer_err)
|
|
2906
2918
|
}
|
|
2907
2919
|
|
|
2908
2920
|
/// Player at `seat` folds.
|
|
2909
|
-
fn fold(&self, seat: u8) -> PyResult<()> {
|
|
2921
|
+
fn fold(&mut self, seat: u8) -> PyResult<()> {
|
|
2910
2922
|
use pkcore::casino::dealer::DealerAction;
|
|
2911
2923
|
self.0.act(DealerAction::Fold { seat }).map_err(dealer_err)
|
|
2912
2924
|
}
|
|
2913
2925
|
|
|
2914
2926
|
/// Mark player at `seat` as ready to play.
|
|
2915
|
-
fn ready(&self, seat: u8) -> PyResult<()> {
|
|
2927
|
+
fn ready(&mut self, seat: u8) -> PyResult<()> {
|
|
2916
2928
|
use pkcore::casino::dealer::DealerAction;
|
|
2917
2929
|
self.0.act(DealerAction::Ready { seat }).map_err(dealer_err)
|
|
2918
2930
|
}
|
|
@@ -2946,7 +2958,7 @@ impl Dealer {
|
|
|
2946
2958
|
|
|
2947
2959
|
/// A copy of the full event log.
|
|
2948
2960
|
fn event_log(&self) -> TableLog {
|
|
2949
|
-
TableLog(self.0.event_log().
|
|
2961
|
+
TableLog(self.0.event_log().to_vec())
|
|
2950
2962
|
}
|
|
2951
2963
|
|
|
2952
2964
|
fn __repr__(&self) -> String {
|
|
@@ -170,9 +170,8 @@ impl SeatsNoCell {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
/// A
|
|
174
|
-
///
|
|
175
|
-
/// multi-hand session management.
|
|
173
|
+
/// A poker table using plain `&mut self` mutability. Wrapped by
|
|
174
|
+
/// `PokerSession` for multi-hand session management.
|
|
176
175
|
#[pyclass(from_py_object, name = "TableNoCell")]
|
|
177
176
|
#[derive(Clone)]
|
|
178
177
|
pub struct TableNoCell(pub(crate) PkTableNoCell);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pkpython-0.7.0 → pkpython-0.8.0}/docs/superpowers/plans/2026-04-29-pkpy-pokersession-tablenocell.md
RENAMED
|
File without changes
|
{pkpython-0.7.0 → pkpython-0.8.0}/docs/superpowers/specs/2026-04-28-pkpy-0.0.52-upgrade-design.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|