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

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

Download URL chesslib-1.0.329512032-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
88c046339b94d9cfa0bae15ac72ff560fc11c155f2a8ac2fe294513d31c5d018
BLAKE2b-256 checksum
How to use checksums
b4dc36e38dc59d46a2c5bdedb20386811fe276f33d0d8fafb17fc23ea82102f5
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.329512032-cp39-cp39-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329512032-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
de34a864f306e38f485d933247f205499513839952c7de2643cb1247cdd6d233
BLAKE2b-256 checksum
How to use checksums
9acac62749d0defdc456770901b8e1743baa214c1165fd780e668f5d4ae106bb
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.329512032-cp39-cp39-manylinux1_x86_64.whl

Download URL chesslib-1.0.329512032-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
693036cc9f5bfc675522826f8e5621bcd76219bb3b6a3ce7784737cbbeeda295
BLAKE2b-256 checksum
How to use checksums
af55ddef4a83bdc9ddb6b90aa39a81fcfa635f3af3eec044d67f3830cc87fe7b
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.329512032-cp38-cp38-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329512032-cp38-cp38-manylinux2014_x86_64.whl
Size 60.9 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c202941fce74df8f2ce43557b76361597cea073a2c7cdd782057644b004d00ad
BLAKE2b-256 checksum
How to use checksums
03c25c7d6de957078a34aa97b1b782226a739de20e23c1806ca7af4f41f6aa30
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.329512032-cp38-cp38-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329512032-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
eed4fab22514fcf668daca66f34fb61cb95b469004dd48fd1ac504a1e53f6ea4
BLAKE2b-256 checksum
How to use checksums
f4c06ee395ed71eaa27c47d5c4a8d9bcfc4faabd49cfb68e50b2b933486277c7
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.329512032-cp38-cp38-manylinux1_x86_64.whl

Download URL chesslib-1.0.329512032-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
90930ef8c738a7fe297b1e3e78b082d92534bf5a321e8f19a4c5f24631b1dd37
BLAKE2b-256 checksum
How to use checksums
0108952dcbe0f10c15b8d93e724619d54220c8b905f600c5739d2791a7f07892
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.329512032-cp37-cp37m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329512032-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
62ea5e12126fc58d2501174caae2835919eb2d8380dcaee505ae61097427e9cf
BLAKE2b-256 checksum
How to use checksums
5cbab9aab0bb36986477a4532e725b62a5c4be0a34b39dfccd3a5e8f3f9e0d76
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.329512032-cp37-cp37m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329512032-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
ea98e862c3da7f04812c301ee65e91274abc399ca5611011d7eaf79b9bb9861b
BLAKE2b-256 checksum
How to use checksums
8e442985a0bc87f64134abdd00a58109f468016a9538cb43a2e28b4e30f60211
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.329512032-cp37-cp37m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329512032-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
e4f0b65c8e5dcef7a9d1b4271f8debbb1e6628c03bec01f0ecd00503bd2a0274
BLAKE2b-256 checksum
How to use checksums
57dbb3a57af9722a185b2f16150bd042d9b2c7329e08b434be4e873fd649277a
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.329512032-cp36-cp36m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329512032-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
1bb45cf3135c1467b138828571497d34afc7143c636b6ba08a89355c45e1ef80
BLAKE2b-256 checksum
How to use checksums
d03874b99db12fd6beefe6f1ac12a7f3a7cf64c77dd337329218b552d6e6d264
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.329512032-cp36-cp36m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329512032-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
d6e5601fdb043ea91067edea139c0cb2d31d5c11b9f7351990c6003ed41220df
BLAKE2b-256 checksum
How to use checksums
ace214917eb495bbec05dffafbf4cdd50e277173b919a43e9f7f837eeb979de5
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.329512032-cp36-cp36m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329512032-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
ad0e848d331a296f385d53779067231d99b4fbd6911b9b11ee11c969aaf52b2e
BLAKE2b-256 checksum
How to use checksums
e84985168d34dcc6e20ca8679bd19c192601d4b9572cef2158c01fdb09c32c3c
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.329512032-cp35-cp35m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329512032-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
f2fea6e7d7a2d259bd730b910e3bb3e463ec351737e1eea594c910114214700b
BLAKE2b-256 checksum
How to use checksums
e64067c3a2c40abeea38f7c84a3756eecd35143e126346f2a15e780c2b82ed72
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.329512032-cp35-cp35m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329512032-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
8d9c1edfd9d05eaf4721552bd34c5ee0296cd89ccc4ba51998868db17b066f7a
BLAKE2b-256 checksum
How to use checksums
7502316d6b5e96920566306f92deddc583bb26710ed747ec94a4d8108f5e0901
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.329512032-cp35-cp35m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329512032-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
a18161260416e033b175b2437ad0fed5f40865612b181f3aa271808afa39ec61
BLAKE2b-256 checksum
How to use checksums
c919989f3ca1be6702932c640b537f830e13e0a2742e573572584de49660eb87
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.329512032 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