Linearizer
Linearizer surfaces the Python functions you have touched in your current Git diff, linearises their surrounding call graph with a Python helper process, and makes it easy to inspect and navigate the results inside VS Code.
Features
- 🔍 Show changed Python functions – Runs
git diff against HEAD (including staged and unstaged edits) via a Python helper and lists every affected function.
- 🧭 Linearised call flows – Builds a static call graph across the repository and emits a depth-first execution ordering for each changed entry-point so you can reason about value flow.
- �️ Webview dashboard – Renders changed functions, warnings, and Python-produced call flows in a dedicated editor panel so you can stay in the main canvas.
- 🚀 Quick navigation – Presents a quick pick so you can jump directly to any changed function definition with a single selection.
- 🧪 Line inspector & peeks – Hover or click the inline variable marker on any traced line to see a compact popover, then pop out the collapsible inspector to pin values, copy them, or switch between compact/expanded/structured views.
Requirements
- Git must be available on your
PATH.
- Python 3.8+ must be available (the extension auto-detects
python3/python, or set linearizer.pythonPath).
- Run the command from a workspace that lives inside a Git repository.
- Only Python files (
*.py) are analysed today.
Usage
- Open a Python repository in VS Code.
- Make (or stage) some changes.
- Run Linearizer: Show Changed Python Functions from the Command Palette.
- The extension spawns the bundled
python/linearizer.py helper to analyse the repo.
- Review the interactive dashboard that opens in the main editor area; the webview lists changed functions, warnings, and linearised call flows while the quick pick still lets you jump straight to definitions.
Tip: Newly created Python files count as fully changed – every defined function appears in the results.
Flow-aware tracer (standalone)
The bundled python/tracer.py script can now linearise an execution flow incrementally:
- Cache every executed line (locals/globals included) under a flow name plus the argument payload, so later requests replay instantly without re-running code.
- Address locations via
function:line strings (e.g. collect_commit_history:16) instead of relying on raw file-relative line numbers.
- Return slices of the cumulative flow via the
events array in each response, making it easy to render entire histories on the UI side.
Quick start
python python/tracer.py \
--repo_root /path/to/linearizer \
--entry_full_id /python/sample_flow.py::analyze_git_repo \
--flow_name analyze_git_repo \
--args_json '{"args": [], "kwargs": {"branch": "demo"}}' \
--stop_location analyze_git_repo:8
You can keep the process alive and request deeper stops by piping JSON commands on stdin, for example:
{"location": "collect_commit_history:16"}
{"location": "acquire_git_stream:23"}
{"location": "build_git_log_command:28"}
0
Each response includes the latest line information plus the cumulative events array so you can reconstruct the whole flow without re-executing earlier steps. The helper python/sample_flow.py file mirrors the MiniGit example discussed in the design notes and can be used as a sandbox target.
Known limitations
- Pure deletions (functions removed without any remaining lines) are not yet reported.
- Static analysis cannot resolve every dynamic Python call; unmatched calls are still listed as raw IDs in the flow sequence.
- Parsing relies on standard
def/class indentation; highly unconventional formatting may be skipped.
- Non-Python files are ignored.
Development
npm install – install dependencies.
npm run compile – build the extension.
npm run watch – rebuild on file changes.
npm test – run the VS Code extension tests.
PRs and suggestions are welcome!