threader-python
Python SDK for Threader — read football video annotation data and bridge notebook analysis back to the Threader desktop app.
Installation
pip install threader-python
Or with visualization extras:
pip install "threader-python[viz]"
Quick Start
Inside a Threader Notebook
When running inside Threader's built-in notebook, the connection is automatic:
import threader_python as tp
# Query data — returns pandas DataFrames
events = tp.events(type="pass")
players = tp.players()
teams = tp.teams()
# Filter passes between two players
pair = events[(events.player_id == "p1") & (events.receiver_id == "p2")]
# Send selection to Threader — Clips panel filters automatically
tp.select(pair)
# Or create a playlist directly
tp.playlist(pair, title="Messi → Alba passes")
Standalone (Jupyter Lab, VS Code, etc.)
Point to a .threader project file manually:
import threader_python as tp
tp.connect("/path/to/match.threader")
events = tp.events(type="shot")
print(events[["player_id", "x", "y", "is_successful"]])
Data access works fully in standalone mode. Bridge actions (select, play, playlist) print a summary instead of triggering UI interactions.
API Reference
Connection
| Function | Description |
|---|---|
tp.connect(path) |
Connect to a .threader project file |
tp.disconnect() |
Close the current connection |
tp.is_connected() |
Check connection status |
Data Access
All data functions return a pandas.DataFrame (except match() which returns a dict).
| Function | Description | Filters |
|---|---|---|
tp.events() |
Annotated events | type, sub_type, player_id, team_id, period, is_successful |
tp.players() |
Player roster | team_id |
tp.teams() |
Teams | — |
tp.clips() |
Video clips (includes linked event_ids) |
video_id |
tp.match() |
Match metadata (returns dict) |
— |
tp.videos() |
Video file info | — |
tp.whistle_sync() |
Whistle sync points | video_id |
Bridge Actions (Threader Integration)
These functions communicate with the Threader desktop app when running inside a Threader notebook:
| Function | Description |
|---|---|
tp.select(events_or_ids) |
Highlight events in Threader, filter Clips panel |
tp.play(clips_or_ids) |
Play clips in the video player |
tp.playlist(events_or_ids, title=...) |
Create a playlist from events |
All bridge functions accept either a DataFrame (with an id column) or a list of ID strings.
How It Works
- Data access: Reads directly from the
.threaderSQLite file (read-only, WAL-safe for concurrent access) - Bridge actions: Emit a custom MIME type (
application/x-threader+json) via IPython'sdisplay(), which the Threader app's notebook renderer picks up and dispatches to the UI
Development
# Clone and install
git clone https://github.com/rondo-labs/threader-python.git
cd threader-python
uv sync
# Run tests
uv run pytest
# Lint
uv run ruff check src/ tests/
License
MIT
Metadata
Release files for threader-python 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| threader_python-0.1.0.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| threader_python-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.6 kB
Release files / threader_python-0.1.0.tar.gz
| Download URL | threader_python-0.1.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aba931204ac7bf8d2b401e20faad822290530a0fee60967be5331460a95960b2
|
|
BLAKE2b-256 checksum How to use checksums |
d1fa331dbda920b0444e0b31511a0daa86ea8ca4980cd7398dd5c51777b1af65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / threader_python-0.1.0-py3-none-any.whl
| Download URL | threader_python-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5c10afbd3911148c1dcdcd838070ca85f77d728a68d8ab91f9b420b875a5d72
|
|
BLAKE2b-256 checksum How to use checksums |
163ce2caccb45a1decce74c8a732bd981f3ab1ee740ce9063fecbff06cb7b356
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|