Code View is a local, read-only code-flow canvas for understanding Python repositories. Point it at a repository and see how files, classes, functions, variables, imports, calls, inheritance, reads, writes, decorators, type use, API calls, source locations, and local Git changes connect.
Everything runs on your Mac. Static analysis parses Python source without importing or executing the repository.
Quick start · Usage guide · Technical details · AI-agent setup
On a Mac with an internet connection, install Code View with one command:
curl -fsSL https://raw.githubusercontent.com/Rkj0123/code-view/main/install.sh | bashThe installer checks for Homebrew, CMake, Ninja, Qt HttpServer, Node.js, npm,
Python 3.10+, and Git. It installs missing tools and builds the app before reporting
success. It keeps the app under
~/.local/share/code-view, and adds the code-view command to Homebrew's bin
directory. If that directory is not on PATH, the installer prints the one
line to add.
After installation, move into any Python repository and run:
cd /absolute/path/to/your/python-repository
code-viewCode View scans the current directory, starts the local host, and opens the
tokenized localhost URL in your default browser. Press Ctrl-C in that same
terminal to stop it. For a reviewable manual install, see
Install Code View.
Selected flow keeps the symbol you are studying in the middle and makes each connection easy to follow.
| Need | Use Code View |
|---|---|
| Find who uses a symbol | Select it and inspect inbound consumers. |
| Understand dependencies | Read the outbound column and follow its arrows. |
| See the whole project | Open Repository, then choose All connections. |
| Inspect exact evidence | Open a relationship or source occurrence in the Inspector. |
| Make a dense graph readable | Collapse boundaries, filter categories, or choose Selected flow. |
| Review local changes | Compare WORKTREE with a local branch or commit. |
| Run a repository command | Opt in explicitly; execution is disabled by default and requires three guards. |
The current release supports macOS and Python repositories. Install Homebrew, then install CMake 3.21+, Ninja, Qt 6.8+ with Core/Network/HttpServer, Node.js, npm, and Python 3.10+:
If brew --version fails, install Homebrew with its official installer, follow
the PATH instruction it prints, and open a new Terminal window:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"brew install cmake ninja qthttpserver node pythonIf a package is already installed, Homebrew reports that it is current.
The screenshots in this repository use Git LFS. Install it if your clone shows an image pointer instead of an image:
brew install git-lfs
git lfs installFollow these steps from a terminal. The bundled launcher builds the browser canvas and local host for you.
cd /absolute/path/to/code-viewUse the directory containing script/code-view.sh, services/, and tests/.
cmake --version
ninja --version
node --version
npm --version
python3 --version./script/code-view.sh "$PWD/tests/fixtures/tic-tac-toe"The first run installs locked web dependencies, builds the canvas, configures and builds the local host, indexes the fixture, and starts the server. Later runs reuse build outputs.
The host prints one compact JSON startup record. Copy the complete url value,
including ?token=..., into a browser on the same Mac:
http://127.0.0.1:53211/?token=YOUR_SESSION_TOKEN
The token bootstraps that tab. Code View retains it in tab-scoped storage and removes it from the visible address bar.
- Leave
Repositoryselected for the complete indexed graph. - Select
Entry Focusfor the statically reachable entry flow. - Search for
Game.play. - Choose
Selected flowto place callers left, the selected symbol in the middle, and dependencies right. - Select an arrow or use
Traceto inspect its relationship and source range.
Repository view keeps the full filtered graph available. Pan and zoom when a large repository extends beyond the viewport.
Press Ctrl-C in the terminal, then run:
./script/code-view.sh /absolute/path/to/your/python-repositoryCopy the new tokenized URL into the browser. Indexing does not run your application.
Return to the host terminal and press Ctrl-C. The host shuts down its owned
workers before exiting.
Repositoryopens by default and shows every indexed node and relationship in the current filters.Entry Focusshows the complete statically reachable flow from the detected or configured entry, including imported-module and package initialization.All connectionsrestores every relationship in the filtered graph.Selected flowcreates a readable caller/selection/dependency view.Tracereaches every filtered relationship, including those outside the focused flow.- The Inspector shows qualified names, source, occurrences, boundary reasons, and Git evidence.
- Search reveals the exact indexed entity, opening collapsed ancestors and adjusting scope or filters when needed. File labels show relative paths; module labels show qualified names. Inspector owner and member links navigate the hierarchy.
- The filter button controls node kinds, relationship kinds, tests, and changed only mode.
Fitshows an overview;Resetrestores the viewport.- JSON and PNG export use the current visible scope.
- The sun/moon button switches and remembers light/dark mode locally.
The Inspector keeps the selected symbol's exact source and relationship evidence beside the canvas.
Filters change what is visible without changing the canonical graph.
- tests excluded
- package and module boundaries hidden
- external packages collapsed
- every canonical relationship enabled except
test_covers - source viewing enabled
- command execution disabled
- system light/dark preference used on first launch
Change these choices in the filter panel or in code-view.json.
Create code-view.json in the repository root. The smallest useful file is:
{
"schemaVersion": 1,
"entry": "main.py"
}The full strict schema is in
contracts/code-view-config-v1.schema.json.
An explicit entry wins over an accepted startCommand entry hint and over
automatic detection. index.tests: "include" enables test files;
index.modules: "show" reveals module/package boundaries. Unknown keys are
rejected.
Commands are documentation-only by default. Running one requires:
- an object command with
"mode": "manual"in the config; - the host started with
--allow-command; and - approval of the exact argv, working directory, and graph generation in the UI.
./script/code-view.sh /absolute/path/to/repository --allow-commandCode View passes the approved argument array directly to a child process and never invokes a shell. Approval is single-use and is invalidated by reindexing or a failed index. The process is not sandboxed. See Optional command execution.
brew: command not found: install Homebrew, reopen the terminal, and rerun the prerequisite command.- CMake cannot find Qt: confirm
qthttpserveris installed and follow the manual build in the usage guide. - Readiness page: use the URL printed by the host and include its token.
- Entry Focus disabled: add an
entryor useRepository. - Refresh failed: fix the reported source/config error and press Refresh; the last successful graph remains usable.
- Missing relationship: check filters and whether the target is external or unresolved.
- Usage guide: complete first-run and day-to-day instructions.
- Technical details: architecture, contracts, lifecycle, security, API routes, limits, and development.
- AI-agent setup prompt: a copy-paste macOS setup prompt.
- Documentation verification log: evidence for the commands, links, screenshots, and walkthroughs.
Python is the first supported analyzer. The graph contract is language-neutral, so Java and Go producers can be added later without changing the host or canvas. Dynamic Python behavior that cannot be named safely remains an explicit external or unresolved boundary. The initial performance target is 10,000 Python source lines. It is a benchmark target, not a size rejection limit.
./script/code-view-gate.sh
./script/code-view-eval.shSee the technical details for individual commands.
Code View is free and open source under GNU GPL version 3. You may use, study, modify, and redistribute it, including commercially, under that license. Distributed derivative works must preserve its license obligations.
This project builds on Sourcetrail by Coati Software and its contributors. Inherited copyright notices and third-party licenses remain in force. The Sourcetrail trademark is not included in the software license. See licensing scope and contributing.



