Skip to main content

Python3 library for efficient chess draw-gen functions

Project description

PyPi Release Docker CI

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

Usage

Install the official Python package using pip:

pip install chesslib

Use the chesslib package like in the following example:

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 tests/ folder for more examples

How to Develop

The commands for dev-testing the chesslib are wrapped within a Docker environment. Therefore build the 'Dockerfile-dev' file which takes your source code and performs all required CI steps (build + install + unit tests). Afterwards you may attach to the Docker image with the bash console interactively and run commands, etc.

# make a dev build using the 'Dockerfile-dev' build environment
# this runs all CI steps (build + install + unit tests)
docker build . --file Dockerfile-dev -t "chesslib-dev"

# attach to the build environment's interactive bash console (leave the session with 'exit')
docker run "chesslib-dev" -it bash

# mount a Python test script into the build environment and run it
docker run -v $PWD:/scripts "chesslib-dev" python3 /scripts/test.py

Advantages of this approach are that it simplifies the dev machine setup a lot as you only need Docker, git and a good text editor on your local machine. Moreover you don't mess up your dev machine when trying to build and install the chesslib package for debugging again and again. And most importantly you keep your local copy of the git repo clean as all temporary files are created within the Docker container, so you basically don't need to worry about accidentially including build files into git commits, etc.

For a quickstart, set up your dev machine as a VM (e.g. Ubuntu 20.04 hosted by VirtualBox). After successfully creating the VM, use following commands to install all essential dev tools (git, docker, good text editor).

# install docker (e.g. Ubuntu 20.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 (if you haven't done before)
git clone https://github.com/Bonifatius94/ChessLib.Py
cd ChessLib.Py

# install the 'Visual Studio Code' text editor (optional)
sudo snap install code --classic

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 (if there even are leaks)
  • think of performence testing / performance improvements (especially draw-gen)

Following optional / fancy improvements are to be considered:

  • add fancy status badges, beautify README
  • add API documentation compatible with common Python linters

Copyright

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

