refact: add cargo "python" feature for pyo3

This commit is contained in:
Henri Bourcereau 2026-03-25 16:04:06 +01:00
parent f15c5fb9dd
commit 46416cdaef
7 changed files with 12 additions and 6 deletions

View file

@ -20,6 +20,7 @@ pub use dice::{Dice, DiceRoller};
pub mod training_common;
// python interface "trictrac_engine" (for AI training..)
#[cfg(feature = "python")]
mod pyengine;
// C++ interface via cxx.rs (for OpenSpiel C++ integration)

View file

@ -1,3 +1,4 @@
#[cfg(feature = "python")]
use pyo3::prelude::*;
use serde::{Deserialize, Serialize};
use std::fmt;
@ -5,7 +6,7 @@ use std::fmt;
// This just makes it easier to dissern between a player id and any ol' u64
pub type PlayerId = u64;
#[pyclass(eq, eq_int)]
#[cfg_attr(feature = "python", pyclass(eq, eq_int))]
#[derive(Copy, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum Color {
White,