python-chess
A chess library with move generation, move validation, and support for common formats.
What it is and what it does
python-chess is a pure-Python library for representing, validating, and manipulating chess games. It handles standard chess and multiple variants (Chess960, Atomic, Crazyhouse, etc.), generates legal moves, detects game-ending conditions (checkmate, stalemate, draws), and parses/generates common chess formats like FEN, PGN, EPD, and SAN notation. The library also integrates with opening books (Polyglot), endgame tablebases (Syzygy and Gaviota), and external UCI/XBoard chess engines for analysis and play.
The package is primarily used for chess analysis tools, game replay systems, engine interfaces, and educational chess applications. It has low install friction as a pure-Python wheel but carries a GPL-3.0+ copyleft license that restricts use in proprietary software. The codebase shows recent repository activity, but the latest PyPI release dates to 2020, and the package is marked as inactive in its classifiers, creating uncertainty about ongoing maintenance and support.
Use it for:
- Analyze chess games by parsing PGN files and replaying moves with full move validation and game-state detection.
- Build a chess engine interface to communicate with UCI engines like Stockfish for position evaluation and move suggestions.
- Generate legal moves and validate user input in a chess application or game UI.
- Probe endgame tablebases (Syzygy or Gaviota) to determine optimal play in simplified positions.
- Read opening books in Polyglot format to suggest common opening moves from a database.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
python-chess provides move generation, move validation, and board representation for chess games, with support for standard and variant chess rules, PGN/FEN/EPD formats, opening books, endgame tablebases, and UCI engine communication.
Yes, with conditions. The library is feature-complete for standard chess programming tasks and has no known vulnerabilities. However, the GPL-3.0+ copyleft license is a hard blocker for proprietary projects, and the gap between the latest release (2020-10-26) and current date raises questions about maintenance responsiveness. Install only if you need GPL-compatible licensing and can tolerate potential delays in bug fixes or updates.
Install
python-chess on PyPI
pip
pip install python-chessuv
uv add python-chesspoetry
poetry add python-chessInstalling python-chess
Before you install
Low install friction with a pure-Python wheel distribution. However, the package is marked as inactive (Development Status 7) despite an active repository; the latest release is from 2020-10-26, over five years old, which may indicate maintenance has stalled even though the repository shows recent commits.
License in practice
Licensed under GPL-3.0+, a copyleft license requiring any derivative work or distribution to also be open-source under compatible terms. This is a significant constraint for proprietary or closed-source projects.
Quickstart
pip install chess
import chess
board = chess.Board()
board.push_san("e4")
print(board)
Requires Python 3.8+ according to the documentation excerpt.
Verify before relying
- Whether the package is actively maintained despite the 2020 release date and 'Inactive' classifier conflicting with recent repository commits.
- Current Python version support beyond the 3.8+ minimum mentioned in the excerpt.
- Whether all documented features (Polyglot, Syzygy, Gaviota, UCI engines) are fully functional in version 1.999.
Package facts
| License | GPL-3.0+ (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — chess |
| Maintenance | actively maintained — 2,118 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,969,961/month — #1,999 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_chess-1.999-py3-none-any.whl
Keywords: chess, fen, epd, pgn, polyglot, syzygy, gaviota, uci, xboard
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
chessA pure-Python chess library providing move…
copyleft · top 5,000 on PyPI
stockfishWraps the Stockfish chess engine to let Python…
permissive · top 5,000 on PyPI
geojsonEncodes, decodes, and represents GeoJSON…
permissive · top 5,000 on PyPI
pydbmlPyDBML parses and generates DBML (Database…
permissive · top 15,000 on PyPI
Panda3DPanda3D is a 3D game engine with Python…
permissive · top 15,000 on PyPI
clip-benchmarkEvaluates CLIP-like vision-language models on…
permissive · top 15,000 on PyPI
django-syzygyAutomates Django database migration deployment…
permissive · top 15,000 on PyPI
memcache-hybridProvides Python bindings for a high-performance…
unclear · top 15,000 on PyPI
nashpyNashpy computes Nash equilibria and simulates…
permissive · top 5,000 on PyPI