PGN History

Old history PGN Top

28 Noveber 2023


The trailing newline must be present to form a line comment or escaped line.

PGN text without newlines embedded in the source code of some web pages, where semi-colons but no newlines are present in the HTML, can now be spotted.


8 October 2023


Report character position of end of game in import PGN file.


19 November 2022


Adjustments prompted by pylint, pycodestyle, and pydocstyle, reports.


6 March 2022


[] section added to pyproject.toml file.


8 October 2021


Installation from wheel (*.whl) format by 'pip' supported.


3 October 2021


Installation instructions are changed: use 'pip' to install pgn-read.


29 September 2021


Apply black formatting, pydocstyle hints, and many pylint hints.


29 April 2021


Allow for an End of File marker, often called Ctrl-Z, at the end of a PGN file because when PGN files are concatenated the Ctrl-Z of a file would cause the first PGN Tag of the next PGN file to be not at the start of a line (or even the first thing after some whitespace). See for a description.

Ctrl-Z did not seem to be a problem for PGN files until early January 2021 which is when I first saw cases (in fairly recent files, up to 8 years old, not older ones).

A method is added which compares the Result Tag value with the Game Termination Marker value when testing if a game score is valid PGN export format. It uses existing methods available to validate the tags and movetext separately.

Insignificant whitespace is removed from PGN tags for internal representation. Thus '[ TagName " Tag Value " ]' becomes '[Tagname" Tag Value "]'.

Fix O-O and O-O-O when a piece on b1, g1, b8, or g8, is the only piece blocking the line from king to rook.

Fix problem preventing alternatives to Nf3, for example, being expressed as Nf3((Nc3)a3(e3)).

When ignoring case bishop moves and b-pawn moves are distinguished by case only if the movetext describes both a legal bishop move and a legal pawn move. For example 'bxc4' with a white pawn on b3, a white bishop on d3, and a black pawn on c4.

When ignoring case the FIDE notation for pawn promotion is not allowed.


2 January 2021


Remove check indicators, and translate traditional annotations such as '!!' to the Numberic Annotation Glyph equivalents, on import so these can be added to PGN output in a consistent way.

Fix problem handling '{...}' and '<...>' sequences which contain Game Termination Marker text or are missing the '}' or '>' character at end.

Attempt to fix PGN tag values in which '"' and '\' characters seem to be not escaped when some relaxation of strictness is allowed. The correctly escaped version of "Team "C"" is 'Team \"C\""' for example.

Attempt to fit the PGN specification of default tag values more closely. The value "" is accepted unless a default value is given. Thus only the Seven Tag Roster tags and the 'WhiteTitle', 'BlackTitle', 'WhiteElo', 'BlackElo', 'WhiteNA', and 'BlackNA', tags are required to have a non-"" value in a valid PGN game.


20 October 2020


Fix problem handling text which is not valid PGN when some relaxation of strictness is allowed.

There are three levels of strictness: valid PGN text only, some minor exceptions to valid PGN text allowed too, and all text which is not valid PGN is ignored. The problem was treating the 'minor exceptions' case like the 'ignore all invalid PGN' case rather than the 'valid PGN only' case when errors are detected.


2 September 2020


Rewrite to support strict interpretation of PGN and a number of relaxations of scrictness.

The PGN standard prohibits unnecessary precision in movetext: for example 'Nge2' where 'Ne2' is sufficient. This prohibition can be ignored, going as far as allowing Long Algebraic Notation except for pawn moves: 'c2c4' is not allowed but 'c2-c4' is allowed, and c2xb3 is allowed. The Short Algebraic Notation equivalents are 'c4' and 'cxb3'.

Lower and upper case characters can be allowed in movetext. Thus 'D4' can be a pawn move and 'rE7' can be a rook move. Some bishop and pawn moves may be ambiguous and case may have to matter in deciding between the bishop and pawn move interpretations.

Sequences of characters which are not valid PGN movetext can be allowed and would be ignored.

The reserved, '<...>', and escaped, lines starting '%', sequences of characters can be captured rather than ignored.

The FIDE notations for castling and pawn promotion are different to PGN and can be allowed.

Functions too closely associated with the ChessTab database are removed (to ChessTab).


13 May 2020


Fix adjustment of castling options when a rook which has not moved before is captured by a rook which has not moved before. For example Rxa8 should turn 'Qq' into '-' but it was changed to 'q'.


15 November 2019


Games containing valid PGN movetext such as Qb2c3 or Qb2xc3 are now exported from a database, rather than causing a program crash. Display of such games did not need changes to pgn-read, see ChessTab-3.0.6 release notes.

The move counter, for half-moves since last capture or pawn move, and full-move number, for a white move and a black move, are added to the data describing a displayed game: simplifying the changes in ChessTab to display and navigate the longest possible game in reasonable time. See ChessTab-3.0.6 and ChessTab-4.0.1 release notes.


11 November 2019


Project directory structure changed from pgn-read to pgn-read/pgn-read where the implementation moves to pgn-read/pgn-read and project descriptions and remain in pgn-read.


21 May 2019


Fix the validation of non-pawn moves or captures something so the move or capture is spotted as illegal if the non-pawn's specified start file or rank does not match the origin square. For example the move 'Rfe3' is now illegal where before it was treated as 'R1e3' with rooks on e1 and f2 and squares e2 and e3 empty.


21 February 2019


Output tags which are not in the Seven Tag Roster like [ECO "A10"] rather than [ECO"A10"] in export format PGN. The Seven Tag Roster tags were, and are, done correctly.


10 January 2019


Fix the validation of moves where a pawn captures something so the move is spotted as illegal if the pawn's specified start file does not match the square the pawn moves from. For example the sequence '1. e4 d5 2. cxd5' is now illegal where before it was treated as '1. e4 d5 2. exd5'. Sequences such as '1. e4 c6 2. c4 d5 3. cxd5' and '1. e4 c6 2. c4 d5 3. fxd5' were, and are, treated correctly.


17 November 2018


Package README file brought up to date.


8 November 2018


Change project name to pgn-read and top-level package directory to pgn_read prior to upload to PyPI, but continue the version number sequence.

PGN is the name of a specification but pgn-read hints at the ability to read games from PGN files.

Fit unit tests to constant definition changes made in pgn-0.10.1.


30 October 2017


Improve correction, by editing, of errors detected in PGN text. Errors are put in a '{Error: ...}' comment and it is assumed such comments do not appear naturally. Any '}' put in the error comment are replaced by '::{{::' which is assumed to not appear naturally. The first move in the error comment will be incorrect.


2 October 2017


Move calculation of database index values to chesstab package.


6 August 2017


Fix regular expression which should allow quotes within quoted strings.


14 September 2016


Documentation changes only.


5 September 2016


Performance improvements to regular expressions.


7 August 2016

See Old history for previous changes.