Skip to main content

A small program to query for games inside PGN documents

Project description

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

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-filter-0.1.7.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

pgn_filter-0.1.7-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pgn-filter-0.1.7.tar.gz.

File metadata

  • Download URL: pgn-filter-0.1.7.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pgn-filter-0.1.7.tar.gz
Algorithm Hash digest
SHA256 725e84f0f123fc68049c53f620b6dce94afd84baf4da4c76d6ea8cfc3307ea8e
MD5 2027a69082b22123cdbbc578f8bf6a27
BLAKE2b-256 3f7964d737879828cb3dd69064d7027b7522e32ea0ec52b36a6f1cc07cb74f87

See more details on using hashes here.

File details

Details for the file pgn_filter-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pgn_filter-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for pgn_filter-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c64dc5aaaf2834d3a42d5e8028dcba74c7ed427d0cfc96d1572671588f7ac8c7
MD5 f75d54adc9134a77c791c440b30f40b4
BLAKE2b-256 d96b92392b96baf63ad7af8b9fd87d527a902bd60da233654eed1426cb6c2a91

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