chesslib-1.0.329519073-cp39-cp39-manylinux2010_x86_64.whl (60.8 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329519073-cp38-cp38-manylinux2010_x86_64.whl (61.2 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329519073-cp37-cp37m-manylinux2010_x86_64.whl (62.0 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

chesslib-1.0.329519073-cp37-cp37m-manylinux1_x86_64.whl (50.7 kB view details)

Uploaded CPython 3.7m

chesslib-1.0.329519073-cp36-cp36m-manylinux2010_x86_64.whl (61.0 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

chesslib-1.0.329519073-cp36-cp36m-manylinux1_x86_64.whl (50.7 kB view details)

Uploaded CPython 3.6m

chesslib-1.0.329519073-cp35-cp35m-manylinux2010_x86_64.whl (60.8 kB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

chesslib-1.0.329519073-cp35-cp35m-manylinux1_x86_64.whl (50.7 kB view details)

Uploaded CPython 3.5m

File details

Details for the file chesslib-1.0.329519073-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329519073-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b6c769c7fca11262fc25c5c0acb11333f17053e458db4f651230c14a8eb2407
MD5 3128c15f841ea92eb101be394081b5c7
BLAKE2b-256 3380787ea956c13c51534386287a7f818a5739507cc3b48154fa06b7d343f289

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.8 kB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 abace3248da366c2a6d1faf185270065e6eb1ad545d227dff2d1ef17b80e87ea
MD5 9cbb9c299a09226e57a466c32bf09a99
BLAKE2b-256 28d6c41ba309ccc495d9573b171dccb78bfdbcc7e601274a01e2c673284d0a30

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: CPython 3.9
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 19259c47f243b71cec584dc9b3e82b44d5c91767b771a5dfb8e9f5c02d1ce163
MD5 16f5d395cd7840eebb5881ff348b3432
BLAKE2b-256 5d2b75226dadbb0a0edb2269ed50a066da7cd16e905b497b2a28f01ccdfa3443

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329519073-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ff2874096a4c7a277d12d0426a86ce7dfe3fe928546847d1f6452d3873e8ad8
MD5 00ab09444cb30fe465b61ab1113d2ce9
BLAKE2b-256 3e9092ee2c15f47e3a00b1db9312c742c53284cd65134674a684bceca54091fb

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 61.2 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 829bf119705b7a5861364ab2b1698c190fea1265a7af79cb98e8c0feb662e969
MD5 66acb1831cc8b311f862db08203ce28e
BLAKE2b-256 c3490fdf030aa248f47a6edb26755681eae510bea4867de952ef464a09a94434

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 51.1 kB
  • Tags: CPython 3.8
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e0e2b09fdee24b1f31a25bec3bc75dc06ed19cdbd7aa5bae8ba497f881ac1529
MD5 354a7b48039d6908d2accb443ce3d773
BLAKE2b-256 3da19e6c6ce6062c2db58150ba9a6740c3390322237273d58b8b860652f36a2a

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329519073-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 16671c070bd91b0f4acf8194658bc6c6ad8889a355bb30cac24adcf78e3d679d
MD5 d2a4613a0c5f2fdf53461491e4d8e9b2
BLAKE2b-256 ec7b58c33ba6d622a21dfa43fff816e9d8fbdb71539fc844314c1b73c82e5055

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 62.0 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 17b0d23da9ebece28bd351b59f69e4b58b93957537fb564e59f4b433bde23621
MD5 a94956e482504054e054bded642acfc6
BLAKE2b-256 708af2017ceb85a3ee12700b81c488be98f751d9bb594616ba1af349446a917f

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: CPython 3.7m
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6c05854bd496aaa1bb7e99b887e36c0a6fe4a3fd22a283c6dfbf1faea3c95de8
MD5 87ba9bcca77e5a43aeaab63c6fe23419
BLAKE2b-256 f207f9eea0d9b926447b4e653b0ea4c75e10584d6123024008c521ea1761d225

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329519073-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 055fab4275af98e3496a55763a41bab35a225da3044593c185f6ae1c586a8156
MD5 ff90f8e5c385d31ddbc2c2962df73c1c
BLAKE2b-256 38fa61b283f037a00d23996c3936cae3502a4fb2334870eff1e0e43c11b61d9b

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 61.0 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 835347a35b664458a5f2812410c1de656984b8603b107d010021b1f3f9025194
MD5 3131927ec0d33b242289f304f3e5b49b
BLAKE2b-256 fad3127702edf6e16a3cc0801815ac8d577a3581e7c85bd80e5a5b46c52f21a5

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: CPython 3.6m
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 39f9118fece5902cce89926ca32fd88a9915d67a486bdbcceb6dbd3981db059b
MD5 470a802b084d6a761f146cd0b820114d
BLAKE2b-256 b05aa9ad53023bab27877fb98f3633b7cc2c2b391c02fbdcc67339665bdf0875

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp35-cp35m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329519073-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78f55e2a096576486fe1df10fb0d8aeaedc3a0dffb7fd2fb1b5cbff516c1f991
MD5 5bfe169d7ce974249989ebf7cedb2345
BLAKE2b-256 9da2329444419e41937436e6bca579558ae47f8fd8ec9d58b5cef53f253eabdf

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.8 kB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a41ead1a0f4dd754db678514fecee438b6ac9ccfd2b9cc2ed50190ba0750c3c9
MD5 95a82c636e63328b199c49b3ea3f1b17
BLAKE2b-256 137f5c4e1a6fc5f2d74ccaaacce971de9eb93c5e7e667af5cc18eee2d10b2a08

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329519073-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329519073-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: CPython 3.5m
  • Uploaded using 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

File hashes

Hashes for chesslib-1.0.329519073-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 61508092e4e00dfa49c02cdd237c246b5016d5ca95acab188a76ad34c5de008c
MD5 e846d38ac658b221897938d9cae058f8
BLAKE2b-256 d4182e8b5d4f8299d97bc43313e7275085890ebc3429ec588da331b9c04a2d4b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page