pwenker / chessli Goto Github PK
View Code? Open in Web Editor NEWA free and open source chess improvement app that combines the power of Lichess and Anki.
Home Page: https://pwenker.com/chessli
License: MIT License
A free and open source chess improvement app that combines the power of Lichess and Anki.
Home Page: https://pwenker.com/chessli
License: MIT License
Pretty much this. Ran the command, was only able to generate a .md file and an updated log, but no csv appeared in the directory
Tactics anki cards ask me to make both white and black moves. How to solve it?
Purpose: Ensure all cli-commands work and keep on working.
Goal: v0.2
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
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
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
Purpose: Allow non-programmer benefit from this tool.
Instead of moves for Sicilian 1.e4 e5 2.Nf3 Nc6, there is an alternative way e2e4 e7e5 g1f3 b8c6. Please add this features to chessli.
Purpose: clear
Goal: v0.2
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?
Given this discussion on reddit, I'd like to make the installation process and general usage easier for Windows users.
You are a windows user and you have troubles installing/using chessli? Please let me know what's hindering you or where you got stuck!
Do you have experience in shipping python applications to Windows? Please let me know how you did that!
Hello, thank you for this app. It is exactly what I was searching for and I was excited to test it.
Unfortunately, after installing and configuring the app following the installation instructions I'm stuck with the following error:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/omegaconf/dictconfig.py", line 470, in _get_node
raise ConfigKeyError(f"Missing key {key}")
omegaconf.errors.ConfigAttributeError: Missing key store.
The show-configs command for my user ouputs the following configuration:
INFO General Config main.py:88
INFO {'user': 'Myusername', 'token': main.py:89
'mytoken'}
INFO User Games Config main.py:90
INFO {} main.py:91
INFO User Openings Config main.py:92
INFO {}
What am I missing?
Thank you in advance for your patience.
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.
how do i get this to work on anki?
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.
https://pwenker.com/chessli/tutorial/how_to_set_up_chessli/#getting-chesslis-anki-cards-templates links to https://ankiweb.net/shared/info/829523972 which says
NOTE: You need to add the following media files https://github.com/TowelSniffer/Anki-Chess-2.0/tree/main/Media%20Files to your anki collection media folder as described here: https://ankiweb.net/shared/info/1082754005.
However https://ankiweb.net/shared/info/1082754005 is giving "This shared item is missing or currently unavailable."
Could you please fix it?
thanks
raju
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:
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"]
- d4 cxd4 4. Nxd4 Nf6 5. Nc3
Would save a lot of time.
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
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
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?
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
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
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 :(
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!
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 ?
Code should throw ImportError
if apy cannot be found. Further, it should be possible to use apy
externally, with something like this:
Example:
chessli games export --format apy
# Output: <filename.md>
so that the output can be piped in to apy
.
And alternatively one can use --format csv
to later manually import into Anki with Anki desktop.
Lichess API and Berserk have updated resulting in 404 response querying puzzles with the old version. Updating Berserk fixes the url path but results in more errors by Omegaconf. After Berserk update:
.
.
.
File "/home/user/chessli/lib/python3.11/site-packages/chessli/cli/tactics.py", line 40, in ls
tactics_manager.print_new_puzzles()
File "/home/user/chessli/lib/python3.11/site-packages/chessli/tactics.py", line 103, in print_new_puzzles
puzzle_ids = self._get_ids_from_puzzle_activity(puzzle_activity)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/chessli/lib/python3.11/site-packages/chessli/tactics.py", line 80, in _get_ids_from_puzzle_activity
if self.config.failed_only:
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 355, in __getattr__
self._format_and_raise(
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/base.py", line 231, in _format_and_raise
format_and_raise(
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/_utils.py", line 899, in format_and_raise
_raise(ex, cause)
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/_utils.py", line 797, in _raise
raise ex.with_traceback(sys.exc_info()[2]) # set env var OC_CAUSE=1 for full trace
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 351, in __getattr__
return self._get_impl(
^^^^^^^^^^^^^^^
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 442, in _get_impl
node = self._get_child(
^^^^^^^^^^^^^^^^
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/basecontainer.py", line 73, in _get_child
child = self._get_node(
^^^^^^^^^^^^^^^
File "/home/user/chessli/lib/python3.11/site-packages/omegaconf/dictconfig.py", line 480, in _get_node
raise ConfigKeyError(f"Missing key {key!s}")
omegaconf.errors.ConfigAttributeError: Missing key failed_only
full_key: failed_only
object_type=dict
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.