Skip to main content

PyPI version

Python Stockfish UCI Chess Engine wrapper


Getting Started:

pip install stockfishpy
  • Python 2.7

  • Download and make ‘Stockfish’ executable

  • Setup stockfish PATH in stockfishpy.py


USAGE:

Python console Example

>>> from stockfishpy.stockfishpy import *
>>> chessEngine = Engine(STOCKFISH_PATH, param={'Threads': 2, 'Ponder': 'true'})
>>> print chessEngine.uci()
uciok

>>> print chessEngine.isready()
readyok

>>> chessEngine.ucinewgame()
>>> chessEngine.setposition('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1')
>>> move = chessEngine.bestmove()
>>> print move['bestmove']
e7e5

>>> print move['ponder']
g1f3

>>> print move['info']
info depth 12 seldepth 16 multipv 1 score cp -32 nodes 296597 nps 2879582 tbhits 0 time 103 pv e7e5 g1f3 b8c6 f1b5 g8f6 d2d3 f8c5 e1g1 e8g8 b5c6 d7c6 f3e5 d8e7


>>> chessEngine.ucinewgame()
>>> chessEngine.setposition(['e2e4', 'e7e5', 'g1f3'])
>>> move = chessEngine.bestmove()
>>> print move['bestmove']
b8c6

Tests:

  • Setup stockfish PATH in stockfishpy.py

  • Execute stockfishtest.py


License:

This project is licensed under the GPLv3 see the LICENSE file for details

Metadata

Release files for stockfishpy 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stockfishpy 1.0.4
File Size Uploaded Provenance Actions
stockfishpy-1.0.4.zip 8.7 kB Without provenance Details for stockfishpy-1.0.4.zip

Release files / stockfishpy-1.0.4.zip

Download URL stockfishpy-1.0.4.zip
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fce06a74c953c84a2801164c0b53969642b28305f2ce764ecc26fd358c85fd95
BLAKE2b-256 checksum
How to use checksums
6d970df2ecdaa83ad8237d6f77f7557807abba019da34b5a2f207d19be727d89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for stockfishpy 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page