naja-schematic (Python package)
Interactive schematic viewer for najaeda netlists: the naja-schematic WASM viewer, packaged with the Python backend that answers it from a live najaeda netlist.
pip install naja-schematic
Mouse and keyboard controls are listed in the main README and in the viewer under Help > Keyboard Shortcuts.
In a notebook (Jupyter, Google Colab, VSCode)
Try it in Colab: a walkthrough of every widget feature below, runnable as is. Then a real design: a RISC-V core.
from najaeda import netlist
import naja_schematic
netlist.load_primitives("xilinx")
top = netlist.load_gate_level_verilog("design.v")
naja_schematic.show() # interactive view in the cell output
The view is answered from the netlist in the running kernel, so it shows
the design as the notebook has built or edited it so far; call show()
again after an edit for a fresh view. Diagnoses (e.g. from a formal
equivalence check) can be overlaid:
view = naja_schematic.show()
view.annotate([{"kind": "instance", "path": ["u_sub"], "severity": "error",
"message": "not equivalent", "source": "kepler-formal"}])
view
Nets, instances and pins can also be styled -- a color and width for a
net's wires, a fill for a box, labels -- kept across reloads and in SVG
exports. A "net" item colors the whole net through the pin it names;
"target" takes anything show_instance()/show_net() take, and also
the text forms of naja-schematic render's --instance/--net
("u1/u2", "drv_0:O", "en" for a top-level port):
view.style([
{"kind": "net", "target": ([], "en"), "color": "#ff7f0e", "width": 3, "label": "en"},
{"kind": "net", "target": "drv_0:O", "color": "#1f77b4"},
{"kind": "instance", "target": ["s0"], "fill": "#1f77b455"}, # a tint
])
Diagnosis colors win over styles, and styles over trace colors.
The same items, in a JSON file, are what --style FILE reads (on
naja-schematic and naja-schematic render). JSON has no tuples: a pin
there is text, a list [instance, terminal] / [instance, terminal, bit] ([] = a top-level port), or {"path": [...], "terminal": ..., "bit": ...}:
{"items": [
{"kind": "net", "target": [[], "en"], "color": "#ff7f0e", "width": 3, "label": "en"},
{"kind": "net", "target": "drv_0:O", "color": "#1f77b4", "width": 2.5},
{"kind": "net", "target": [["u_core", "u_alu"], "A", 3], "color": "#2ca02c"},
{"kind": "instance", "target": "u_core/u_alu", "fill": "#2ca02c55", "label": "ALU"},
{"kind": "term", "path": ["s0"], "terminal": "CE", "color": "#d62728"}
]}
kind is "net", "instance" (the default) or "term". Instead of
target, an item can give path (instance names, [] = the top) or
id_path (instance ids), plus terminal/term_id and bit for a pin.
The style fields are color ("#rrggbb"/"#rrggbbaa"), width,
fill and label. Text is matched against the design. Text that names
nothing, or more than one object, is an error. So is any item that
doesn't resolve, and then nothing is drawn. See Style
files for details.
The view and your najaeda code can point each other at instances.
show_instance() takes a najaeda Instance or a naja SNLPath, a list
of instance ids (as Instance.pathIDs) or a list of instance names (a plain string is one
name, never split on /, since escaped names can contain it). Anonymous
instances have no name to go by: reach them with an Instance or ids. The viewer opens its tree down to that instance, selects it, and
draws it alone in the schematic. Each pin there is open, so you can click
one to add its net and grow the schematic from the instance. In the other
direction, the instance selected in the viewer (click it in the tree or the
schematic) is available as a naja SNLPath (najaeda's raw API), and its
ids, which give the najaeda Instance, as selected_id_path:
view.show_instance(netlist.get_instance_by_path(["u_sub", "u_and"]))
view.show_instance(["u_sub", "u_and"]) # same thing
view.show_net(netlist.get_instance_by_path(["u_sub", "u_and"]).get_term("O"),
color="#ff8800") # its net, as a colored trace
view.show_net((["u_sub"], "y")) # (instance, terminal[, bit]) works too
path = view.selected # what the user clicked (an SNLPath), or None
path.getModel().getName()
inst = netlist.Instance(view.selected_id_path)
view.on_select(lambda path: print("selected", path))
naja_schematic.show(inst) (or show(["u_sub", "u_and"])) starts a new
view on it. After editing or reloading the design in later cells,
view.design_changed() refreshes an existing view in place.
From a shell
naja-schematic --verilog design.v --liberty cells.lib --open
naja-schematic --sv top.sv --top top --diagnosis report.json --open
serves the viewer page and its WebSocket on http://localhost:8081/ and
opens it in a browser. --stdio speaks the same protocol as JSON lines on
stdin/stdout instead, for a host (e.g. an editor extension) that relays
messages itself. naja-schematic --help lists every option.
--py-primitives prims.py (repeatable) loads primitives defined in
Python before the design: a .py file, or an importable module, whose
load(db) creates them on the design's NLDB (as
najaeda.primitives.xilinx does for --xilinx).
SVG and PNG export, no browser
export_svg() draws part of the design loaded in najaeda as an SVG
schematic, with no browser and no display (e.g. in CI). export_png()
makes the same drawing as a PNG image:
import naja_schematic
from najaeda import netlist
top = netlist.load_gate_level_verilog("design.v")
naja_schematic.export_svg(
[top.get_child_instance("u1")], # instances: boxes with every pin
"cone.svg",
nets=[top.get_term("y")], # nets, each a colored trace
traces=[(["u1"], "D")], # fan-in cones, back to flops and ports
style=[{"kind": "net", "target": top.get_term("y"), "color": "#ff7f0e"}], # as view.style()
)
png = naja_schematic.export_png(top.get_child_instance("u1"), "u1.png",
scale=3) # 3 pixels per SVG pixel, drawn sharp
naja_schematic.export_svg(
nets=[top.get_term("clk")], path="clk.svg",
view_options={"instance_label": "both", # name above each box, cell model under it
"max_sinks": 16, "group_by": "model"}, # a net's sinks past 16: "DFF x812"
)
naja_schematic.export_svg(
traces=[(["u1"], "D")], path="report.svg",
title="Fan-in of u1/D", caption="after the edit", # bands above / below the drawing
legend=True, # a swatch per color drawn
hide_ui_glyphs=True, # no open-pin stubs or "more pins" dots
)
svgs = naja_schematic.export_svgs([ # several drawings, one renderer
{"instances": [["u1", "u2"]], "path": "u2.svg"},
{"traces": [(["u3"], "A", 0)], "path": "u3_a0.svg"},
])
Targets are what show_instance()/show_net() take: najaeda
Instance/Term/Net/Equipotential, naja objects, instance paths as
lists of names or ids, and (instance, terminal[, bit]) pins. One that
doesn't resolve raises ValueError and nothing is drawn. The drawing is
exactly what a viewer showing the same things exports, primitives defined
in Python included. From a shell:
naja-schematic render --verilog design.v --py-primitives prims.py --top top \
--instance u1/u2 --net u1:A[3] --trace u3:D --net y --style styles.json --svg out.svg \
--png out.png --scale 3 --instance-label both --max-sinks 16
view_options (and the flags --instance-label, --sink-rows,
--max-sinks, --group-by; for exports only, --title, --caption,
--legend, --hide-ui-glyphs, also export_svg()/export_png()
keywords) set how the schematic is drawn, and the SVG's <g> groups
name every net, instance and port in it: see
How the schematic is drawn. In
a notebook they're show(view_options=...) / view.view_options(...),
and on a server ViewerServer(view_options=...), the same flags on
naja-schematic.
--instance, --net and --trace are repeatable. A pin is INST:TERM,
INST:TERM[BIT], or TERM for a top-level port; an instance path u1/u2
is matched against the design (an escaped name containing / still
works), or given as JSON ('[3,7]' ids, '["u1","u2"]' names; a pin as
'{"id_path":[3,7],"terminal":"A","bit":0}'). It exits non-zero, writing
nothing, if any target doesn't resolve.
The renderer, naja-schematic-render, is a small native program shipped in
the Linux (x86_64, aarch64), macOS and Windows (x64) wheels. Elsewhere,
build it from a checkout
(cmake -S . -B build-render -DNAJA_SCHEMATIC_RENDER_ONLY=ON && cmake --build build-render, a C++ compiler is all it needs) and set
NAJA_SCHEMATIC_RENDER to its path.
From an application that already holds the design
A tool that loads and edits the design itself (with najaeda or the raw
naja bindings) can serve the viewer on it without loading anything:
import threading, naja_schematic
design_lock = threading.RLock() # held by the host while it edits the design
server = naja_schematic.ViewerServer(lock=design_lock) # port 0: any free port
server.start()
server.open_browser() # or hand server.url to the user
server.annotate(items) # diagnosis overlay, kept across reloads
server.style(items) # colors, widths, fills, labels, kept across reloads
server.show_instance([3, 7]) # instance ids, names, or a najaeda Instance
server.show_net(term, color="#ff8800") # a net as a colored trace (a najaeda Term, ...)
svg = server.export_svg("view.svg") # the schematic as SVG, from a viewer
server.show_net(term, trace=True) # a pin's fan-in cone
server.on_select(lambda id_path, path: print("selected", path))
with server.replacing_design(): # holds design_lock, then viewers reload
netlist.load_gate_level_verilog("other.v")
server.stop()
Viewer requests are answered on a background thread while lock is held
(or pass run= to answer them on a thread of your choosing). The page's
URL carries a random access token, and other web pages can't connect to
the WebSocket. Once the design is replaced, anything a viewer asked about
or selected in the old one is ignored, even if it arrives late or names
instance ids the new design reuses.
Development
The viewer bundle (naja_schematic/static/naja-schematic.js) is built from
the C++ sources, not checked in. From the repository root:
emcmake cmake -S . -B build-wasm-module -DCMAKE_BUILD_TYPE=Release -DNAJA_SCHEMATIC_WASM_MODULE=ON
cmake --build build-wasm-module
export NAJA_SCHEMATIC_BUNDLE=$PWD/build-wasm-module/naja-schematic.js # or copy it into static/
pip install -e "python[test]" && pytest python/tests
The SVG export tests need the headless renderer (they're skipped without it):
cmake -S . -B build-render -DCMAKE_BUILD_TYPE=Release -DNAJA_SCHEMATIC_RENDER_ONLY=ON
cmake --build build-render
export NAJA_SCHEMATIC_RENDER=$PWD/build-render/naja-schematic-render # or copy it into bin/
Releases are built and published by .github/workflows/python-package.yml
on a v<version> tag (e.g. v0.1.0).
Metadata
Release files for naja-schematic 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| naja_schematic-0.3.0.tar.gz | 1.2 MB | With provenance | Details for naja_schematic-0.3.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| naja_schematic-0.3.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for naja_schematic-0.3.0-py3-none-win_amd64.whl |
| naja_schematic-0.3.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for naja_schematic-0.3.0-py3-none-manylinux_2_28_x86_64.whl |
| naja_schematic-0.3.0-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for naja_schematic-0.3.0-py3-none-manylinux_2_28_aarch64.whl |
| naja_schematic-0.3.0-py3-none-macosx_11_0_universal2.whl | Python 3 | none | macOS 11.0+ universal2 (ARM64, x86-64) | Details for naja_schematic-0.3.0-py3-none-macosx_11_0_universal2.whl |
| naja_schematic-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for naja_schematic-0.3.0-py3-none-any.whl |
Total release size: 14.7 MB
Release files / naja_schematic-0.3.0.tar.gz
| Download URL | naja_schematic-0.3.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
576b9431e6e77ade7a7d5d62164cb088b3f3391ecebcf8391e577b6775a76c4f
|
|
BLAKE2b-256 checksum How to use checksums |
9b4b186a6cf33d11c6bafcd91e4180b485687bbd712aa4c27568b93e0f4fe32c
|
| 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 14, 2026.
Transparency logRelease files / naja_schematic-0.3.0-py3-none-win_amd64.whl
| Download URL | naja_schematic-0.3.0-py3-none-win_amd64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
afb7563588ad571aeb8d8768ea2835b30ae74bdd7a6e5c0fcb5410c8438698c5
|
|
BLAKE2b-256 checksum How to use checksums |
84b93be4a806026bd742c0609ebd209af4dfb5c110c421af4cb0324093879ba5
|
| 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 14, 2026.
Transparency logRelease files / naja_schematic-0.3.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | naja_schematic-0.3.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f66d8e3026193b1740881319e219c79d622176ebfc8bca7422afdddd284a1328
|
|
BLAKE2b-256 checksum How to use checksums |
f9511f6cc5e9599f26053f94cb0057002e0bae9a720c7d3d7f2a4135091eeeab
|
| 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 14, 2026.
Transparency logRelease files / naja_schematic-0.3.0-py3-none-manylinux_2_28_aarch64.whl
| Download URL | naja_schematic-0.3.0-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
c6ad482282820e803c3f3815efd4c12fb3cd9e186263944294e4f3218192adad
|
|
BLAKE2b-256 checksum How to use checksums |
f3f6e1d3440a048eddff45b89cef55e0dc724fb168b8ae6b92c90bcfc9e5d5e2
|
| 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 14, 2026.
Transparency logRelease files / naja_schematic-0.3.0-py3-none-macosx_11_0_universal2.whl
| Download URL | naja_schematic-0.3.0-py3-none-macosx_11_0_universal2.whl |
|---|---|
| Size | 3.8 MB |
| Tags | Python 3 macOS 11.0+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
2c6ee43fc2eda54eb5847e6aac9551caf62c1710a772acc8dcef68b4b92aec8b
|
|
BLAKE2b-256 checksum How to use checksums |
4bfd83621df577c2155eec4ec79e936161375fefa58e32c8e318980c02077ad2
|
| 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 14, 2026.
Transparency logRelease files / naja_schematic-0.3.0-py3-none-any.whl
| Download URL | naja_schematic-0.3.0-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8679af8c7f07e5183f81124abc48280d45f02a51ccfe41b684609155faa634d
|
|
BLAKE2b-256 checksum How to use checksums |
03d90412ed117b880539733d8f30e0f403fc5ecd566043250c1efb3cbad7c70d
|
| 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 14, 2026.
Transparency logSecurity for naja-schematic 0.3.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.
Attestation for naja_schematic-0.3.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 14, 2026.
Transparency logA 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.