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.4.tar.gz (61.2 kB view details)

Uploaded Source

Built Distribution

pgn_read-2.4-py3-none-any.whl (74.2 kB view details)

Uploaded Python 3

File details

Details for the file pgn-read-2.4.tar.gz.

File metadata

  • Download URL: pgn-read-2.4.tar.gz
  • Upload date:
  • Size: 61.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.14

File hashes

Hashes for pgn-read-2.4.tar.gz
Algorithm Hash digest
SHA256 d7848af39e65ebcea7a6bba5758bc7c4081139a34f3fa62325a086b520284f74
MD5 20ad088c524d030927f77a10c810f750
BLAKE2b-256 b0acf2e93cc805eafb78a76bf433cb58d4102b548606b8bc40e435c600aebb08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pgn_read-2.4-py3-none-any.whl
  • Upload date:
  • Size: 74.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.14

File hashes

Hashes for pgn_read-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b3be560c2efceca1c831f1c5b7123f89e60c5f6ad0159ee57174ee2420144cab
MD5 354bb05f1869c96aced8448637eab6e5
BLAKE2b-256 56d6aceb23b07d8cd12bd35aa370c12d0aaa5925ebc34ffb95f44005896947ec

See more details on using hashes here.

Supported by

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