Registry / observability / keke
library0.2.0pypypi✓ verified 85d ago

A lightweight Python library for easy profiling in Chrome trace format (about: tracing). Version 0.2.0 supports sync/async, generators, automatic trace saving, and stats threads. Maintenance-oriented, with occasional updates.

pip install keke
INSTALL
IMPORT
SIG · KEKE
K
keke
observabilitypythonv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ktrace
from keke import ktrace
ktrace is a decorator/context manager that traces execution time.
TraceConfig
from keke import TraceConfig
TraceConfig is used to configure trace output (e.g., auto-save).

Profiling with keke: wrap code with @ktrace or 'with ktrace()' to generate Chrome trace files. Configure auto-save with TraceConfig.

from keke import ktrace, TraceConfig import time # Basic usage: decorate function @ktrace def my_function(): time.sleep(0.5) my_function() # Context manager usage with ktrace('my_block', args={'key': 'value'}): time.sleep(0.3) # Auto-save configuration (optional) import os TraceConfig(enabled=True, output_dir=os.environ.get('TRACE_DIR', './traces')).apply()
Debug
Known issues
breakingIn v0.2.0, `ktrace` now supports async functions and generators, but the internal trace format changed. Old trace analysis scripts may break if they relied on specific internal attribute names.
fix
Update any custom trace format parsing to expect the new schema (see GitHub changelog).
affects: >=0.2.0
gotchaBy default, keke does NOT save trace files unless `TraceConfig` is configured with `output_dir`. Users often expect traces to appear automatically, but they won't.
fix
Set `TraceConfig(enabled=True, output_dir='/path/to/traces')` at startup, or set environment variable `KEKE_OUTPUT_DIR`.
affects: all
gotchaArguments passed to `ktrace` as `args` must be JSON-serializable. Non-serializable values will cause runtime errors.
fix
Ensure args are basic types (str, int, list, dict) that can be json.dumps'd.
affects: >=0.2.0
Errors
Common errors & fixes
TypeError: Object of type YourObject is not JSON serializable
Passing non-JSON-serializable objects as `args` to ktrace.
fix
Convert args to JSON-serializable types, e.g., `args={'id': myobj.id}`.
AttributeError: module 'keke' has no attribute 'ktrace'
Incorrect import: using `import keke` and then `keke.ktrace` may fail if the module top-level doesn't expose it (but it does in recent versions). Alternatively, using an older keke version (<0.2.0) where ktrace was named differently.
fix
Use `from keke import ktrace`. If using pre-0.2.0, ktrace was `keketrace`? Actually always use `from keke import ktrace`.
Upgrade
Version history
0.2.0latest on PyPI · released Feb 17, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
16
OpenAI (training)
1
Resources
keke — pip install keke · libregistry