Skip to main content

pychanga - python-based sports database manager

Pychanga (pronounced as the Chilean Spanish word) is a light-weight sports database manager written in python, using polars and parquet files. It is the db manager in golessonamores.cl, a Chilean football stats website launched in 2018. This code started as a rewritten version of this website's original code (written in php). As a python package aims to provide support for different sports and its user target are sports stats aficionados with some basic python knowledge and access to data.

Install

install it with pip: py -m pip install pychanga

Data configuration

pychanga is now data-root driven. Your app must point pychanga to a folder that contains:

  • parquet/*.parquet for runtime queries
  • optionally csv/*.csv if you run conversion scripts

You can configure it in two ways:

  • Environment variable: PYCHANGA_DATA_DIR=/path/to/data_root
  • Runtime setup:
import pychanga as pc

pc.set_data_dir("/path/to/data_root")
comp = pc.Competition("CHI-1A")

If neither is configured, pychanga will try a local .dirs file (for backwards compatibility), and then a bundled sample dataset.

Build sample dataset

To generate a minimal sample dataset from your Golessonamores data:

python dev/build_sample_dataset.py \
	--source-data-dir /path/to/golessonamores/data \
	--target-data-dir sample \
	--comp-id CHI-1A \
	--edition-id CHI-1A-1994

This creates sample/parquet/*.parquet with only:

  • competition CHI-1A
  • edition CHI-1A-1994
  • teams that appear in those matches
  • related reference tables (sports, countries, stages, sources, etc.)

Features

  • It provides some classes to represent sports entities, such as: Competition, Edition, Team, Player, Match, Ground, Sport, among others.
  • It provides classes to ask some common queries, such as: HeadToHead, Streaks,
  • Each class provides methods to retrieve stats based on an id.
  • The queries are all written in polars' DSL (domain specific language)

Example

Documentation

Collaboration

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pychanga-0.1.2.tar.gz (63.3 kB view details)

Uploaded Source

Built Distribution

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

pychanga-0.1.2-py3-none-any.whl (72.4 kB view details)

Uploaded Python 3

File details

Details for the file pychanga-0.1.2.tar.gz.

File metadata

  • Download URL: pychanga-0.1.2.tar.gz
  • Upload date:
  • Size: 63.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pychanga-0.1.2.tar.gz
Algorithm Hash digest
SHA256 30400f7813f4537e26bd4ed6fc5f61781e25d69d1ba1d48faf984d4a40363a11
MD5 e09c5e513a32a10fd7ce0ddc4b62e5c8
BLAKE2b-256 620164fd1fffc52a88344ca9eb8ba3366f5807b4b2a1c7313aeacd5b096f82e0

See more details on using hashes here.

File details

Details for the file pychanga-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pychanga-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 72.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pychanga-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bd0a9ffb58021cbbd2a2df4267a67351402d2b87c45d89a734c8118905e9104d
MD5 3253e6cc6d85af8bfb29552cc75953bd
BLAKE2b-256 52ac34a764fbd43ea9a10a9255da4d1c9f79bb9d8bd55078d394a84ea8a59dc4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

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