Skip to main content

chartedcode

Diagrams for Python projects: class, call and control-flow diagrams, drawn as self-contained HTML by a small, deterministic Rust program.

Point it at a file or a directory. It reads the source (it never runs it), works out how the code fits together, and writes one HTML file per diagram. Each file holds its data, the layout engine and the viewer, so it opens in any browser, works offline, and needs no Graphviz or other renderer installed.

$ chartedcode classes src/        # class diagram
$ chartedcode calls src/          # call graph
$ chartedcode flow src/           # control-flow graph of each function
wrote src-flow.chartedcode.html
$ chartedcode all src/ -o out/    # all of them, plus the analysis as JSON and a manifest

Install

$ pip install chartedcode        # or: uvx chartedcode calls src/

The wheel carries the compiled program; there is nothing else to install. Python 3.11 or later.

The diagrams

Every relationship says how it was found, and anything the tool could not follow is counted and listed, not guessed at or silently dropped.

classes

Inheritance, Protocol conformance and field types.

  • inherits: a base class, resolved through imports (including relative imports, re-exports through __init__.py, star imports and TYPE_CHECKING imports).
  • implements: a class has every method name of a Protocol. This compares names only, not signatures, so it is shown as weak evidence.
  • has-a: a field whose annotation names a class of the project (class-body annotations, and self.x assigned from an annotated parameter in __init__).

calls

