A free and open-source chess improvement app that combines the power of Lichess and Anki.

Overview

Thumbnail

A free and open-source chess improvement app that combines the power of Lichess and Anki.

Chessli
Project GitHub Repo stars GitHub code size in bytes Lines of code
Activity & Issue Tracking GitHub last commit GitHub issues GitHub closed issues
PyPI PyPI PyPI - Python Version Downloads
Build & Health GitHub Workflow Status Codecov
Docs Documentation Status Tutorial
News & Updates Twitter Follow GitHub followers

Demos

CLI Demo (watch whole video on Youtube)

CLI DEMO GIF

Anki Cards Demo (watch whole video on Youtube)

CLI CARDS GIF

Documentation

Check out the documentation:

Tutorial
Setup chessli How to set chessli up
Games & Mistakes How to learn from your games
Openings How to build an opening repertoire
Tactics How to get better at tactics
Anki Cards How to use chessli's anki cards

Features

  • Automatically fetch your games and played tactics puzzles from lichess via the berserk python client for the Lichess API.!
  • Find your mistakes by parsing your games and analysing them with python-chess.
  • Build a simple opening repertoire and list your known openings
  • Spaced repetition & Retrieval Practice: Automatically (via apy) or manually (via csv export) add your game mistakes, your openings and your tackled lichess puzzles into Anki
  • Stats and visualizations: Seamlessly show lichess leaderboards or plot your rating history.

Getting Started

Installation

  1. Install pip. See here for help.

  2. Install chessli with pip:

pip install chessli

That's it!

Basic Usage

To get help about chesslis commands, open your console and type:

chessli --help

The same works for subcommands, e.g., :

chessli games --help

You can find an overview of all availabe cli-commands here in the docs.

Tutorial

Now as you are familiar with the basics, you might want to walk through the tutorial to get the most out of chessli! Start with setting up chessli.

Acknowledgments

