WireLog analytics client — zero dependencies
Project description
wirelog
WireLog analytics client for Python. Zero dependencies — stdlib only.
Headless alternative to PostHog, Amplitude, and Mixpanel — designed for agents instead of dashboards.
Install
pip install wirelog
Quick Start
from wirelog import WireLog
wl = WireLog(api_key="sk_your_secret_key")
# Track an event (non-blocking, batched automatically)
wl.track("signup", user_id="u_123", event_properties={"plan": "free"})
# Query analytics (returns Markdown by default)
result = wl.query("signup | last 7d | count by day")
print(result)
# Identify a user (bind device → user, set profile)
wl.identify("alice@acme.org", device_id="dev_abc", user_properties={"plan": "pro"})
# Flush remaining events on shutdown
wl.close()
Design Principles
This client is designed to never break your application:
- Non-blocking by default:
track()buffers events and returns immediately - Automatic batching: Events are sent in batches (default 10 per batch, or every 2 seconds)
- Bounded memory: Queue capped at 10,000 events — oldest events are dropped when full
- Retry with backoff: Transient failures (429, 5xx) are retried up to 3 times
- Graceful shutdown:
close()flushes remaining events; also works as a context manager - Background thread: Flush worker is a daemon thread — won't block process exit
Context Manager
with WireLog(api_key="sk_...") as wl:
wl.track("signup", user_id="u_123")
# Events are flushed automatically on exit
Configuration
wl = WireLog(
api_key="sk_...", # Falls back to WIRELOG_API_KEY env var
host="https://api.wirelog.ai", # Falls back to WIRELOG_HOST env var
timeout=30, # HTTP timeout in seconds
flush_interval=2.0, # Seconds between auto-flushes (0 = sync mode)
batch_size=10, # Max events per batch
queue_size=10000, # Max buffered events
on_error=lambda e: print(e), # Background error callback
disabled=False, # True = track() is a no-op
)
Synchronous Mode
Set flush_interval=0 to send each track() call immediately (blocking):
wl = WireLog(api_key="sk_...", flush_interval=0)
result = wl.track("signup", user_id="u_123") # blocks, returns {"accepted": 1}
API
wl.track(event_type, *, user_id, device_id, session_id, event_properties, user_properties, insert_id, origin, client_originated)
Track a single event. Auto-generates insert_id and time if not provided.
wl.track_batch(events, *, origin=None, client_originated=None)
Track multiple events in one request (up to 2000). Always sends immediately.
wl.query(q, *, format="llm", limit=100, offset=0)
Run a pipe DSL query. Format: "llm" (Markdown), "json", or "csv".
wl.identify(user_id, *, device_id, user_properties, user_property_ops)
Bind a device to a user and/or update profile properties.
wl.flush()
Flush all buffered events. Blocks until the queue is drained.
wl.close()
Flush remaining events and stop the background thread. Idempotent.
Zero Dependencies
This library uses only the Python standard library (urllib.request, json, threading, queue, time, uuid, os). No requests, no httpx, no urllib3. It works out of the box on any Python 3.9+ installation.
Learn More
- WireLog — headless analytics for agents and LLMs
- Why WireLog vs PostHog/Amplitude — comparison guide
- Query language docs
- API reference
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 wirelog-0.3.0.tar.gz.
File metadata
- Download URL: wirelog-0.3.0.tar.gz
- Upload date:
- Size: 49.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96c726b5b41c5ec1f9490cc43b9c6ab8a7c8ae92f7be35f1f80f6d4875296f3a
|
|
| MD5 |
aece90ab911fb0afb67d7446dcf895df
|
|
| BLAKE2b-256 |
ac622cabfa5389476bcc0f93add7d4a9332ce239b41130a3c4bec347f7068f92
|
File details
Details for the file wirelog-0.3.0-py3-none-any.whl.
File metadata
- Download URL: wirelog-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77cf066bdf05a533d236327214047816d1c27f15b4115924fea90c6ce3d6df69
|
|
| MD5 |
92bce4e9b60fe70558fac400cde9098e
|
|
| BLAKE2b-256 |
7a0a08b714b3a9142fd69b61d7ee52d5a8f29f8dfe8aebbb9bd9e7aa6a8cd2e5
|