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/*.parquetfor runtime queries- optionally
csv/*.csvif 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pychanga-0.1.1.tar.gz.
File metadata
- Download URL: pychanga-0.1.1.tar.gz
- Upload date:
- Size: 62.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f507c82d79bc82a4f30b5b8d18a873aa39bb0b075b6e96d704e995aa6e02b0c
|
|
| MD5 |
7e52a8fbe878de9afd939bbb9726302f
|
|
| BLAKE2b-256 |
f84b7d06d9a353baf8afd0ccff2ad666743e7e2a1db6b7b37f056d49f85bcc39
|
File details
Details for the file pychanga-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pychanga-0.1.1-py3-none-any.whl
- Upload date:
- Size: 71.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e39ef289acc8de8a6840d81ae3051154f1b6e099304e86495247c6c7a57d607e
|
|
| MD5 |
bd8529c90a82575657ce3f65a4d99fe1
|
|
| BLAKE2b-256 |
d5d1bdac4a1e877f0826acc451b63e0da6d096e708f0c744eae2407d6d8e7e0c
|