Skip to main content

fastchess

A high-performance chess library written in C with Python bindings. Designed as a fast drop-in replacement for python-chess in data pipelines and machine learning workflows.

Installation

pip install fastchess

Requires a C compiler and NumPy. On most systems pip will handle this automatically.

Usage

import fastchess

board = fastchess.Board()                  # start position
board = fastchess.Board("rnbqkbnr/...")    # from FEN

# Move generation
moves = board.legal_moves_uci()           # ['e2e4', 'd2d4', ...]

# Apply moves
board.push_uci("e2e4")
board.push_san("e5")

# Board state
print(board.fen())
print(board.turn)                         # fastchess.WHITE or fastchess.BLACK
print(board.is_check())

# Tensor for ML (18 x 8 x 8 numpy array)
tensor = board.to_tensor(canonical=True)

# Mirroring
mirrored = board.mirror()

API

fastchess.Board(fen=None)

Method Description
copy() Return a copy of the board
mirror() Return a vertically mirrored copy with swapped colors
push_uci(uci) Apply a UCI move (e.g. "e2e4")
push_san(san) Apply a SAN move; returns the UCI string
legal_moves_uci() List all legal moves as UCI strings
piece_at(sq) (piece_type, color) at square index, or None
is_check() True if the side to move is in check
has_kingside_castling_rights(color) Castling rights query
has_queenside_castling_rights(color) Castling rights query
has_legal_en_passant() True if a legal en passant capture exists
to_tensor(canonical=False) Board as (18, 8, 8) numpy array
fen() Current FEN string

Constants

WHITE, BLACK, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING

License

MIT

Release files for fastchess 0.1.2

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

Source distribution (sdist)

Source distribution for fastchess 0.1.2
File Size Uploaded
fastchess-0.1.2.tar.gz 13.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fastchess 0.1.2
File
fastchess-0.1.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
fastchess-0.1.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
fastchess-0.1.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
fastchess-0.1.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
fastchess-0.1.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
fastchess-0.1.2-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
fastchess-0.1.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
fastchess-0.1.2-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 151.2 kB

Release files / fastchess-0.1.2.tar.gz

Download URL fastchess-0.1.2.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d7a3dd3efc92441196cddf07add38b3811fd7420436b493a3ffcdb45479e1657
BLAKE2b-256 checksum
How to use checksums
05d47681608c90150ba6ef366228d1c01f38cca0f06a00250a06416b3a76e87d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp312-cp312-win_amd64.whl

Download URL fastchess-0.1.2-cp312-cp312-win_amd64.whl
Size 17.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
19d4f37309accf87f9ffd7df009c4ba2c6cdaf82f21cea134d9ce831f67423c1
BLAKE2b-256 checksum
How to use checksums
d7419f1b47e1f2c51e5796f14f0ba12be0d401de0564672d6d3178da4f3fc7f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL fastchess-0.1.2-cp312-cp312-macosx_11_0_arm64.whl
Size 16.6 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2a0990650d50a7f24da5f1919800159685f19a4ced4b637bd74b94ea6df6e7ed
BLAKE2b-256 checksum
How to use checksums
30a67d8c22d56f35cb80d2a0d1022e8c34f503629d6a25f0b289c61ef4d97511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp311-cp311-win_amd64.whl

Download URL fastchess-0.1.2-cp311-cp311-win_amd64.whl
Size 17.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
3f5b07c59c51f265c920ba22ff0953fff5334fdaf2ccdf72d318543c0aeb7f6f
BLAKE2b-256 checksum
How to use checksums
5514eda40334763f6ff0b2791039f314b04a96bced0d3e9b894a3cb10f774e6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL fastchess-0.1.2-cp311-cp311-macosx_11_0_arm64.whl
Size 16.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
37cbc0ef85f734959f13f253b43aed508a769635208d9c978136c2f6f7e72530
BLAKE2b-256 checksum
How to use checksums
a728d0b65e71d2b8804cfc2c062362d521f2ecda2a495c4a513562821cf401c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp310-cp310-win_amd64.whl

Download URL fastchess-0.1.2-cp310-cp310-win_amd64.whl
Size 17.9 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
6b93f997359dcc3d5a8a0a3933aa8d9a6fcda482bd1ffdb950f02cd377861d27
BLAKE2b-256 checksum
How to use checksums
9564890efbffae0938fee6963be2a882470339e141e718eb9ab4a102e97e087e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp310-cp310-macosx_11_0_arm64.whl

Download URL fastchess-0.1.2-cp310-cp310-macosx_11_0_arm64.whl
Size 16.6 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e9dd2f06226ab1c3431e39fb4b41911926fed2790b5776ee65abc37f4c4298be
BLAKE2b-256 checksum
How to use checksums
e95acd19a4573222a1bbf1e155746558d0474d7fcee83d083770e7149b1454c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp39-cp39-win_amd64.whl

Download URL fastchess-0.1.2-cp39-cp39-win_amd64.whl
Size 17.9 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
c6b66b445508dde5d02066623c482b5b3763bb44773005a2fd506f912c47bc9c
BLAKE2b-256 checksum
How to use checksums
8488cc40045370fcf3d48de262681f7969108f64110667ca21bb4842e7e1ad01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release files / fastchess-0.1.2-cp39-cp39-macosx_11_0_arm64.whl

Download URL fastchess-0.1.2-cp39-cp39-macosx_11_0_arm64.whl
Size 16.6 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e42aa1b1c8d009b7ba285055d26fe629006b03cbfa2ed888c1e7c1d640b9529c
BLAKE2b-256 checksum
How to use checksums
5a72929a4a90a3bf0d84d5e032193425ac59d64504f0d8a5580a7d485a6c9ffb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

9 release files

0.1.1

9 release files

0.1.0

1 release file

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