Skip to main content

pgn-filter

A small program to query for games inside PGN documents.

You can supply basic queries using command line arguments and you can write more advanced queries using python scripts.

Example queries

Games starting with d4

from chess import Move

def query(game):
    first_move = list(game.mainline_moves())
    if first_move[0] == Move.from_uci("d2d4"):
        return True
    return False

Games with no castling moves

from chess import Board

def query(game):
    board = Board()
    for move in game.mainline_moves():
    if board.is_castling(move):
        return False
    return True

Installation instructions

pip install pgn-filter

Program usage

usage: pgn-filter [-h] [-f FILE] [-i] [-q QUERY] [-m rating] [-M rating] [-a rating] [-F] [-S]

A small program to query for games inside PGN documents

options:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  The PGN file to search through
  -i, --stdin           Read from STDIN
  -q QUERY, --query QUERY
                        The Python file containing the query to use
  -m rating, --minimum-rating rating
                        The minimum rating of games to consider
  -M rating, --maximum-rating rating
                        The maximum rating of games to consider
  -a rating, --average-rating rating
                        The rating range to consider
  -F, --fast            Only consider bullet games
  -S, --slow            Only consider blitz games and slower

Every month I look through some ten thousand games ~ Vladimir Kramnik

Metadata

Release files for pgn-filter 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgn-filter 0.1.7
File Size Uploaded Provenance Actions
pgn-filter-0.1.7.tar.gz 4.4 kB Without provenance Details for pgn-filter-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pgn-filter 0.1.7
File Interpreter ABI Platform Actions
pgn_filter-0.1.7-py3-none-any.whl Python 3 none any Details for pgn_filter-0.1.7-py3-none-any.whl

Total release size: 10.3 kB

Release files / pgn-filter-0.1.7.tar.gz

Download URL pgn-filter-0.1.7.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
725e84f0f123fc68049c53f620b6dce94afd84baf4da4c76d6ea8cfc3307ea8e
BLAKE2b-256 checksum
How to use checksums
3f7964d737879828cb3dd69064d7027b7522e32ea0ec52b36a6f1cc07cb74f87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / pgn_filter-0.1.7-py3-none-any.whl

Download URL pgn_filter-0.1.7-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c64dc5aaaf2834d3a42d5e8028dcba74c7ed427d0cfc96d1572671588f7ac8c7
BLAKE2b-256 checksum
How to use checksums
d96b92392b96baf63ad7af8b9fd87d527a902bd60da233654eed1426cb6c2a91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Security for pgn-filter 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page