Skip to main content

kwasm

A standalone KLayout-powered GDS viewer with 2D and 3D views.

The product is one self-contained JavaScript file: UI, styles, icons, Three.js, and one Rust/KLayout WebAssembly runtime. Mount it in a DOM element or an iframe; interact through versioned JSON messages. No React implementation is included. The protocol can export the edited in-memory design back to base64 GDS. Use resetProject: true on loadGds when replacing it with an unrelated design; ordinary same-project reloads retain companion configuration and camera state.

This checkout contains an unreleased breaking refactor. The examples below describe the new interface, not necessarily the currently deployed CDN/PyPI release.

Browser

Build or download the matching kwasm-VERSION.js and serve it locally or on a CDN:

<div id="viewer" style="height:600px"></div>
<script src="./kwasm-0.2.26.js"></script>
<script>
  const viewer = Kwasm.mount(document.getElementById("viewer"), { viewerId: "layout" });
  viewer.ready.then(() => {
    window.postMessage(
      {
        type: "kwasm:request",
        version: 2,
        viewerId: "layout",
        requestId: "load-1",
        action: "loadGds",
        gds: "YOUR_BASE64_GDS",
      },
      window.origin === "null" ? "*" : window.origin,
    );
  });
  // Call viewer.destroy() when removing it.
</script>

Initial data can also be embedded with mount(element,{gds,lyp,layerstack}). 3D requires a layerstack and uses the same loaded design, active cell and layer visibility as 2D. One viewer per page is supported.

The native runtime runs in one embedded worker so long KLayout operations do not block the surrounding page. No extra runtime file is fetched. A restrictive CSP must permit worker-src data: as well as WebAssembly compilation; see the public interface for a complete policy example.

Complete public interface and examples: all mount options, messages, responses, events, origins, drawing/routing flow, Python APIs, and limits. There are no viewer URL parameters.

Python

import kwasm

kwasm.bundle("design.gds", output="design.html", layerstack="stack.json")
kwasm.show("design.gds", interactive=True, layerstack="stack.json")

The wheel ships the same JS file. Offline HTML is the default reference integration. Pass script_url=kwasm.CDN_URL to fetch the versioned viewer at runtime after the corresponding release is deployed, or use your own hosting URL.

kwasm bundle design.gds --lyp layers.lyp --layerstack stack.json --output design.html
kwasm view design.gds
kwasm export-layerstack your_pdk.module --output stack.json

Development

Install Rust (pinned toolchain), Emscripten 6.0.4, Node 22+, uv and just. Initialize the KLayout/Expat submodules and activate Emscripten on PATH.

git submodule update --init --recursive
npm ci
just build             # one Rust binary + dist/kwasm-VERSION.js
just dev               # copy identical JS into Python package
just test              # Python, pure Rust and JS unit tests
npx playwright install chromium
just test-js-browser   # actual built artifact, both views and embedding modes
just wheel

Developing and architecture · Feature boundaries and invariants · Refactor decisions and acceptance

License

GPL-3.0; see LICENSE. KLayout is not replaced or relicensed by this refactor. Bundled third-party components retain their own licenses, including Three.js (MIT) and Font Awesome Free. A CDN or postMessage transport does not itself determine the license obligations of a consuming application.

Metadata

Release files for kwasm 0.3.0

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

Built distribution (wheel)

Table of built distributions (wheels) for kwasm 0.3.0
File Interpreter ABI Platform
kwasm-0.3.0-py3-none-any.whl Python 3 none any Details

Release files / kwasm-0.3.0-py3-none-any.whl

Download URL kwasm-0.3.0-py3-none-any.whl
Size 2.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8ba4b0067bc768585c9f2870f44a2d458c88f2ab3df93a785d76de558959eb3a
BLAKE2b-256 checksum
How to use checksums
697c8eb6e5853822df799195e0cadbd39a3a6e579ea4a58e55c827cdbb66218a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

1 release file

This release

0.3.0 This release

1 release file

0.2.26

1 release file

0.2.25

1 release file

0.2.24

1 release file

0.2.23

1 release file

0.2.22

1 release file

0.2.21

1 release file

0.2.20

1 release file

0.2.19

1 release file

0.2.17

1 release file

0.2.16

1 release file

0.2.15

1 release file

0.2.14

1 release file

0.2.13

1 release file

0.2.12

1 release file

0.2.11

1 release file

0.2.10

1 release file

0.2.9

1 release file

0.2.8

1 release file

0.2.7

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

0.0.0

1 release file

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