Skip to main content

Local JSONL logging and git snapshotting for Weave traces

Project description

weavecode

Local JSONL logging and terminal UI for Weights & Biases Weave traces — with git snapshotting so you can replay exactly what code ran at each trace.

Install

pip install weavecode

Usage

import weave
import weavecode

# 1. Init weave as normal, then wrap with weavecode
client = weave.init("my-project")
weavecode.init(client, git_path="/path/to/your/repo")

# 2. Decorate functions you want to trace
@weave.op
def my_function(prompt: str) -> str:
    ...

# 3. Run your code
my_function("hello")

Every call is logged locally to ~/.cache/codeweave/<project>/ as a JSONL file, with a git snapshot of your repo at the time of the run.

View traces

weavecode
# or pass a project name directly:
weavecode my-project

This opens a terminal UI with:

  • Runs list — all logged runs for the selected project, with 📸 if a git snapshot exists
  • Call tree — the full trace tree for the selected run
  • Source viewer — the exact source code at snapshot time, with the traced function and callsite highlighted
  • Detail panel — inputs, outputs, errors, git info, and a clickable W&B link

Keybindings

Key Action
p Pick project (modal list)
r Back to runs list
1 / 2 Focus runs / calls panel
c Copy trace to clipboard
o Open trace in W&B browser
j Jump to callsite in VS Code
q Quit

Git snapshotting

When you pass git_path, weavecode commits a snapshot of your repo at the start of each run (stashing any dirty changes first). The snapshot SHA is stored in each log entry. The source viewer uses git show <sha>:<file> to display the code — it never modifies your working tree.

Requirements

  • Python >= 3.8
  • textual >= 0.50.0
  • weave (Weights & Biases)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weavecode-1.0.5.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weavecode-1.0.5-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file weavecode-1.0.5.tar.gz.

File metadata

  • Download URL: weavecode-1.0.5.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for weavecode-1.0.5.tar.gz
Algorithm Hash digest
SHA256 65e92ddd953a385732c75bc262ed076efc03e0b7557ee96fbf6fba931614d75e
MD5 41458c7405295b347580097e76ded9a0
BLAKE2b-256 74e90509bab30a1c541ed21d8dc5f669456b9f0f025e9dd5f1ae11be66a5ca61

See more details on using hashes here.

File details

Details for the file weavecode-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: weavecode-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for weavecode-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 644e629a5b9af60b4d94c16de43a6b9fb9352bcf26160c8798d33a5ac50f904b
MD5 27586ef996968a3da8deb32a2831ea55
BLAKE2b-256 577c777a684efb7c79865c334edb01de5f1b3f3c609f975f84440565d280044d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page