skillfed

stockfish

Wraps the open-source Stockfish chess engine for easy integration into python.

stockfish v5.2.0 4.9M downloads/30d#2,197 on PyPI48
Permissive license MIT Active released

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 stockfish

uv

uv add stockfish

poetry

poetry add stockfish

Installing 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

Development Status :: 5 - Production/StableNatural Language :: EnglishOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Games/Entertainment :: Board GamesTopic :: Software Development :: Libraries :: Python Modules

Tags

chess engine python wrapperstockfish integrationchess move evaluationchess position analysisbest move calculationchess fen validationboard game ai
chess-enginegame-ai

More Python Modules packages