skillfed

chess

A chess library with move generation and validation, Polyglot opening book probing, PGN reading and writing, Gaviota tablebase probing, Syzygy tablebase probing, and XBoard/UCI engine communication.

chess v1.11.2 3.7M downloads/30d#2,510 on PyPI2,860
Copyleft license GPL-3.0+ Active released

What it is and what it does

python-chess is a pure-Python library for representing, manipulating, and analyzing chess positions and games. It handles move generation and validation, board representation in multiple formats (FEN, EPD, Shredder FEN), and detection of game-ending conditions (checkmate, stalemate, draws). It reads and writes PGN files with comments and variations, probes Polyglot opening books and Syzygy/Gaviota endgame tablebases, and communicates with UCI and XBoard chess engines via asyncio.

The library has no runtime dependencies and includes full type hints. It supports standard chess and variants (Chess960, Atomic, Crazyhouse, and others), integrates with IPython/Jupyter for board visualization, and is actively maintained across modern Python versions. High install friction stems from source-only distribution, though the codebase is stable and production-ready.

Use it for:

  • Build a chess engine or analysis tool that validates moves and probes endgame tables.
  • Parse and replay historical games from PGN files with full move and variation tracking.
  • Communicate with external engines (Stockfish, etc.) to evaluate positions and generate best moves.
  • Implement chess variants or custom game rules on top of the board representation.
  • Analyze opening theory by reading Polyglot opening books and generating legal move sequences.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pure-Python chess library providing move generation, validation, and support for standard chess formats (FEN, PGN, EPD) plus engine communication and endgame tablebase probing.

Yes, for chess applications and analysis tools. The library is stable, actively maintained, and provides a comprehensive pure-Python API with no external runtime dependencies. The GPL-3.0+ copyleft license is appropriate for open-source projects but requires review for proprietary use. High install friction (source distribution) is a minor friction point but not a blocker for most workflows.

Install

chess on PyPI

pip

pip install chess

uv

uv add chess

poetry

poetry add chess

Installing chess

Before you install

High install friction due to source distribution; no runtime dependencies. Actively maintained with recent commits and stable production status across Python 3.8–3.13.

License in practice

GPL-3.0+ copyleft license requires derivative works to be licensed under GPL-3.0 or later; suitable for open-source projects but may restrict commercial or proprietary use.

Quickstart

pip install chess

import chess
board = chess.Board()
board.push_san("e4")
print(board.legal_moves)

Requires Python 3.8 or later.

Verify before relying

  • Whether high install friction (source-only distribution) impacts typical deployment workflows or CI/CD pipelines.
  • Performance characteristics for large-scale move generation or tablebase queries relative to compiled alternatives.

Package facts

License GPL-3.0+ (copyleft)
Python support supports the current Python release (>=3.8)
Install friction high — source build required
Runtime dependencies none
Maintenance actively maintained — 535 days since the last release
Last repo commit
First released
Downloads 3,739,913/month — #2,510 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: chess-1.11.2.tar.gz

Keywords: chess, fen, epd, pgn, polyglot, syzygy, gaviota, uci, xboard

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)Operating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Games/Entertainment :: Board GamesTopic :: Games/Entertainment :: Turn Based StrategyTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

chess move generation validationpgn parser pythonchess engine communication ucifen board representationsyzygy tablebase probingpolyglot opening bookchess game analysis libraryxboard uci engine interface
board-gamesgame-enginepgn-parser

More Python Modules packages