Utilities for MyLaps Event Results API.
Project description
speedhive-tools
CLI toolkit and Python library for the MyLaps Speedhive Event Results API.
Install
pip install speedhive-tools
For local development:
git clone https://github.com/ncrosty58/speedhive-tools.git
cd speedhive-tools
python -m venv .venv && source .venv/bin/activate
pip install -e .
Quick CLI Usage
# Export raw offline data dump
speedhive export-full-dump --org 30476 --output ./output
# Compile raw offline NDJSON dumps into local SQLite database
speedhive to-sqlite --org 30476 --dump-dir ./output
# Run offline analysis and records extraction (reads from SQLite database)
speedhive report-consistency --org 30476 --top 10
speedhive extract-driver-laps --org 30476 --driver "Firstname Lastname"
speedhive extract-track-records --org 30476
# Sync and update local organization cache files
speedhive refresh-org-cache --org 30476 --cache-root ./web_data/cache --mode incremental --recent-backfill-events 3
Run speedhive --help for the full command list.
Python Usage
from speedhive.wrapper import SpeedhiveClient
client = SpeedhiveClient.create(token="your-api-token")
events = client.get_events(org_id=30476, limit=5)
Offline Workflow
-
Export full raw data dump: Downloads events, sessions, results, laps, and announcements to local NDJSON files.
speedhive export-full-dump --org 30476 --output ./output
-
Compile raw dumps to SQLite database: Imports all NDJSON files under
./output/30476/into a structured SQLite database.speedhive to-sqlite --org 30476 --dump-dir ./output
-
Run offline analysis against the database:
speedhive report-consistency --org 30476 speedhive extract-driver-laps --org 30476 --driver "Firstname Lastname"
Output Format
export-full-dump creates raw cache snapshots in output/<org_id>/:
output/30476/
├── events.ndjson.gz
├── sessions.ndjson.gz
├── laps.ndjson.gz
├── announcements.ndjson.gz
├── results.ndjson.gz
└── .checkpoint.json
to-sqlite compiles those files into:
output/30476/
└── laps_30476.db
Project Structure
Canonical implementation lives in src/speedhive/:
src/speedhive/
├── client.py
├── wrapper.py
├── generated/ # Auto-generated API client bindings
├── cli/ # CLI entry point and dynamic discovery
│ ├── discovery.py
│ └── main.py
├── exporters/ # Scrapers and cache sync modules
│ ├── export_org_cache.py
│ ├── export_full_dump.py
│ └── ...
├── analyzers/ # Performance and lap analysis
│ ├── analyze_consistency.py
│ └── analyze_driver_laps.py
└── processing/ # SQLite ETL and track record compilation
├── process_sqlite_import.py
├── process_track_records.py
├── process_lap_analysis.py
└── ndjson.py
Notes
- SQLite Backend: All CSV storage workflows have been deprecated. Relational querying is fully powered by a local, indexed SQLite database file.
- Packaging is configured via
pyproject.toml(PEP 621 + setuptools backend). - The generated API client uses
attrs; no Pydantic dependency.
License
MIT © Nathan Crosty
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 speedhive_tools-0.4.0.tar.gz.
File metadata
- Download URL: speedhive_tools-0.4.0.tar.gz
- Upload date:
- Size: 80.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cffa39397f4eb9378e8448d0c7b1a7aea19e4a7cb903aa03452c7d9d3e491f1b
|
|
| MD5 |
68d3af6bdfea60fb251067024ce75ecc
|
|
| BLAKE2b-256 |
01cc952f9887263bdd177a88c40fcb694b21f84b354ce36cdadee2a63768091f
|
File details
Details for the file speedhive_tools-0.4.0-py3-none-any.whl.
File metadata
- Download URL: speedhive_tools-0.4.0-py3-none-any.whl
- Upload date:
- Size: 183.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dc9626ea231fca7cf611f14138452c8091a9efe16ddcfb891e4c5df28392ec7
|
|
| MD5 |
518a58cf297be001751911d472a8e1ab
|
|
| BLAKE2b-256 |
6de25fdcab239830683ee422d37b658159d3407d0e038cd256f44b1f7640fd6b
|