Python SDK for Threader — football video annotation data access and bridge
Project description
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
Project details
Release history Release notifications | RSS feed
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 threader_python-0.1.0.tar.gz.
File metadata
- Download URL: threader_python-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aba931204ac7bf8d2b401e20faad822290530a0fee60967be5331460a95960b2
|
|
| MD5 |
c65e9f2f151089124be40acfcc22b3d9
|
|
| BLAKE2b-256 |
d1fa331dbda920b0444e0b31511a0daa86ea8ca4980cd7398dd5c51777b1af65
|
File details
Details for the file threader_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: threader_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5c10afbd3911148c1dcdcd838070ca85f77d728a68d8ab91f9b420b875a5d72
|
|
| MD5 |
5c3592da5bdc8e8226bdf1cffd33c416
|
|
| BLAKE2b-256 |
163ce2caccb45a1decce74c8a732bd981f3ab1ee740ce9063fecbff06cb7b356
|