{"id":27892,"library":"keke","title":"keke","description":"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.","status":"active","version":"0.2.0","language":"python","source_language":"en","source_url":"https://github.com/keke-tracing/keke","tags":["profiling","tracing","chrome-devtools","performance"],"install":[{"cmd":"pip install keke","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"ktrace is a decorator/context manager that traces execution time.","symbol":"ktrace","correct":"from keke import ktrace"},{"note":"TraceConfig is used to configure trace output (e.g., auto-save).","symbol":"TraceConfig","correct":"from keke import TraceConfig"}],"quickstart":{"code":"from keke import ktrace, TraceConfig\nimport time\n\n# Basic usage: decorate function\n@ktrace\ndef my_function():\n    time.sleep(0.5)\n\nmy_function()\n\n# Context manager usage\nwith ktrace('my_block', args={'key': 'value'}):\n    time.sleep(0.3)\n\n# Auto-save configuration (optional)\nimport os\nTraceConfig(enabled=True, output_dir=os.environ.get('TRACE_DIR', './traces')).apply()","lang":"python","description":"Profiling with keke: wrap code with @ktrace or 'with ktrace()' to generate Chrome trace files. Configure auto-save with TraceConfig."},"warnings":[{"fix":"Update any custom trace format parsing to expect the new schema (see GitHub changelog).","message":"In 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.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Set `TraceConfig(enabled=True, output_dir='/path/to/traces')` at startup, or set environment variable `KEKE_OUTPUT_DIR`.","message":"By 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure args are basic types (str, int, list, dict) that can be json.dumps'd.","message":"Arguments passed to `ktrace` as `args` must be JSON-serializable. Non-serializable values will cause runtime errors.","severity":"gotcha","affected_versions":">=0.2.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Convert args to JSON-serializable types, e.g., `args={'id': myobj.id}`.","cause":"Passing non-JSON-serializable objects as `args` to ktrace.","error":"TypeError: Object of type YourObject is not JSON serializable"},{"fix":"Use `from keke import ktrace`. If using pre-0.2.0, ktrace was `keketrace`? Actually always use `from keke import ktrace`.","cause":"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.","error":"AttributeError: module 'keke' has no attribute 'ktrace'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}