keke
Easy profiling in chrome trace format
What it is and what it does
keke is a minimal trace-event writer that outputs performance profiling data in the Perfetto/Chrome trace format, readable in Chrome's about:tracing or Perfetto UI. It wraps code sections with context managers that record timing and metadata, then writes the results to a JSON file compatible with both tools.
The library is designed to be small enough to vendor into other projects and has near-zero overhead when disabled (by passing file=None). It supports basic distributed tracing through manual process coordination—you manage unique identifiers and file names across child processes, then merge traces afterward. It depends only on psutil and is licensed under MIT, making it suitable for inclusion in other projects.
Use it for:
- Profile Python application performance and visualize execution timelines in Chrome DevTools
- Add lightweight tracing to CLI tools or services without heavy profiling overhead
- Coordinate multi-process tracing by passing trace file paths or identifiers to child processes
- Vendor into a project as a fallback profiling option without adding significant dependencies
- Identify performance bottlenecks in specific code sections with named trace spans
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Writes trace events in Perfetto/Chrome trace format for performance profiling, with minimal overhead and optional output.
Yes, if you need lightweight Chrome trace format output for profiling. The low install friction, permissive MIT license, active maintenance, and minimal dependencies make it practical for inclusion in projects. Not suitable if you need line-level profiling (consider viztracer instead) or distributed tracing out of the box.
Install
keke on PyPI
pip
pip install kekeuv
uv add kekepoetry
poetry add kekeInstalling keke
Before you install
Low install friction with a single runtime dependency (psutil). Active maintenance with recent releases; last commit 2026-04-07.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for vendoring into other projects.
Quickstart
pip install keke
import keke
from keke import kev
with keke.TraceOutput(file=open('trace.json', 'w')):
with kev('task_name', __name__):
# code to profile
pass
Requires Python 3.8 or later; development and linting tested on 3.10-3.12.
Verify before relying
- Whether psutil is required at runtime or only for optional features
- Exact performance overhead when tracing is enabled vs. disabled
- Compatibility with Python 3.7 despite requires_python>=3.8 claim in description
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — psutil |
| Maintenance | actively maintained — 543 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 563,620/month — #5,978 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: keke-0.2.0-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
barectfbarectf generates ANSI C tracers that output…
permissive · top 15,000 on PyPI
perfettoPerfetto is a Python binding for Perfetto's…
permissive · top 5,000 on PyPI
viztracerVizTracer traces Python code execution and…
permissive · top 5,000 on PyPI
yappiYappi is a deterministic profiler for Python…
permissive · top 5,000 on PyPI
nvidia-nvtxProvides a Python API for annotating events and…
unclear · top 1,000 on PyPI
tunatuna visualizes Python performance profiles in…
copyleft · top 15,000 on PyPI
jaeger-clientJaeger-client instruments Python applications…
permissive · top 15,000 on PyPI
pyleakDetects leaked asyncio tasks, threads, and…
unclear · top 15,000 on PyPI
py-spypy-spy is a sampling profiler that attaches to…
permissive · top 1,000 on PyPI
segyioSegyio reads and writes SEG-Y formatted seismic…
copyleft · top 15,000 on PyPI