Skip to main content

Portable Game Notation (PGN) parser.

Project description

Description

This package provides a parser for chess game scores in PGN format.

Both the strict export format and many less strict import formats are supported.

Chess variants are not supported.

The game module provides the Game, GameStrictPGN, GameTextPGN, and GameIgnoreCasePGN, classes and the generate_fen_for_position function.

The parser module provides the PGN class and add_token_to_game function.

The PGN.read_games method yields instances of the Game class, or a subclass, generated from a file-like source or string.

The add_token_to_game function searches for the next PGN token in a string and applies it to an instance of the Game class, or a subclass.

The generate_fen_for_position function returns the Forsyth English Notation (FEN) string for the representation of a position in the Game class, or a subclass.

The movetext_parser module provides classes which expect movetext but do not expect it to represent a game.

The tagpair_parser module provides classes which take just enough notice of movetext to correctly spot PGN Tag Pairs and Game Termination Markers.

Installation Instructions

This package is available on PyPI so can be installed by typing

python -m pip install –user pgn-read

at the command prompt.

See Python and pip documentation for alternatives and platform-specific points.

Tests

Tests are available at the repository in the pgn_read.core.tests sub-package.

Copy the tests directory and run tests by typing, for example,

python -m pgn_read.core.tests.test_squares

at the command prompt with setup.py in the current directory.

Notes

Project name and package name changed from ‘pgn’ to ‘pgn-read’ prior to upload to PyPI.

The version numbers of pgn-read continue on from pgn.

The pgn_read.core.tests sub-package was removed from the distribution created by setup when the repository was created.

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_read-2.6.tar.gz (63.8 kB view details)

Uploaded Source

Built Distribution

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

pgn_read-2.6-py3-none-any.whl (79.2 kB view details)

Uploaded Python 3

File details

Details for the file pgn_read-2.6.tar.gz.

File metadata

  • Download URL: pgn_read-2.6.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pgn_read-2.6.tar.gz
Algorithm Hash digest
SHA256 5b51ba43d789cb2dce4b4dba6a0041559dfa87c17638a0bb6d582150746c6a3e
MD5 ccbb7aa9d891c0a5a5698ae68f41e76b
BLAKE2b-256 62727d405b1ccf2f51f69851a90fd289d00e74f65fb0e56aa0c57a2903fe1ad2

See more details on using hashes here.

File details

Details for the file pgn_read-2.6-py3-none-any.whl.

File metadata

  • Download URL: pgn_read-2.6-py3-none-any.whl
  • Upload date:
  • Size: 79.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pgn_read-2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e9812b1660a2c16541bf17f1f3b115fe25dbfafad9c138f544997f45ec4bf97c
MD5 a92bbebde100453f4a0d91680a4b6a48
BLAKE2b-256 f6b1b16763491b6f0dbf0e0e774794a1fe27edb5ba81fbfacd6b0fecf1bc9d27

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