Skip to main content

Pull your Chess games from chess.com and lichess.org into a sqlite3 database.

Project description

PGN to Sqlite

PyPI version GitHub

A cli application for pulling pgn files from Chess.com and Lichess.org and putting your games into a sqlite database.

It can also be used to save pgn files from a local folder to a sqlite database.

Install

Requires Python 3.9 and above.

It is recommended that you install this package in a virtual or isoloated environment. The easiest way to do this is with pipx.

pipx install pgn_to_sqlite

Alternatively, you can install it with pip into your virtual environment:

MacOS / Linux:

python3 -m pip install pgn_to_sqlite

Windows:

python -m pip install pgn_to_sqlite

Usage

Usage: pgn-to-sqlite [OPTIONS] COMMAND [ARGS]...

  Save your chess games to an sqlite database.

  You can `fetch` your games from chess.com or lichess.org. You can also
  `save` local pgn files to the database.

  Type `pgn-to-sqlite --help` for more information.

Options:
  -u, --user TEXT    You username for the chess site.
  -o, --output FILE  Where you would like your database saved?  [required]
  --help             Show this message and exit.

Commands:
  fetch  Fetch all games from the requested site.
  save   Fetch all pgn file from the given folder.

Fetch games from chess.com or lichess.org

username and output are required when using fetch to download, parse, and save your games to your database. fetch accepts with chess or lichess as an argument for chess.com and lichess.org respectively.

Example:

pgn-to-sqlite -u endlesstrax -o data.db fetch lichess

If you've played a lot of games, be patient, it could take a minute or two.

Save games from local folder

output is required when saving games from local pgn files to your database. save expects a folder path as an argument.

Example:

pgn-to-sqlite -o data.db save .\chess\games\

Feedback and Contribution

If you find a bug, please file an issue.

If you have feature requests, please file an issue and use the appropriate label.

Please raise an issue before making a PR, so that the issue and implementation can be discussed before you write any code. This will save you time, and increase the chances of your PR being merged without significant changes.

Please lint and format you code with ruff. Use ruff check . and ruff format . to check and format your code respectively. This will help keep the codebase consistent and maintainable.

Please include tests for any PR's that include code (unless current tests cover your code contribution).

Support

If you would like to show your support for the project you can sponsor me on Github, or buy me a coffee. 🤓

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

pgn_to_sqlite-2.2.0.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

pgn_to_sqlite-2.2.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pgn_to_sqlite-2.2.0.tar.gz.

File metadata

  • Download URL: pgn_to_sqlite-2.2.0.tar.gz
  • Upload date:
  • Size: 33.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pgn_to_sqlite-2.2.0.tar.gz
Algorithm Hash digest
SHA256 81a6f81916bbee4c2208b16d7584acfcead42443e98bbe4e72541c4b76936af4
MD5 b96bbec9cc3dbc8ea64f5067ccbd734f
BLAKE2b-256 a892add27a76ce671dd38586d77e6f7685ed3e00a8a874b209d26d12d488a503

See more details on using hashes here.

File details

Details for the file pgn_to_sqlite-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pgn_to_sqlite-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ca53137a184685eeee3c379ae27a6cef70dace40007b20f4b9c1771de40e5e2
MD5 75881d7d50b895302d2daf839661c8f3
BLAKE2b-256 24a2a2053912a10812c18a6ab4526c6c105927399b62b2cee377ff677b1e0024

See more details on using hashes here.

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