Acknowledgements
Lichess A free, no-ads, open source chess server that let's everyone play chess! Think about whether to become a patron! :)
Anki A free and open-source flashcard program using spaced-repetition, a technique from cognitive science for fast and long-lasting memorization. I couldn't imagine learning without it anymore.
Anki Card Templates The interactive chess functionality on Chessli's anki cards is based from these fantastic cards.
python-chess Most of the heavy lifting, e.g. parsing games, finding mistakes, extracting openings, etc. is done with python-chess.
berserk The communication between lichess and chessli is performed via berserk
typer The chessli cli is built with the great typer
rich The rich colors and fancy tables are made possible by rich
apy Importing cards directly into anki without csv-export can be done via apy
Comments
  • ConfigAttributeError on fresh install

    ConfigAttributeError on fresh install

    Encountered the following issue when downloading and installing for the first time:

    ❯ chessli --help
    Traceback (most recent call last):
      File "/home/akshat/.pyenv/versions/3.8.6/bin/chessli", line 5, in <module>
        from chessli.cli.main import app
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/chessli/__init__.py", line 137, in <module>
        berserk_client = get_berserk_client(main_config.token)
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 353, in __getattr__
        self._format_and_raise(
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/base.py", line 190, in _format_and_raise
        format_and_raise(
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/_utils.py", line 821, in format_and_raise
        _raise(ex, cause)
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/_utils.py", line 719, in _raise
        raise ex.with_traceback(sys.exc_info()[2])  # set end OC_CAUSE=1 for full backtrace
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 351, in __getattr__
        return self._get_impl(key=key, default_value=_DEFAULT_MARKER_)
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 438, in _get_impl
        node = self._get_node(key=key, throw_on_missing_key=True)
      File "/home/akshat/.pyenv/versions/3.8.6/lib/python3.8/site-packages/omegaconf/dictconfig.py", line 470, in _get_node
        raise ConfigKeyError(f"Missing key {key}")
    omegaconf.errors.ConfigAttributeError: Missing key token
        full_key: token
        object_type=dict
    

    Environment: Ubuntu 18.0.4, System76 Laptop, Python 3.8

    I imagine there's a config file I have to supply somewhere, but this doesn't seem to be reflected in the docs?

    opened by AkshatM 7
  • Allow custom pgn to ankify

    Allow custom pgn to ankify

    I have a large tactics database on pgn format that is separated in individual chapters for each puzzle. The way this tool sounds, this should be possible in the current setup, any advice on how to do this ?

    enhancement 
    opened by ExtremeCoolDude 6
  • Structure application architecture as a pipeline

    Structure application architecture as a pipeline

    First off: awesome project! I've been using an ad-hoc process to study chess with anki but I've never been totally happy with it. I think this utility has a lot of potential so thanks for putting it together!

    My suggestion is to rework the architecture and move to a pipeline-style application with a controller and three distinct phases:

    1. sources - build a pgn file with games
    2. transformers - take a pgn file of games and build a pgn of "snippets" (pgn syntax but with a SetUp tag of 1, a FEN starting position and a few moves played out. I put an example at the bottom of this comment)
    3. ankifier - take a pgn file of "snippets" and build anki cards

    The lichess integration would be a "source"; integrations with chess.com, chessgames or chess24 could be other sources. Maybe interfacing with a Chessbase install could be another etc.

    The mistakes/openings/tactics functionality would all be examples of various types of "transformers".

    The ankifier would simply take these generated snippets and create anki cards.

    Then the controller would be responsible for parsing the command line, handling all the state/config (eg api credentials and last downloaded game timestamp for a source), and gluing it all together so the user only has to type something like:

    chessli lichess mistakes

    to get their recent games from lichess downloaded/analyzed/ankified, instead of running each component in the pipeline on its own. Or maybe

    chessli chessgames:tid=54397 openings

    to get cards on the openings used in the Fischer/Spassky match ankified from https://www.chessgames.com/perl/chess.pl?tid=54397

    My reasoning for all this is that separating the full program into distinct pipeline phases with no shared state would allow easier contributions and extensions in the future. For instance, I could imagine writing up another transformer for memorizing games. It could take a pgn file and split it up into overlapping, 4-move snippets (moves 1-4 in the first pgn snippet, 3-6 on the next etc.) and with this architecture I could plug it right in and immediately be able to pull games from any of the included sources and make anki cards with zero additional effort. Likewise, if I want to add a source I don't have to build the entire pipeline, just getting a pgn with games is enough. I would also have the option to skip phases as needed, like if I already have a database of endgame positions as pgn "snippets" I can just plug it directly into the ankifier.

    Anyways, this is just a thought, I don't know how far you want to take the utility or what use-cases you want to support, or if you even want to support it long-term lol. I just saw this and got excited for what it could be x). Feel free to delete/ignore this.

    An example of a snippet might be: (Note, Lichess uses the [Variant] tag instead of the [SetUp] and [FEN] tags, maybe both styles should be supported)

    [Event "F/S Return Match"] [Site "Belgrade, Serbia JUG"] [Date "1992.11.04"] [Round "29"] [White "Fischer, Robert J."] [Black "Spassky, Boris V."] [Result "1/2-1/2"] [Variant "From Position"] [FEN "rnbqkbnr/pp2pppp/3p4/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 0 3"]

    1. d4 cxd4 4. Nxd4 Nf6 5. Nc3
    enhancement 
    opened by jonprairie 5
  • [Question]  How to setup chessli  for testing and install from local directory

    [Question] How to setup chessli for testing and install from local directory

    Newish coder, how to setup chessli for tinkering purposes and also how to test tinkered features without breaking the pip install. Thanks for this awesome tool!

    question 
    opened by ExtremeCoolDude 4
  • Will there be plans to include PGNs for the openings?

    Will there be plans to include PGNs for the openings?

    while also quizzing for the move sequence of an opening, will there be an addition to the flashcard and software to add a PGN to play it out visually?

    enhancement 
    opened by nayyala 4
  • Totally new programmer

    Totally new programmer

    Does anyone know why I get this error message when I try to enter the command: I'm using Python 3.9

    py -m pip --version

    I get the message File "", line 1

    SyntaxError: invalid syntax

    Thank you for any help!

    help wanted good first issue 
    opened by Maryjezek 3
  • Charmap cannot encode characters found in certain games

    Charmap cannot encode characters found in certain games

    I got the following error after running chessli games fetch:

      File "C:\Python39\Scripts\chessli-script.py", line 33, in <module>
        sys.exit(load_entry_point('chessli', 'console_scripts', 'chessli')())
      File "c:\python39\lib\site-packages\typer\main.py", line 214, in __call__
        return get_command(self)(*args, **kwargs)
      File "c:\python39\lib\site-packages\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "c:\python39\lib\site-packages\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "c:\python39\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\python39\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\python39\lib\site-packages\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "c:\python39\lib\site-packages\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "c:\python39\lib\site-packages\typer\main.py", line 497, in wrapper
        return callback(**use_params)  # type: ignore
      File "c:\users\joeys\chessli\chessli\cli\games.py", line 58, in fetch
        game_manager.fetch_games()
      File "c:\users\joeys\chessli\chessli\games.py", line 105, in fetch_games
        chessli_game.store()
      File "c:\users\joeys\chessli\chessli\games.py", line 167, in store
        (self.path / self.name).with_suffix(".pgn").write_text(str(self.pgn))
      File "c:\python39\lib\pathlib.py", line 1275, in write_text
        return f.write(data)
      File "c:\python39\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 695: character maps to <undefined>
    

    '\u2192' is β€œβ†’β€, and I'm not sure exactly where in lichess this symbol would be found, but it occurred when trying to import this game: https://lichess.org/r0crIC7x/black

    opened by Epic-Doughnut 3
  • Error: requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url

    Error: requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url

    Ported from reddit for posteriority.

    I seem to be running into an issue fetching the games: Input:

    :~/chess/chessli$ chessli --user <name of the user> games ankify
    

    Output:

    requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://lichess.org/api/games/user/<name of the user>?since=1611013425256&max=20
    
    bug question 
    opened by pwenker 3
  • chessli games ankify clarification on mistakes

    chessli games ankify clarification on mistakes

    I've played ~180 games in lichess. I ran "chessli games ankify --since forever" and only got mistakes from 2 games

    I played 7 within the last week and the csv comes up completely empty.

    I'm not at that level where I only have 2/180 games with mistakes :p I think there might be something up with it, unless i'm not understanding what constitutes a mistake

    documentation 
    opened by nayyala 2
  • "chessli tactics ankify" always tells me I have no puzzles

    I ran "chessli tactics ls" and was able to print the table of puzzles

    I also did some puzzles in lichess before running the command

    However, running "chessli tactics ankify" always tells me I have no new puzzles. I've even tried running it for a handful of users and even with the --all flag.

    bug 
    opened by nayyala 2
  • Cannot ankify mistakes and games sequentially from last-time due to shared tag

    Cannot ankify mistakes and games sequentially from last-time due to shared tag

    When i do chessli games ankify

    I cannot then run the above command for opening since the last-time stamp is updated and tells me I have no new games to fetch

    opened by nayyala 1
  • installation issue - wsl

    installation issue - wsl

    tried installing on wsl with pip install chessli

    got: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

    so, i used export TMPDIR='/var/tmp' and the install completed. it's now in the site-packages file for python.

    however, if try to run chessli or any variation on cli, it tells me: -bash: chessli: command not found

    opened by avnav88 0
  • i can't install chessli, if anyone can help me please contact me on discord pls flex#3045

    i can't install chessli, if anyone can help me please contact me on discord pls flex#3045

    Hi guys I'm not very good with python and I couldn't install chessli, if anyone can make an explanatory video or send me a message on discord flex#3045 pls :(

    opened by jpfreiire 3
  • Start as black, have computer do first move?

    Start as black, have computer do first move?

    First off,

    Thank you so much for making this it is amazing. I have imported a csv with eco openings into cards.

    All the cards have me start as white and play the first move, this is not ideal for the sicilian lines and such. Is there a simple way for me to have the card play the first move and I respond as black?

    Thanks again for all the work you have done

    -Jake

    opened by jake0216 1
  • pandas.errors.ParserError: Error tokenizing data. C error: Expected 10 fields in line 3, saw 11

    pandas.errors.ParserError: Error tokenizing data. C error: Expected 10 fields in line 3, saw 11

    I'm new to chessli, running it on MacOS. When I run chessli tactics ankify I get:

    πŸ”₯ CHESSLI TACTICS πŸ”₯

    [22:36:48] INFO Fetching new puzzle activity... tactics.py:28 [22:36:57] INFO There are 176 new puzzles! tactics.py:95 INFO Trying to read the most up-to-date lichess puzzle database from tactics.py:38 https://database.lichess.org/lichess_db_puzzle.csv.bz2. This may take a few seconds...
    Traceback (most recent call last): File "/opt/homebrew/bin/chessli", line 8, in sys.exit(app()) File "/opt/homebrew/lib/python3.9/site-packages/typer/main.py", line 214, in call return get_command(self)(*args, **kwargs) File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 829, in call return self.main(*args, **kwargs) File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/opt/homebrew/lib/python3.9/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/opt/homebrew/lib/python3.9/site-packages/typer/main.py", line 497, in wrapper return callback(**use_params) # type: ignore File "/opt/homebrew/lib/python3.9/site-packages/chessli/cli/tactics.py", line 70, in ankify tactics_manager.ankify_puzzles() File "/opt/homebrew/lib/python3.9/site-packages/chessli/tactics.py", line 158, in ankify_puzzles puzzles_df = self.read_lichess_puzzle_database() File "/opt/homebrew/lib/python3.9/site-packages/chessli/tactics.py", line 41, in read_lichess_puzzle_database puzzle_df = pd.read_csv(url, names=column_names, compression="bz2") File "/opt/homebrew/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper return func(*args, **kwargs) File "/opt/homebrew/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 680, in read_csv return _read(filepath_or_buffer, kwds) File "/opt/homebrew/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 581, in _read return parser.read(nrows) File "/opt/homebrew/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1254, in read index, columns, col_dict = self._engine.read(nrows) File "/opt/homebrew/lib/python3.9/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 225, in read chunks = self._reader.read_low_memory(nrows) File "pandas/_libs/parsers.pyx", line 805, in pandas._libs.parsers.TextReader.read_low_memory File "pandas/_libs/parsers.pyx", line 861, in pandas._libs.parsers.TextReader._read_rows File "pandas/_libs/parsers.pyx", line 847, in pandas._libs.parsers.TextReader._tokenize_rows File "pandas/_libs/parsers.pyx", line 1960, in pandas._libs.parsers.raise_parser_error pandas.errors.ParserError: Error tokenizing data. C error: Expected 10 fields in line 3, saw 11

    any help is much appreciated

    opened by ericries 1
  • Support for card review in web browser

    Support for card review in web browser

    I've been working on a way to practice tactics in Anki, and came across chessli. This looks to be way better than anything I could cook up!

    I prefer to review my Anki cards in a web browser, rather than in the iOS app or the Anki desktop application. But I've noticed that opening the demonstration deck in Firefox from ankiweb.net results in running afoul of CORS policies. (At least, that's what I think it is.) Firefox displays this error:

    "Firefox Can’t Open This Page

    To protect your security, ankiuser.net will not allow Firefox to display the page if another site has embedded it. To see this page, you need to open it in a new window."

    When I open the card in a new window, I can complete the tactic puzzle, but it doesn't allow me to show the answer.

    opened by cshancock 1
Releases(v0.2.4)
  • v0.2.4(Mar 14, 2021)

  • v0.2.3(Mar 5, 2021)

    • Decouple 'last fetch time' between chessli games ankify and chessli openings ankify
    • Clarify that games need to be analyzed on lichess in order to create mistakes flashcards
    • Do not create csv files if they are empty
    • Some more things
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Feb 3, 2021)

  • v0.2.1(Feb 1, 2021)

    • Documentation added
    • Package uploaded to PyPi and so pip-installable
    • Basic testing added
    • Some feature extension
      • E.g. add csv-export
    • Refactoring and bug fixes
    Source code(tar.gz)
    Source code(zip)
