Skip to main content

chipiron plays chess

Project description

python Checked with mypy Ruff linting: pylint Tests pytorch Pyright

Chipiron

Chipiron is a Python library that plays chess

Acknowledgments

Play Online against Chipiron

Play at this website !


Related Projects

Chipiron integrates and builds upon other personal repositories:


Quickstart

git clone https://github.com/victorgabillon/chipiron.git
cd chipiron
make init
python3 chipiron/scripts/main_chipiron.py

Requirements

  • Python 3.13
  • pip
  • curl
  • tkinter
  • make
  • libxcb-cursor0
  • zstd (for decompressing Lichess PGN databases)
  • cc (or else to build some rust dependencies)

Optional:

  • Stockfish chess engine (can be installed with make stockfish)

Installation

Using Make

This will install Python dependencies, download syzygy tables, retrieve datasets, and GUI images:

make init

Optional: Install Stockfish Chess Engine

If you want to use the integrated Stockfish player for stronger AI opponents:

make stockfish

This downloads and installs Stockfish 16 (~40MB) to the correct location for chipiron integration.

(Optional) Using Conda

Click here for detailed instructions with conda
git clone https://github.com/victorgabillon/chipiron.git
cd chipiron
conda create --name chipiron3.13 python==3.13
conda activate chipiron3.13
conda install -c conda-forge tk=*=xft_* # to fix graphical problems with tkinter
make init

Docker

The Chipiron Docker image is published to Docker Hub.

Simply pull the image

docker pull victorgabillon/chipiron:latest

Or, build the Docker image:

docker build -t chipiron-x11 .

To run the Docker container with GUI:

sudo docker run --rm \
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  --network=host \
  -u $(id -u):$(id -g) \
  <image_name>

Usage

Every script should be run via main_chipiron.py and run from the ROOT_FOLDER. The type of script can be specified via the argument --script_name. Yaml config file can be specified via --config_file_name.

Base case with a GUI to play against chipiron or watch it play

Starts a gui to choose your options of play.

python3 chipiron/scripts/main_chipiron.py

Other Scripts:

One match:

This allows to play a match between two players.

python3 chipiron/scripts/main_chipiron.py --script_name one_match --config_file_name chipiron/scripts/one_match/inputs/base/exp_options.yaml

League

This allows to run a league of selected players and compute their Elo ratings.

python3 chipiron/scripts/main_chipiron.py --script_name league

Lean a NN from a labelled dataset

This learns Neural Networks from a database of labelled boards.

python3 chipiron/scripts/main_chipiron.py --script_name learn_nn --config_file_name chipiron/scripts/learn_nn_supervised/exp_options.yaml

Documentation

Full documentation is available at chipiron.readthedocs.io.

To build and view the documentation locally:

cd docs
make clean
make html
xdg-open _build/html/index.html

Testing

Run all tests with:

tox

or

pytest

Integration Testing

For complete end-to-end validation, use the integration test scripts that test the entire installation process in a clean environment:

# Python version (comprehensive logging and reporting)
python scripts/integration_test.py

# Shell version (lightweight and fast)
./scripts/integration_test.sh

# Test with custom repository
python scripts/integration_test.py --repo-url https://github.com/your-fork/chipiron.git

# Keep temporary files for debugging
python scripts/integration_test.py --keep-temp --verbose

These scripts:

  • Create a temporary conda environment
  • Clone the repository fresh
  • Run complete makefile installation
  • Test all components (Stockfish, Syzygy tables, GUI, chess functionality)
  • Generate detailed reports

See scripts/README.md for detailed documentation.


Contributing

Please open issues or pull requests on GitHub.

Development Requirements:

For development and testing, additional dependencies are listed in requirements_dev.txt:

pip install -r requirements_dev.txt

This includes tools for:

  • Type checking (mypy)
  • Linting (pylint, ruff)
  • Testing (pytest, tox)
  • Documentation building (sphinx)
  • Code formatting and development tools

For the prehook to work pleas run

pre-commit install # precommit is supposed to be pip-installed from requirements_dev.txt

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.


Contact

For questions or support, please open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chipiron-0.1.10.tar.gz (5.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chipiron-0.1.10-py3-none-any.whl (5.5 MB view details)

Uploaded Python 3

File details

Details for the file chipiron-0.1.10.tar.gz.

File metadata

  • Download URL: chipiron-0.1.10.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for chipiron-0.1.10.tar.gz
Algorithm Hash digest
SHA256 baaeee02611108784a31ede3279f1d3310704ddf7f1dbd9a803da9f580836790
MD5 ba5109d2ac202cc7fe93ec9702bb11b7
BLAKE2b-256 a5090944d5db0fd256d0c3d25314b8fd8cce183f839394b029ba970912272503

See more details on using hashes here.

File details

Details for the file chipiron-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: chipiron-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for chipiron-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4ac95e3a19f1a84ef11d2cebcacb0d51d0ae3f8f90362b736e3eb92032eff45b
MD5 816e62a30f2d4d237a526ce07bcea065
BLAKE2b-256 06a463ca1f33b82301d999425a437cbe9d128b623e22612b2b50b45f636b6fb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page