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.329488934

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.329488934
File
chesslib-1.0.329488934-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329488934-cp39-cp39-manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329488934-cp39-cp39-manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329488934-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329488934-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329488934-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329488934-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329488934-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329488934-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329488934-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329488934-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329488934-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
chesslib-1.0.329488934-cp35-cp35m-manylinux2014_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.17+ x86-64 Details
chesslib-1.0.329488934-cp35-cp35m-manylinux2010_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.12+ x86-64 Details
chesslib-1.0.329488934-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.329488934-cp39-cp39-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488934-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
38cc4f9eb31f9b3c8a019ee0f4e0b7f6266d9678073e6f04d166ea20efd4a653
BLAKE2b-256 checksum
How to use checksums
cf4403ca8e283c83bd8322570024308e8cb66e6603a39f9fa8bae2cb6f5fa457
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.329488934-cp39-cp39-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488934-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
6f94d18da2317fdf61efa91114bca462579541e8a605811a4261d0fe050db265
BLAKE2b-256 checksum
How to use checksums
2303d4f15c693c286c7de6ff375080b073345970f8c60ca1a154f1419415e026
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.329488934-cp39-cp39-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488934-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
e8c854a2c56b36234fd799827f9b9be7107da01088eeb7b65cda8782808b61c5
BLAKE2b-256 checksum
How to use checksums
6135a369076fcccaa3597a4e32f5b185086dd1c6e89db0ea36386a1c1c1841da
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.329488934-cp38-cp38-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488934-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
27c47b1e0c048fba29a9c3db25112d98a9de88508bf2b3a3e7c21efddb4c86f1
BLAKE2b-256 checksum
How to use checksums
039e0798cd9de0567891481e1526bf2e8414487f849529c422aced86aac4b5a3
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.329488934-cp38-cp38-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488934-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
40f7e22c3eab261a4c934e24b758ff48bfd28e3cc7c03dfedeb1ddf09b090523
BLAKE2b-256 checksum
How to use checksums
01700e740152bd888088d5e14a12302ce4fc02e59d73b40f9f87e94f9b5de9dc
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.329488934-cp38-cp38-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488934-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
efb88ad6599febfa573a4bdae3198c1ef3289ac08142a39b51bdff298ad2d096
BLAKE2b-256 checksum
How to use checksums
425848503ba164e24b799ff41b7de96a5df2e3f130913255eba802a79bb213db
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.329488934-cp37-cp37m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488934-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
1cdb13621c8f36974e150316131b79691e95834a498397cc8159084f1e103eda
BLAKE2b-256 checksum
How to use checksums
c5f4d72bd674f603456796687073fa9bd41a50c298d6ea20c0a16722505b8cc4
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.329488934-cp37-cp37m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488934-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
ccbed919fdae5371d40689605a80138e05db53a2aa0f304fdb5571f045f35120
BLAKE2b-256 checksum
How to use checksums
47bbeee45204ba1ae88e443d12d92949fa5e9de3183f821455fbe4dd92e8d7fc
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.329488934-cp37-cp37m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488934-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
b9eb4c531240fcfb5bbc383876fca929646bad5795d7256827337df237768aa9
BLAKE2b-256 checksum
How to use checksums
f5b5196702bdddeeb93c9a743cabb64af56032028e20adef34a3e79ab0ec658c
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.329488934-cp36-cp36m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488934-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
1a6710407b860aeced0661b1a8324a4471ab13b130bcba6fa787a72eab29a232
BLAKE2b-256 checksum
How to use checksums
c608163ea46e3446965dc9ecd8eddd50022859d021b5741854adbe47f20028f0
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.329488934-cp36-cp36m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488934-cp36-cp36m-manylinux2010_x86_64.whl
Size 60.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
cfa0ff92877c5e4d8a4c84a99b019fdc1e1c4b9fb14412993f4c2708b80f17cf
BLAKE2b-256 checksum
How to use checksums
e9d4ce26ae09a7da10d0a17d1fc03e58e1f6543a2f53fd289cdf3c298b644e10
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.329488934-cp36-cp36m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488934-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
8122b6b3458f5f90fa0cae0bc281cfdb5333ab6322d63cd0d1922b455a7c2a35
BLAKE2b-256 checksum
How to use checksums
c619e3f9b2081547f741693c0f718be0f86622177ed4d33eafc59ebe3e6f7313
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.329488934-cp35-cp35m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488934-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
76ddd3e2af39c341b2905b732ad11baf3c670e75c58eba5f12419bc81133b0a2
BLAKE2b-256 checksum
How to use checksums
52b7b638e0270a45788d6dce015e28623945f490d74b52d0b30f4357d0cce53d
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.329488934-cp35-cp35m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488934-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
8f60fdc5970e89a19c5863580eed8ecd08ece2c41093ea51f059eebf640ef53a
BLAKE2b-256 checksum
How to use checksums
bec69c60c4e065b600960ee92f6fd8713db6946130855797818abc26ac3cc7ae
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.329488934-cp35-cp35m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488934-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
633e90c51ef8990f7c9ce9b59329d06e893b17555ffb97e6708e9e00faa45231
BLAKE2b-256 checksum
How to use checksums
4ee1f865707e28ffad59b720575533a363e4f405f895a511d9410d6049e4386b
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.329488934 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