Skip to content

Commit b92d524

Browse files
authored
Merge pull request #63 from CurtisTechSolutions/feat/python-native-bindings
feat(python): build native training wheels with NumPy observations
2 parents a625a64 + 2695f8b commit b92d524

12 files changed

Lines changed: 522 additions & 0 deletions

File tree

‎.github/workflows/python.yml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Python CI
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
permissions:
7+
contents: read
8+
concurrency:
9+
group: python-ci-${{ github.ref }}
10+
cancel-in-progress: true
11+
jobs:
12+
native-wheel:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
runs-on: ${{ matrix.os }}
18+
defaults:
19+
run:
20+
shell: bash
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
- uses: dtolnay/rust-toolchain@stable
27+
- uses: Swatinem/rust-cache@v2
28+
- run: python -m pip install "maturin>=1.9,<2" "pytest>=8,<9" "numpy>=1.24,<3"
29+
- run: maturin build --release --locked --out dist
30+
- name: Install built wheel
31+
run: |
32+
python - <<'PY'
33+
import glob
34+
import subprocess
35+
import sys
36+
subprocess.check_call([sys.executable, "-m", "pip", "install", *glob.glob("dist/*.whl")])
37+
PY
38+
- run: python -m pytest python/tests -q
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
name: gamesforai-wheel-${{ matrix.os }}
42+
path: dist/*.whl

‎Cargo.lock‎

Lines changed: 142 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ members = [
1313
"crates/adapters/gfa-mcp",
1414
"crates/apps/gfa-server",
1515
"crates/apps/gfa-cli",
16+
"crates/apps/gfa-py",
1617
"xtask",
1718
"crates/domain/gfa-api-types",
1819
"crates/domain/gfa-service",
@@ -28,6 +29,8 @@ license = "GPL-3.0-only"
2829
repository = "https://github.com/CurtisTechSolutions/GamesForAI"
2930

3031
[workspace.dependencies]
32+
pyo3 = { version = "0.29.2", features = ["abi3-py310"] }
33+
numpy = "0.29.0"
3134
gfa-core = { version = "0.1.0", path = "crates/core/gfa-core" }
3235
gfa-testkit = { version = "0.1.0", path = "crates/core/gfa-testkit" }
3336
gfa-game-tictactoe = { version = "0.1.0", path = "crates/games/gfa-game-tictactoe" }

‎crates/apps/gfa-py/Cargo.toml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "gfa-py"
3+
version.workspace = true
4+
edition.workspace = true
5+
license.workspace = true
6+
7+
[lib]
8+
name = "_native"
9+
crate-type = ["cdylib", "rlib"]
10+
test = false
11+
doctest = false
12+
13+
[features]
14+
extension-module = ["pyo3/extension-module"]
15+
16+
[dependencies]
17+
gfa-core.workspace = true
18+
gfa-games.workspace = true
19+
pyo3.workspace = true
20+
numpy.workspace = true
21+
serde_json.workspace = true
22+
23+
[lints]
24+
workspace = true

0 commit comments

Comments
 (0)