Interactivity Lab: Household Pulse Explorable

Interactivity Lab: Household Pulse Explorable Goal: Build an interactive application that incorporates fundamental Streamlit components to offer a cur

1 Feb 10, 2022
One line Brainfuck interpreter in Python

One line Brainfuck interpreter in Python

16 Dec 21, 2022
Statistics Calculator module for all types of Stats calculations.

Statistics-Calculator This Calculator user the formulas and methods to find the statistical values listed. Statistics Calculator module for all types

2 May 29, 2022
A normal phoneNumber tracker made with python.

A normal phoneNumber tracker made with python.

CLAYZANE 2 Dec 30, 2021
Nmap script to detect a Microsoft Exchange instance version with OWA enabled.

Nmap script to detect a Microsoft Exchange instance version with OWA enabled.

Luciano Righetti 27 Nov 17, 2022
A stupid obfuscation thing

StupidObfuscation A stupid obfuscation thing How it works The obfuscator takes a string, splits into pieces of one, then, using the table from letter.

Echo 2 May 03, 2022
An execution framework for systematic strategies

WAGMI is an execution framework for systematic strategies. It is very much a work in progress, please don't expect it to work! Architecture The Django

Rich Atkinson 10 Mar 28, 2022
A python module for DeSo

DeSo.py A python package for DeSo. Developed by ItsAditya Run pip install deso to install the module! Examples of How To Use DeSo.py Getting $DeSo pri

