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

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

Metadata

Release files for chesslib 1.0.329487848

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

Total release size: 859.9 kB

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

Download URL chesslib-1.0.329487848-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
dad1227866c4e0128ef385b930f0eb857bff0254f7b74887a48481d8ee2ff2a7
BLAKE2b-256 checksum
How to use checksums
7c7fe05828d15aba96a70850b5e814c0ce49dd58deb5e2608d315abf241b69e9
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.329487848-cp39-cp39-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329487848-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
f0fa95398b4943ab0d3041eb75bfe37434991bab3d96cb311db8f23fa092fd2b
BLAKE2b-256 checksum
How to use checksums
dd88288a2fcd0462a744df09e0d5d8c74df2f5386a4b049c5ced9e8493db4350
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.329487848-cp39-cp39-manylinux1_x86_64.whl

Download URL chesslib-1.0.329487848-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
e009ee0c9c3aee1cb82daef8309756c089f68cfaa792a0a0557e7d1e6478f1d7
BLAKE2b-256 checksum
How to use checksums
d0fcb34127f3aa387e825ead246b6947ed6997303f96b217bca54f2eaf432ed2
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.329487848-cp38-cp38-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329487848-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
03a8f1f04fa1bb6b0704f3b2940fb22d5ccf824461256b1e0a536092fc605ac7
BLAKE2b-256 checksum
How to use checksums
e214a5e8e6b60835bc2d6a5db3e35cce5a108381ca33c9026e8a260bb6ede67e
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.329487848-cp38-cp38-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329487848-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
1fe285d29a8bf8baef23e22d4749080aee18003e0b3af965ad9643f980da4b0c
BLAKE2b-256 checksum
How to use checksums
46789aaf2ff327e9aec7b9de0fd1a347fb69390a8f1d353085538d4fe46d96e8
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.329487848-cp38-cp38-manylinux1_x86_64.whl

Download URL chesslib-1.0.329487848-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
743488ae9d01795e2136db753c34179da4530311c0520500a62506ed5296b9e6
BLAKE2b-256 checksum
How to use checksums
287849009d24e020a1bef53011c6f0d1a249749288b94ef12a4eb5906f626bce
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.329487848-cp37-cp37m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329487848-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
5cb3df949e9a97475945f580db9632d42399493504c7080b4f6e563f045883dc
BLAKE2b-256 checksum
How to use checksums
a4930c003cf542c7a080c42c5cfaa55742f71d1124f6a8cdaa47f72502ebfe71
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.329487848-cp37-cp37m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329487848-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
dd0e518f8d367e811b7f1645fc33cc60aa011b9f1d8ff4679c8dc5d0f4ae0012
BLAKE2b-256 checksum
How to use checksums
23dce7f19284abf0198cb2f3d134086923c24e53d468ba712fc1e4d74abf6eea
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.329487848-cp37-cp37m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329487848-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
54096408ad3100c54315d6ba91d89c2fdd3a78bd386eb31433dbfd1c9def058c
BLAKE2b-256 checksum
How to use checksums
ef0aa25034d601628b8616c880854f073fc0e404f36f44ef7ba819665e2e3898
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.329487848-cp36-cp36m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329487848-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
deb719d7c1fed181206a7580177d813f7ad73d74719714224f40c1ff71ce9b17
BLAKE2b-256 checksum
How to use checksums
01b19f84141f3a59e6f037536591654e8ed508e0d238ffbcc0cddbb4873f6cd4
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.329487848-cp36-cp36m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329487848-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
12ba7a1a6e1d78cfd0cc97028ccb8d1957cc848743eabbde0453996b6d64c962
BLAKE2b-256 checksum
How to use checksums
cb8c869b15e8d0c4b341d31f5f259f2d7e8cc8e345fb9d520ba7ccbf40bd9a55
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.329487848-cp36-cp36m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329487848-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
91a93d3d75cb2d4c2f72b43163c99cd5265ff139204993e116811bb4e3cc329c
BLAKE2b-256 checksum
How to use checksums
4001c5bd98342975839a845580a05debbb74dbc9303d11d661867eb9cb9b5340
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.329487848-cp35-cp35m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329487848-cp35-cp35m-manylinux2014_x86_64.whl
Size 60.5 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1d72b02e63346d8376d102ac0b667944b62205143397eda2b6c51eb3eb856355
BLAKE2b-256 checksum
How to use checksums
19f7cc0d764fb5be4756c1ea4bdb7769c5db376b8ede81256ebe6d2439eb3db2
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.329487848-cp35-cp35m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329487848-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
cca79c009ea77af29bc159a4cc8266b0977246f45d4bc63c67c950a6b44140c1
BLAKE2b-256 checksum
How to use checksums
1ff52950a194a2b5cf82086343240a36061fd10b3de8b64c2cccdaecf237451e
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.329487848-cp35-cp35m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329487848-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
1283c9de85e1f4480e5713c262ea0e820e000fef8800380a0c8c8a5c8589ca58
BLAKE2b-256 checksum
How to use checksums
51e23d0f35f045ac347f80b9f8eb5afe64a81a43f577a7bae91165c3d9e27bdc
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.329487848 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