Skip to main content

ChessLib Python Extension

About

This project provides an efficient chess draw generation extension for Python3. The main purpose of this project is enabling further TensorFlow AI projects and learning how to write an efficient Python3 extension (using good old C).

How to Build / Test

The commands for building the Python3 extension module and testing it properly are wrapped as a Docker image. Therefore just build the Dockerfile and use the image as base for your Python3 application importing the module.

Alternatively you could run the commands from the Dockerfile onto an Ubuntu-like machine and build the binaries on your own. I'm using the default distutils tools, so making your own builds should not be too hard to achieve.

# install docker (e.g. Ubuntu 18.04)
sudo apt-get update && sudo apt-get install -y git docker.io
sudo usermod -aG docker $USER && reboot

# download the project's source code
git clone https://github.com/Bonifatius94/ChessLib.Py
cd ChessLib.Py

# build the chesslib Python3 module using the commands from the Dockerfile
# this also includes running the unit tests (Docker build fails if tests don't pass)
docker build . -t "chesslib-python3:1.0"

# run a test command using the chesslib
docker run "chesslib-python3:1.0" python3 test.py

Usage

Install the official Python package using pip:

pip install chesslib

The following sample outlines the usage of the ChessLib:

import chesslib
import numpy as np
import random


test():

    # create a new chess board in start formation
    board = chesslib.ChessBoard_StartFormation()

    # generate all possible draws
    draws = chesslib.GenerateDraws(board, chesslib.ChessColor_White, chesslib.ChessDraw_Null, True)

    # apply one of the possible draws
    draw_to_apply = draws[random.randint(0, len(draws) - 1)]
    new_board = chesslib.ApplyDraw(board, draw_to_apply)

    # write the draw's name
    print(chesslib.VisualizeDraw(draw_to_apply))

    # visualize the board before / after applying the draw
    print(chesslib.VisualizeBoard(board))
    print(chesslib.VisualizeBoard(new_board))

    # revert the draw (just call ApplyDraw again with the new board)
    rev_board = chesslib.ApplyDraw(new_board, draw_to_apply)

    # get the board's 40-byte-hash and create a new board instance from the hash
    board_hash = chesslib.Board_ToHash(board)
    board_reloaded = chesslib.Board_FromHash(board_hash)

    # see ChessLib/test.py file for more examples

Roadmap

Following features are planned for the near future:

  • change Board_ToHash() / Board_FromHash() exchange format to Python type 'bytes' or 'bytearray' for better compatibility
  • improve code coverage of unit tests
  • implement CI/CD GitHub pipelines for DockerHub and PyPi releases
  • fix all memory leaks of the lib
  • think of performence testing / performance improvements (especially draw-gen)

Following optional / fancy improvements are to be considered:

  • add fancy travis build labels, beautify README
  • add API documentation compatible with common Python linters

Copyright

You may use this project under the MIT licence's conditions.

Metadata

Release files for chesslib 1.0.329515153

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

Built distributions (wheels)

Table of built distributions (wheels) for chesslib 1.0.329515153
File
chesslib-1.0.329515153-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329515153-cp39-cp39-manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329515153-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329515153-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329515153-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329515153-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329515153-cp35-cp35m-manylinux2014_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details

Total release size: 859.8 kB

Release files / chesslib-1.0.329515153-cp39-cp39-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329515153-cp39-cp39-manylinux2014_x86_64.whl
Size 60.7 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8e39082cf3fb6386fe39fe5653ce3bef1242ba568d6a6da5db79d267ce5fb062
BLAKE2b-256 checksum
How to use checksums
e25b1263003e514f002fd31aa076acc74fc7b4758574e889a199918dace54f4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl
Size 60.4 kB
Tags CPython 3.9 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
6da8dd6bb7f46468c0a554769f6cbaf83899837b4f4e8672f8c1004f5e9780cd
BLAKE2b-256 checksum
How to use checksums
21656aa4dd9f1ee9b6cc3ee297671b60a0237a71333cad56279176dc406189c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp39-cp39-manylinux1_x86_64.whl