ItsAditya 0 Jun 30, 2022
Poetry plugin to bundle projects into various formats

Poetry bundle plugin This package is a plugin that allows the bundling of Poetry projects into various formats. Installation The easiest way to instal

Poetry 54 Jan 02, 2023
Semester Project on Signal Processing @CS UCU 2021

Blur Detection with Haar Wavelet Transform Requirements Python3 opencv-python PyWavelets Install these using the following command: $ pip install -r r

ButynetsD 2 Oct 15, 2022
Final Fantasy XIV Auto House Clicker

Final Fantasy XIV Auto House Clicker

KanameS 0 Mar 31, 2022
A NetBox Plugin that gives a UI for generating, comparing and deploying configurations to devices.

netbox_config_plugin - A plugin to generate, compare and deploy configurations This plugin allows you to execute your code to generate a config for a

Jo 11 Dec 21, 2022
A webapp for taking fast notes, designed for business, school, and collaboration with groups.

JOTS Journal of the Session A webapp for taking fast notes, designed for business, school, and collaboration with groups.

Zebadiah S. Taylor 2 Jun 10, 2022
It really seems like Trump is trying to get his own social media started. Not a huge fan tbh.

FuckTruthSocial It really seems like Trump is trying to get his own social media started. Not a huge fan tbh. (When TruthSocial actually releases, I'l

0 Jul 18, 2022
Rotazioni: a linear programming workout split optimizer

Rotazioni: a linear programming workout split optimizer Dependencies Dependencies for the frontend and backend are respectively listed in client/packa

Marco 3 Oct 13, 2022
Domoticz-hyundai-kia - Domoticz Hyundai-Kia plugin for Domoticz home automation system

Domoticz Hyundai-Kia plugin Author: Creasol https://www.creasol.it/domotics For

Creasol 7 Aug 03, 2022
Reverse the infix string. Note that while reversing the string you must interchange left and right parentheses

Reverse the infix string. Note that while reversing the string you must interchange left and right parentheses. Obtain the postfix expression of the infix expression Step 1.Reverse the postfix expres

Sazzad Hossen 1 Jan 04, 2022
CPython extension implementing Shared Transactional Memory with native-looking interface

CPython extension implementing Shared Transactional Memory with native-looking interface

21 Jul 22, 2022
Waydroid is a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.

Waydroid is a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.

WayDroid 4.7k Jan 08, 2023
Got-book-6 - LSTM trained on the first five ASOIAF/GOT books

GOT Book 6 Generator Are you tired of waiting for the next GOT book to come out? I know that I am, which is why I decided to train a RNN on the first

Zack Thoutt 974 Oct 27, 2022