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.0.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.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pgn_clean_cg-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c955e099b9010546e482dcbdf409ae422fcfe4b47a6bcdb21285ea7dbf931edc
MD5 edd89ffd1e729e4b89ea104ed9cd1c06
BLAKE2b-256 ac577602817e06ad83cca7ca4edd58293f8805862baaf7777b8751154648fde7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgn_clean_cg-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1b38954acc54c75ac67098ec962a17baf900a1831f1832befa635ebfa4c6772
MD5 94a3974a674de31c3f603fafcf6b8314
BLAKE2b-256 0b2e72fe05fdd32706a2eabd4c4593db462ebc6787228e704ac5cf3f990093de

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