Download URL chesslib-1.0.329515153-cp39-cp39-manylinux1_x86_64.whl
Size 50.2 kB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
dd9eab0eb41c0c5dbdddc5674aad5de609fd9cf8116cf4a99e1351c15db5c6f1
BLAKE2b-256 checksum
How to use checksums
661bcf860777f8a35641b75d1636e7b754781d5c28d151f8ffc7d480797e55a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp38-cp38-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329515153-cp38-cp38-manylinux2014_x86_64.whl
Size 61.0 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
03b2db03342c4ca5fff24244d66fc4ec2f572e7bf022ec5d39bd8606cfe88b42
BLAKE2b-256 checksum
How to use checksums
d7c5f3307ced79919b6065216a660d9497e540c98ffc99276913b9c58453fdf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl
Size 60.7 kB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
9c60e430b7000e63c66b91b76bcc9f1f61e8a18471b1543860b0ca534cc90d24
BLAKE2b-256 checksum
How to use checksums
9bfa9bbf72c78f4f8421f3faf9bcd431df7e4e166b62645bc28bc2d73cee04c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp38-cp38-manylinux1_x86_64.whl

Download URL chesslib-1.0.329515153-cp38-cp38-manylinux1_x86_64.whl
Size 50.6 kB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
4dfa67ecf337283549ea01866da84cecb4fb45b85fd9cd24337c6baa7c4486e3
BLAKE2b-256 checksum
How to use checksums
9672fc3caf389d5aa27e8b0a77c545763a5c2393b4af0aeba9f8a6ff5514e06f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp37-cp37m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329515153-cp37-cp37m-manylinux2014_x86_64.whl
Size 61.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
da45f8028c3561b962bd1ef092a310670df4181080d9055689c968f0a5499d07
BLAKE2b-256 checksum
How to use checksums
b065a8bb6f2c6ed33467977e8e422c63b2062cf58c03c6ebbe3e9ebf840ff438
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl
Size 61.5 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
e32a5390ced7b9d8da224aed37d713f20642ea5506b30c7cb95daaa89b55ad23
BLAKE2b-256 checksum
How to use checksums
1c7edbdcf7199a6f945b21f4a61406975d9da7501e659276beb11b673f9fd826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl
Size 50.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
17cf8e4c594da56a9ee8694edaa6f185b4c2c4357a6a9fb5598740ebf48eda37
BLAKE2b-256 checksum
How to use checksums
2ccc84d09d86d0af692a67cc9a34f6d1c5423ec6265d1376e6e33263de98db87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp36-cp36m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329515153-cp36-cp36m-manylinux2014_x86_64.whl
Size 60.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
7ce89a1b3fc29da4cdedc3475d148a819dc5b3cd94d0eb7f1873648cec89c27c
BLAKE2b-256 checksum
How to use checksums
d687a01d642fac14e69e8ff74804fd00f88c1f1213afb6143e455dad3d08906c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl
Size 60.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
3e04a8b45ebe19b8a1ba2fbdea41d3d1c1c706f6d0c6feef49ee9debd39e99b6
BLAKE2b-256 checksum
How to use checksums
b6462e4389d34c4e17341a6d1e56348fb86edc9e1dc4bafe2b8f3c95bec509ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl
Size 50.2 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
843b4303381cd5e7f5b5d40b26b9998526523083bafe0791b15b58f5c4d5f7ea
BLAKE2b-256 checksum
How to use checksums
13d0424816a7e1513696e59578555687a321d2da1dd489ba8ffa667eebf98efc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp35-cp35m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329515153-cp35-cp35m-manylinux2014_x86_64.whl
Size 60.6 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9dd7a86b92711fab71b5e5df688f1aa5fb0ce15395c5377e944de882a89adf78
BLAKE2b-256 checksum
How to use checksums
530a4f4e5e3336f76d949a9ebe1288fc390b3d19863cb6d05a25ff324e302ffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl
Size 60.3 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
d6e271726f258c28a7c1898f0616924107926bce007c06368a3808f9037369cd
BLAKE2b-256 checksum
How to use checksums
8e54d2e75f902054c7f9ff6c5b324f97a79bdd4218cd1d65d28d4e6037c59df3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release files / chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl
Size 50.2 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
ddca2e328deac080869edb84aba1d4186b852ae8feb705db02e9d603087318d7
BLAKE2b-256 checksum
How to use checksums
bcdc478cda555eb45461a2862181f9239d7169bb1713e03c0d23aef6859fb881
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

Release history Release notifications | RSS feed

This release

1.0.329515153 This release

15 release files

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