Skip to main content

RookForge ML

rookforge-ml is a Python toolkit for building chess bot training pipelines. It provides training-friendly board encoders, an AlphaZero-style policy action space, PGN/FEN data helpers, and optional PyTorch integration without making PyTorch a required dependency.

The package is intentionally small in v1: it uses python-chess for rules correctness and focuses on reliable tensor interfaces that can feed neural networks and RL experiments.

Install

pip install rookforge-ml

For local development:

pip install -e ".[dev]"

For PyTorch helpers:

pip install -e ".[torch]"

Quick Start

import chess

from chess_tools.actions import legal_mask, move_to_index
from chess_tools.encoding import encode_board

board = chess.Board()
planes = encode_board(board)
mask = legal_mask(board)
policy_index = move_to_index(chess.Move.from_uci("e2e4"), board)

print(planes.shape)  # (106, 8, 8) by default
print(mask.shape)    # (4672,)
print(policy_index)

Core APIs

  • chess_tools.encoding: AlphaZero-style board and history encoders.
  • chess_tools.actions: 64 * 73 policy action encoding, legal masks, and UCI helpers.
  • chess_tools.data: PGN/FEN readers and streaming supervised samples.
  • chess_tools.torch: optional PyTorch dataset/collation utilities.

Development

python -m pip install -e ".[dev,benchmark]"
python -m ruff check .
python -m pytest
python -m pytest tests/test_benchmarks.py --benchmark-only --benchmark-min-rounds=5
python -m build
python -m twine check dist/*

The GitHub Actions workflow runs lint, tests, package build, metadata checks, and a benchmark smoke job.

Release

Revoke any token that was pasted into a terminal log or chat, then create a fresh PyPI API token. For token authentication, Twine must use __token__ as the username. The release script sets that for child Twine uploads when TWINE_PASSWORD starts with pypi-.

$env:TWINE_PASSWORD = "pypi-YOUR_NEW_API_TOKEN"

.\scripts\release.ps1 -Part patch -Upload

Useful variants:

.\scripts\release.ps1 -DryRun
.\scripts\release.ps1 -Version 0.2.0 -Upload
.\scripts\release.ps1 -Part patch -Upload -Repository testpypi
.\scripts\release.ps1 -Part patch -Upload -RunBenchmarks

If PyPI returns 400 Bad Request, the script runs Twine with --verbose so the server response should include the actual reason. Common causes are a version that was already uploaded, a package name that PyPI considers too similar to an existing project, or invalid metadata that Twine did not catch locally.

The PyPI distribution name is rookforge-ml; the Python import package remains chess_tools.

Design Notes

  • Board planes are encoded from the side-to-move perspective.
  • Current position planes come first, then older history planes.
  • The policy action space uses 56 queen-like moves, 8 knight moves, and 9 underpromotion moves per origin square.
  • python-chess remains the source of truth for legal move generation and game rules.

Metadata

Release files for rookforge-ml 0.1.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 rookforge-ml 0.1.1
File Size Uploaded Provenance
rookforge_ml-0.1.1.tar.gz 17.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rookforge-ml 0.1.1
File Interpreter ABI Platform
rookforge_ml-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.8 kB

Release files / rookforge_ml-0.1.1.tar.gz

Download URL rookforge_ml-0.1.1.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1533878d10bca25a5ea1e59ba5cd5639612c2c3e471295a8905054e4e7c1668b
BLAKE2b-256 checksum
How to use checksums
046f3810ec6dc0cc755383e28d23310b5da2e85530627f14a56a55e1b88b7bc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / rookforge_ml-0.1.1-py3-none-any.whl

Download URL rookforge_ml-0.1.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16844b5c908c9deb922dbfef4e40b8bdff3e1d63d8679e2912ba1ecfb1a3f7f3
BLAKE2b-256 checksum
How to use checksums
517271636a1869867d8ceff1284392f08b72073f4d04efcad0dcfdc896d4cf0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for rookforge-ml 0.1.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.1.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