Skip to main content

Module for creating match links on Lichess that players can join

Project description

play-lichess

build version license Discord

Python module for creating match links on Lichess that two players can join

📥 Installation

pip install play-lichess

🧑‍💻 Usage

Start a real-time match

import play_lichess

match = play_lichess.real_time()

print(match.link)  # eg. https://lichess.org/8KbWoJyU
print(match.title)  # Rapid (5+8) casual Chess • Open challenge • lichess.org
print(match.variant)  # Standard
print(match.color)  # Random
print(match.time_mode)  # Real-time

Start a correspondence match

import play_lichess

match = play_lichess.correspondence()

print(match.link)  # eg. https://lichess.org/8KbWoJyU
print(match.title)  # Correspondence casual Chess • Open challenge • lichess.org
print(match.variant)  # Standard
print(match.color)  # Random
print(match.time_mode)  # Correspondence

Start an unlimited time match

import play_lichess

match = play_lichess.unlimited()

print(match.link)  # eg. https://lichess.org/8KbWoJyU
print(match.title)  # Correspondence casual Chess • Open challenge • lichess.org
print(match.variant)  # Standard
print(match.color)  # Random
print(match.time_mode)  # Unlimited

Specify game options

import play_lichess
from play_lichess.constants import Variant, Color

match = play_lichess.real_time(
    minutes=6, 
    increment=0, 
    variant=Variant.ANTICHESS, 
    color=Color.WHITE
)

print(match.link)  # eg. https://lichess.org/8KbWoJyU
print(match.title)  # Blitz (6+0) casual Chess • Open challenge • lichess.org
print(match.variant)  # Antichess
print(match.color)  # White
print(match.time_mode)  # Real-time

Alternate syntax

import play_lichess
from play_lichess.constants import TimeMode, Variant, Color

match1 = play_lichess.create(time_mode=TimeMode.REALTIME, minutes=6, increment=0)

match2 = play_lichess.create(time_mode=TimeMode.CORRESPONDENCE, days=3)

match3 = play_lichess.create(TimeMode.UNLIMITED)

🔧 Options

Real-time

Argument Type Default Description
minutes int 5 The number of minutes for the match
increment int 8 Amount of seconds to increment the clock each turn
variant Variant STANDARD The variant of the match (STANDARD, CHESS960, etc.)
color Color RANDOM The color assigned to the first player that joins

Correspondence

Argument Type Default Description
days int 2 The number of days for the match
variant Variant STANDARD The variant of the match (STANDARD, CHESS960, etc.)
color Color RANDOM The color assigned to the first player that joins

Unlimited

Argument Type Default Description
variant Variant STANDARD The variant of the match (STANDARD, CHESS960, etc.)
color Color RANDOM The color assigned to the first player that joins

🧰 Development

To run tests (pytest)

python setup.py test

To lint (flake8):

pip install flake8==3.8.4 pytest

python setup.py lint

Project details


Download files

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

Source Distribution

play-lichess-0.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

play_lichess-0.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file play-lichess-0.0.1.tar.gz.

File metadata

  • Download URL: play-lichess-0.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

File hashes

Hashes for play-lichess-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c57a2b442b14b574e98dab85eca6d097588e58a82ceb356724378b32997a93a5
MD5 f668b47fcd3f4c905256b9d75cf2f8e1
BLAKE2b-256 275ce69332fc41866de43471419b82965a9150da28830bf3aa0e523273939c0d

See more details on using hashes here.

File details

Details for the file play_lichess-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: play_lichess-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.9

File hashes

Hashes for play_lichess-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46db8bb223feca81dd6c2dc07f7baf40daa3c2f71fb770377874c5c4b03db4a8
MD5 c34ec778b1fc7c0dd3e9d49fdc52c745
BLAKE2b-256 9b784f278b5fba16389b0d43e612c0b75412186f5245fa63e13efcdca793fcb1

See more details on using hashes here.

Supported by

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