Metadata-Version: 2.4
Name: pgn-clean-cg
Version: 0.0.0rc2
Summary: Clean comments and Lichess computer analysis from pgn files
Author-email: Espen Sandøy Hustad <espen@ehustad.com>
License-Expression: MIT
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: chess
Dynamic: license-file

.. SPDX-FileCopyrightText: 2026 Espen Sandøy Hustad <espen@ehustad.com>
.. SPDX-License-Identifier: CC-BY-SA-4.0

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:

.. code-block::

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

More verbose output can be added using the "-v" flag

.. code-block::

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

The builtin help can be accessed using the "-h" flag

.. code-block::

    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.

.. code-block::

   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.rst: https://codeberg.org/ehustad/pgn-cg-clean/src/branch/main/CONTRIBUTING.rst
.. _issue: https://codeberg.org/ehustad/pgn-cg-clean/issues
.. _Python Package Index: https://pypi.org/project/pgn-cg-clean/

.. SPDX-FileCopyrightText: 2026 Espen Sandøy Hustad <espen@ehustad.com>
.. SPDX-License-Identifier: CC-BY-SA-4.0

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`_.

.. code-block::

   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`_.

.. code-block::

    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:

.. code-block::

    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:

.. code-block::

    make install-dev-tools

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

.. code-block::

    make install

Formatting code
---------------

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

.. code-block::

    make format

Running linters
---------------

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

.. code-block::

   make lint

Running unit tests
------------------

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

.. code-block::

    make test

Other make targets
------------------

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

.. code-block::

    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.

.. _Codeberg: https://codeberg.org/ehustad/pgn-cg-clean/
.. _Codeberg documentation: https://docs.codeberg.org/collaborating/pull-requests-and-git-flow/
.. _editable mode: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
