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

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

Download URL chesslib-1.0.329488327-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
ec5412fb6871c6af647fc9c58025532643797b13ad1c04330ef57f878717a54c
BLAKE2b-256 checksum
How to use checksums
08062137789cab7efef28ac5b3592c40d3c3b747fbdc36dc63b67da8b74862ed
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.329488327-cp39-cp39-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488327-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
9b604e86bf6fd883751fda849b2368d1345a2ec238ec2cfd5aa4ca6e27a1c9f1
BLAKE2b-256 checksum
How to use checksums
a69565a24460f53d5b2016da29610ade1da6b437c89a8afb99026cb23a314a08
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.329488327-cp39-cp39-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488327-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
ebcc4c563b642feb9349d4d35b55abfddc8a163b6f9bed32e1e636094c6d2204
BLAKE2b-256 checksum
How to use checksums
c8895ab7c3b370f5a331e19636d158a9a14600b86e938398c227240549b02e24
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.329488327-cp38-cp38-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488327-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
15047b4e512031c9b4e98ce70c47b0937bb68148f26c5b952bb13f055a60a74e
BLAKE2b-256 checksum
How to use checksums
0adce604d84338ed07d6bd6714c26b104fedf2e26246b0d49af005d88f31be1c
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.329488327-cp38-cp38-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488327-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
c3315207a61fcbc800addaed13df7d43b2f4c657d5e577a30dfd948734f9b392
BLAKE2b-256 checksum
How to use checksums
153ee961933edb18b8385acf923cb93e7f390c753c1124ece268f779115c327e
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.329488327-cp38-cp38-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488327-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
9699ae4ea1faa2670ab23dc28d454a12e076db56286a21add1d71ca8527bf355
BLAKE2b-256 checksum
How to use checksums
0ed1fada17ee8172b000eb84cc5bff6b218a239dd5d887876c8084f44af25126
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.329488327-cp37-cp37m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488327-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
9a3ec036ddd263bc34b69597582a906d9b55721b74fff2386f28f1ae826b7212
BLAKE2b-256 checksum
How to use checksums
0c33ea681bd9b325a3b830cd762c7e4373ca08583a1c081aecf655ad2b0d6e46
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.329488327-cp37-cp37m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488327-cp37-cp37m-manylinux2010_x86_64.whl
Size 61.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
9173a5c29621f90bff5ceb61d18c226b269461819aea11bb6f76f7de166641f7
BLAKE2b-256 checksum
How to use checksums
ab397fb3b5a73dac98a1ac30608c8757b89e4ff9dcd4387c5e49900278f97314
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.329488327-cp37-cp37m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488327-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
52defda8cf8ef2dda428c76348eced5797905c2a24aa7a54cf14b37b8d834736
BLAKE2b-256 checksum
How to use checksums
27de9bb0cba490b56e2aa897bff048c0cca535ae537027a12ec889cfe474704f
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.329488327-cp36-cp36m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488327-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
bda922040a96b4871d0d2d0f45ad5ea3be19076c1047df62a6e2088403450fd6
BLAKE2b-256 checksum
How to use checksums
2fd6624771bf5a60a32641b9370fb542250bdf28ccc6eaa9eecdd6a3837acc2a
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.329488327-cp36-cp36m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488327-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
105f84ce6a800a10e2ef4e34534d127aa2057d406036033744d57a85deb6048d
BLAKE2b-256 checksum
How to use checksums
cdc9e04c2029595c57a11139239c65c59da7cfc16b4c0e7ef1be549f5db0d2f6
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.329488327-cp36-cp36m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488327-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
539c11c79a2b26cac994eafcab857e963c52f5c8aceefeb04de339746ecc1d81
BLAKE2b-256 checksum
How to use checksums
762bf893842fbe4e4ec2ce36c1ff1d59415a60fc2d36678ba1cf07d25e0a2390
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.329488327-cp35-cp35m-manylinux2014_x86_64.whl

Download URL chesslib-1.0.329488327-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
1bb114756238094a8f1969056040fe187edf34581c68efb911ffad692d95e915
BLAKE2b-256 checksum
How to use checksums
f95fe1f9a0d1adc78fbc07b283922d61d16039135e78e7bf1bb9ab044f2917da
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.329488327-cp35-cp35m-manylinux2010_x86_64.whl

Download URL chesslib-1.0.329488327-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
31a56fd3a77c1ce771968ef198ce7d008e4ec6f59d3892c11c20590a023430ab
BLAKE2b-256 checksum
How to use checksums
eeb469035bef4828f0098ed85e4992ca1984dfff2d566de6ab087b5d9612654f
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.329488327-cp35-cp35m-manylinux1_x86_64.whl

Download URL chesslib-1.0.329488327-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
e3d3ad1b592072a85fe407fff83b0a6554387e83b6294fbd8d15cedada51986d
BLAKE2b-256 checksum
How to use checksums
cb6a2235ad867b0540884caa72309db94f20fc5d4a52c554ee8dbea604407fd3
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.329488327 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