--- id: stockfish version: "5.2.0" license: MIT license_treatment: permissive maintenance: active --- # stockfish — Wraps the open-source Stockfish chess engine for easy integration into python. License: permissive · Maintenance: active · Downloads: 4.9M/mo ## 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 above — 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 pip install stockfish uv add stockfish 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_current - Install friction: low - Maintenance: active - Downloads: 4.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags chess engine python wrapper, stockfish integration, chess move evaluation, chess position analysis, best move calculation, chess fen validation, board game ai, chess-engine, game-ai [View on SkillFed](https://skillfed.io/packages/stockfish) · [View on PyPI](https://pypi.org/project/stockfish/)