Skip to main content

Clean comments and Lichess computer analysis from pgn files.

Project description

pgn-clean-cg - A command line utility for removing Lichess computer analysis from pgn files

Are you tired of the computer spoiling all the fun before you even start to analyse your most recent chess game? Look no further, pgn-clean-cg is a command line utility for cleaning up pgn (Portable Game Notation) files.

  • Remove per move computer evaluation.

  • Remove per move comments, excluding clock times.

  • Remove variations, excluding the main variation.

  • Remove NAGs (Numeric Annotation Glyphs) such as ?, ??, !!, etc.

Usage

Run the command “pgn-clean-cg” on one or more .pgn (Portable Game Notation) and specify destination .pgn file. Example:

pgn-clean-cg input1.pgn input2.pgn out.pgn

More verbose output can be added using the “-v” flag

pgn-clean-cg -v input1.pgn input2.pgn out.pgn

The builtin help can be accessed using the “-h” flag

pgn-clean-cg -h

Installation

The following command install pgn-clean-cg from the Python Package Index. You will need a working installation of Python3 and pip.

pip install --upgrade pgn-clean-cg

Feedback and Contributing

Need help, or found a bug? Feel free to open an issue over on Codeberg. Please include which version of pgn-clean-cg you are using. This can be checked by running:

pgn-clean-cg --version

If you want to get involved, please read CONTRIBUTING.rst.

Contributing to pgn-clean-cg

First of all, thank you for considering contributing to pgn-clean-cg.

Before you open a pull request, please make sure that the code is correctly formatted, all unit tests pass, and there are no linter errors. This can be done using the make targets described below.

By submitting a pull request you certify that:

  • You are the author of the contribution, or have the legal right to submit it.

  • You either hold the copyright to the changes, or have the explicit legal authorization to contribute them under this projects license.

  • You understand the code.

  • You accept full responsibility for it.

Requirements

In order to checkout the code and initialize the development environment you will need:

  • Git

  • Python 3

  • Pip

  • Automake

These packages can be installed using your favourite package manager on Linux.

Getting the code

This project is using Git, and is hosted on Codeberg.

git clone ssh://git@codeberg.org/ehustad/pgn-cg-clean.git
cd pgn-clean-cg

Initializing the development environment

The development environment can be initialized by using the make target “init” from the top level source directory. This will create a virtual environment using the Python venv module in .venv, install development tools, and install pgn-cg-clean in editable mode.

make init

The make targets “env”, “install-dev-tools”, and “install” can be used if you want to do this in stages. Note that “install” depends on “install-dev-tools” and both “install” and “install-dev-tools” depends on “env”.

To initialize the virtual environment, run the make target “env” from the top level source directory:

make env

To install development tools, such as black, mypy, pylint, run the make target “install-dev-tools”. Note that this requires the virtual environment in .venv to exist, as all packages will be installed to that virtual environment:

make install-dev-tools

To install pgn-cg-clean in editable mode, run the make target “install” from the top level source directory:

make install

Formatting code

The code can formatted by using the make target “format” from the top level source directory:

make format

Running linters

The linters can be run using make the make target “lint” from the top level source directory:

make lint

Running unit tests

The unit tests can be run using the make target “test” from the top level source directory:

make test

Other make targets

Please run the make target “help” from the top level source directory, or see Makefile.

make help

Creating a pull request

Please see the Codeberg documentation.

Thanks

Parts of this was based on the AI policy of the pip project.

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_clean_cg-0.1.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgn_clean_cg-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pgn_clean_cg-0.1.1.tar.gz.

File metadata

  • Download URL: pgn_clean_cg-0.1.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for pgn_clean_cg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 34afd23e64c941fe668973936eda6486041c003b505310e3f4f64abb3c5f5dcf
MD5 b1a98cc8e27308a52811a4774862c84e
BLAKE2b-256 8cb60ea82348739d0e69af246f59956dd5ecca63ec39427eff554e5e10482b07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgn_clean_cg-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for pgn_clean_cg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82726c9c81f15b56a04978dee39c1c1b3e3a050e07c60a87c66969acfd0a355c
MD5 d254085a619bd82645aaafd6b46f0c41
BLAKE2b-256 14720224208dbffd86eac6f22b5e1113b170710e2bc4cbf9eef82fa250c89951

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page