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.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

play_lichess-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: play-lichess-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 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.1.1.tar.gz
Algorithm Hash digest
SHA256 71e137b88e0d3c8cd459deaa621dacbedc1d44c1ea421f2ab09019db345208dc
MD5 90ce4bc8bd990583e5b7046fda825b47
BLAKE2b-256 e6ba767aeec6920028805a94c79460a7a2eec1c69e15be60c934a5e110cf2f5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: play_lichess-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1a39c8656bd902433312e73baf2275b8b90d639aa1b43805ee42395c5e03de3
MD5 69e6036393c785ce83b29e6167aeedf4
BLAKE2b-256 5205d420f26eac507c58dfbb006bf2a4cb761724163960a92dcf1dec9671dd48

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