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.1.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

play_lichess-0.1.0-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

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