skillfed

keke

Easy profiling in chrome trace format

keke v0.2.0 563.6K downloads/30d#5,978 on PyPI4
Permissive license MIT Active released

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 keke

uv

uv add keke

poetry

poetry add keke

Installing 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

chrome trace format profilingperfetto trace writerpython performance tracingtrace event outputlightweight profilerdistributed tracing support
profilingtracingperformance-analysis

More Monitoring packages