Which function calls which, and in what order.

  • calls and constructs (Foo() goes to Foo.__init__, or to an implicit constructor when the class defines none).
  • passes: a function or method handed to another function as a callback (runner.run("train", self._trainer.fit)), which is assumed to be called.
  • dispatches: a call to a Protocol method may run any implementer's method of that name.
  • Call order: each call is numbered within its caller, in evaluation order (a call's arguments before the call). Numbers appear on the arrows, in a panel listing the focused function's calls, and in an execution flow view that chains the calls in order and enters each callee's own calls. Recursion is marked, not drawn, so the execution flow is always acyclic.
  • Acyclic view: functions that call each other in a cycle are collapsed into one node. When there are no cycles the page says it is identical to the call graph.
  • Views at function, class or module granularity; focus on one node with its callers and callees to a chosen depth.

The colour of an edge says how sure the tool is: resolved by name, import, self or super; inferred from a declared type; method names only; external.

flow

The control-flow graph of each function (and of a module's top-level code): basic blocks with their source lines, edges labelled with when they are taken (true, false, next item, loop, break, exception, return, ...), unreachable code marked, and a complexity number (decision points plus one). The calls in each block carry the same step numbers as the call graph, and a call that has a flow of its own can be opened with two clicks.

Approximations, so the diagram can be read correctly: any statement in a try body may raise (one exception edge from the body to each handler), context managers do not branch, and boolean operators, conditional expressions and comprehensions do not split a block.

Every diagram at once, for CI

$ chartedcode all src/ -o out/
wrote 4 files and manifest.json to out/

out/ holds classes.html, calls.html, flow.html, analysis.json and manifest.json. The names are fixed, so whatever collects them does not need to know the project. The manifest lists each file with its size and SHA-256, the tool and schema versions, and some totals (files analysed, classes, functions, call edges, untraced calls, the highest complexity); it has no timestamps, so the same input gives a byte-identical directory. analysis.json is the complete analysis, including control flow, whatever --min-complexity does to the flow page.

Embedding the pages

Each page is one file with no external requests, no cookies and no browser storage, and it renders inside <iframe sandbox="allow-scripts">. A host chooses how a page opens through the URL fragment (page.html#embed=1&theme=dark). A page reads embed and theme again if the fragment changes after load; the other options are read once, when the page opens. There is no other way to drive a page from outside.

Option Pages Effect
embed=1 all hide the header and legend, so the diagram fills the frame (the status line and, in the call graph, the order-of-calls panel stay)
theme=light or theme=dark all use these colours whatever the system setting is
kinds=inherits,implements,composes classes which relationships are shown at first
view=graph|exec|acyclic, gran=function|class|module calls the view and its granularity
focus=<function id>, depth=N calls the function to focus on and how far to follow its calls
ext=1, untraced=1, private=1, mincalls=N, dir=down calls external calls, untraced-call counts, private names, the focus-list filter, the layout direction
function=<function id> flow the function to show
minc=N, private=1, dir=right flow the complexity filter for the function list, private names, the layout direction

Function ids are the id fields of functions in analysis.json, such as pkg/app::Service.run.

What it does not follow

Static analysis of a dynamic language has limits. The tool does not infer return types, so a call on a variable whose type is not declared (model.evaluate() where model is whatever a function returned) is untraced: counted per function, listed in the page, never drawn as an edge. It also does not follow dispatch through subclass overrides (only Protocols dispatch), property access that runs code, decorators, getattr and other dynamic calls, function-local imports or __all__. Branches and loops are flattened in the call numbering: a number means "the order written", not a guaranteed run order.

Options

Option Effect
-o, --output FILE where to write the result; by default <name>-<view>.chartedcode.html in the current directory, or standard output for JSON
--format html|json the page, or the analysis as JSON (schema_version 1; always includes private names)
--include-private start with private names (a single leading underscore) shown; the page hides them by default
--no-gitignore also analyse files matched by .gitignore (by default they and hidden directories are skipped; the global ignore file is never read, so a checkout gives the same result everywhere)
--no-source flow only: leave source text out of the diagram, so blocks show only line numbers
--min-complexity N flow only: only draw functions of at least this complexity

The same input always gives byte-identical output.

A flow page contains the source text of your functions. Use --no-source before sharing one if that matters.

From Python

$ python -m chartedcode calls src/
$ chartedcode-py calls src/            # always inside this process
$ CHARTEDCODE_INPROC=1 python -m chartedcode calls src/

python -m chartedcode starts the executable that came with the package. For environments where the interpreter may run code but no other program may be started, chartedcode-py (or CHARTEDCODE_INPROC=1) runs the same program inside the interpreter, through an extension module; the output is identical. chartedcode._binary.run_binary(["calls", "src/", "--format", "json"], capture=True) runs it from code.

Development

$ uv sync
$ uv run inv build          # build the executable and the extension, and install them
$ uv run inv all            # format, lint, test (Rust and Python), verify licences
  • uv run inv test builds first. Run bare pytest as uv run --no-sync pytest after uv run inv build: a plain uv run re-syncs the project and can put an older cached build over the one just installed. The test session refuses to run against an executable older than the Rust sources.
  • The browser tests drive a headless Chrome and are skipped when none is found (set CHROME to its path).
  • Build wheels from the working tree after staging the extension (uv run inv build does that), with maturin build --profile cli. uv build builds the wheel from the source distribution, which does not contain the compiled extension.

Licence

MIT (see LICENSE). Every page embeds elkjs 0.11.0, unmodified, which is licensed under the Eclipse Public License 2.0; see NOTICE and rust/assets/elkjs-LICENSE.md.

Metadata

Release files for chartedcode 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chartedcode 0.1.0
File Size Uploaded Provenance Actions
chartedcode-0.1.0.tar.gz 567.3 kB With provenance Details for chartedcode-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for chartedcode 0.1.0
File Actions
chartedcode-0.1.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for chartedcode-0.1.0-py3-none-win_amd64.whl
chartedcode-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for chartedcode-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
chartedcode-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for chartedcode-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
chartedcode-0.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for chartedcode-0.1.0-py3-none-macosx_11_0_arm64.whl
chartedcode-0.1.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for chartedcode-0.1.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 21.2 MB

Release files / chartedcode-0.1.0.tar.gz

Download URL chartedcode-0.1.0.tar.gz
Size 567.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4c2beefe40283d4fd4c6ef21c009b4d902824cdecc2490655a0120b6eb7c8472
BLAKE2b-256 checksum
How to use checksums
cad684f14cd33085a9b615c6f274d528e49bdce9569752a8e5d1f4057e126726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / chartedcode-0.1.0-py3-none-win_amd64.whl

Download URL chartedcode-0.1.0-py3-none-win_amd64.whl
Size 4.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
6e2b8e8ac33ae12ca5221cd93514206a0901759ab61ddad91eaa68b8ec777792
BLAKE2b-256 checksum
How to use checksums
e4bd924bdddf186f6037752dcc6fbb35428c05de2c84b9159557483373ddc021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / chartedcode-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL chartedcode-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 4.3 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
8183d373c291c902d3881c2751ec61c68fdfeb1c1b71990c8e5e520c303988a6
BLAKE2b-256 checksum
How to use checksums
8b7b5fae25b74becc3a545d4a5b4143e1da5d1fbd56b605a1586b98ee696eee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / chartedcode-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL chartedcode-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 4.1 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
4ab92ffe8dc9910e34af7f4c54a5e0b2b180756a4335a2d499c7183132533722
BLAKE2b-256 checksum
How to use checksums
f5d7209c9bfcbab4685d3a99ac17adca217b6a951f20d178893a61325c92a0d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / chartedcode-0.1.0-py3-none-macosx_11_0_arm64.whl

Download URL chartedcode-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 4.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b15355be9cfe7d8a0846fb6f9b91037f08fb7a4a06f0fd1b8f816b8d064c22d5
BLAKE2b-256 checksum
How to use checksums
77572bbdf7e5f4ca22e429e6a0741bbab3b5767fa58396547f27a43a1cd340a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / chartedcode-0.1.0-py3-none-macosx_10_12_x86_64.whl

Download URL chartedcode-0.1.0-py3-none-macosx_10_12_x86_64.whl
Size 4.2 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8ad511d6ae3a6ded8c8abca8b64f480862e954e1d4f89cf1748a46e3eaf39d4a
BLAKE2b-256 checksum
How to use checksums
fd576deccfdcad31445f530dfe84f203ddc17ec44d706e8368e4a89af5879131
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for chartedcode 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for chartedcode-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page