stockfish
Wraps the open-source Stockfish chess engine for easy integration into python.
What it is and what it does
Stockfish is a Python wrapper around the open-source Stockfish chess engine, letting you query move analysis, position evaluation, and legality checking from Python without building your own UCI protocol handler. It manages the engine process, translates Python method calls into UCI commands, and parses engine output back into Python objects—dictionaries for move info, strings for moves, booleans for validation.
You initialize it with a path to the Stockfish binary, then call methods like `get_best_move()`, `get_top_moves()`, `set_fen_position()`, and `is_move_legal()` to interact with the engine. The wrapper handles engine configuration (threads, hash size, skill level, search depth) through a parameters dictionary, letting you tune strength and speed. It requires Python 3.10 or later and has no Python runtime dependencies—only the external Stockfish binary.
Use it for:
- Build a chess puzzle solver or analysis tool that evaluates positions and suggests best moves.
- Create a chess game with computer opponent by querying Stockfish for move recommendations at configurable strength levels.
- Validate chess moves and positions in a game engine or notation parser without manual rule implementation.
- Analyze chess games in bulk by setting positions via FEN and extracting evaluation scores and top-move rankings.
- Develop a chess training application that shows engine evaluation and mate-in-N calculations for learning.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps the Stockfish chess engine to let Python code query best moves, evaluate positions, and validate chess notation without reimplementing engine logic.
Yes. The package is actively maintained, has no Python dependencies, carries a permissive MIT license, and solves a clear problem—wrapping Stockfish without forcing you to parse UCI protocol yourself. The only real prerequisite is installing the Stockfish binary separately, which is documented. Use it if you need chess engine integration in Python.
Install
stockfish on PyPI
pip
pip install stockfishuv
uv add stockfishpoetry
poetry add stockfishInstalling stockfish
Before you install
Low friction install as a pure Python wheel with no runtime dependencies, though you must separately install the Stockfish engine binary on your system. Actively maintained with recent commits and production-stable status.
License in practice
MIT license permits commercial and private use with minimal restrictions—you may use, modify, and distribute this wrapper freely as long as you include the license notice.
Quickstart
pip install stockfish
from stockfish import Stockfish
stockfish = Stockfish(path="/path/to/stockfish/binary")
stockfish.set_fen_position("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")
print(stockfish.get_best_move())
You must install the Stockfish engine binary separately on your system and provide its path to the Stockfish class constructor.
Verify before relying
- Whether the wrapper supports all Stockfish versions or has known compatibility constraints beyond Python 3.10+.
- Performance characteristics when running on systems with limited CPU cores or memory.
- Whether Chess960 support is fully tested and production-ready.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 119 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,934,269/month — #2,197 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: stockfish-5.2.0-py3-none-any.whl
Keywords: chess, stockfish
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
python-chesspython-chess provides move generation, move…
copyleft · top 5,000 on PyPI
chessA pure-Python chess library providing move…
copyleft · top 5,000 on PyPI
zen-enginezen-engine is a Python binding for a Rust-based…
unclear · top 15,000 on PyPI
finlabBacktest trading strategies on Taiwan stock…
copyleft · top 15,000 on PyPI
TextArenaTextArena provides a framework of 100+…
permissive · top 15,000 on PyPI
azure-ai-evaluationEvaluates generative AI application outputs…
permissive · top 15,000 on PyPI
bfiA pure-Python interpreter for Brainfuck that…
permissive · top 15,000 on PyPI
magiccubeMagicCube implements NxNxN Rubik cubes with…
permissive · top 15,000 on PyPI
django-ordered-modelAdds ordering and reordering capabilities to…
permissive · top 15,000 on PyPI
pure-evalSafely evaluate Python AST nodes without…
permissive · top 1,000 on PyPI