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.

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, and you have not introduced any new linter errors.

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.0.0rc2.tar.gz (9.5 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.0.0rc2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file pgn_clean_cg-0.0.0rc2.tar.gz.

File metadata

  • Download URL: pgn_clean_cg-0.0.0rc2.tar.gz
  • Upload date:
  • Size: 9.5 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.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 fa26996ab64bd74d45134dddec747462b0e8904adea113445255dcef0b7d0974
MD5 1543e34caf7f81a5ddf2d0051b8dbb4a
BLAKE2b-256 1ceae0ac73aa2006e147565f88c12982b891dd3b0f158b02c022171e27f64932

See more details on using hashes here.

File details

Details for the file pgn_clean_cg-0.0.0rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for pgn_clean_cg-0.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 9adf72468d4bda6f1522dfe5bb882a3f347f5967bd14747e34091c4faf61b845
MD5 c06872af67016d9d4d2d36f052efdf76
BLAKE2b-256 e02bf3e4f5a615a1848f46c9dd790bd83522f05542091080cbad967154153ac6

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