Module for creating match links on Lichess that players can join
Project description
play-lichess
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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for play_lichess-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46db8bb223feca81dd6c2dc07f7baf40daa3c2f71fb770377874c5c4b03db4a8 |
|
MD5 | c34ec778b1fc7c0dd3e9d49fdc52c745 |
|
BLAKE2b-256 | 9b784f278b5fba16389b0d43e612c0b75412186f5245fa63e13efcdca793fcb1 |