Skip to main content

Scenet

A semantic DSL for comic panels, compiled to SVG.

⚠️ This project is deliberately AI-generated

This project is, by design, almost entirely generated by AI. It exists as a personal training ground for learning to work with AI coding tools. The architecture, code, tests and documentation are overwhelmingly AI-authored, under human direction and review.

Treat it accordingly: an experiment first, a usable tool second.


CI PyPI Python License: 0BSD Status: alpha

Documentation · Playground · Tutorial · Changelog

What this is

Music has notation. A score describes the semantics of a piece — pitch, duration, dynamics — without describing the waveform that eventually reaches your ear. Rendering is left to an interpreter, human or machine.

Images have no such thing. SVG describes how to draw, not what is depicted: it is closer to a WAV file than to a score. Scenet is an attempt at the missing layer, narrowed to one tractable domain — the comic panel.

You write what is in the panel:

panel:
  size: [1000, 1000]
camera:
  shot: medium_shot
  angle: eye_level
cast:
  alice: {reference: alice, pose: pointing,     at: left_third,  facing: right}
  bob:   {reference: bob,   pose: arms_crossed, at: right_third, facing: left}
staging:
  - alice left_of bob
  - alice looking_at bob
script:
  - say: {by: alice, text: "You forgot your umbrella!", prefer: top_left}
  - say: {by: bob,   text: "I know."}

You can also write a sequence, where each panel states only what changed from the one before — borrowed from OpenUSD's sparse override, because consecutive panels in a scene share nearly all their staging:

panels:
  establishing:
    camera: {shot: full_shot}
    cast: {alice: {reference: alice}, bob: {reference: bob}}
  reaction:
    over: establishing        # same cast, same staging
    camera: {shot: close_up}  # move in

Or in comic script, the format writers already use:

PANEL 1
@shot: full_shot
Alice and Bob face each other on a rainy street corner.

ALICE
You forgot your umbrella!

BOB (whisper)
I know.

From any of these, the compiler works out the rest: how large each figure must be for a medium shot, where they stand, which way they face, how big each balloon needs to be for its text, where a balloon can sit without covering a face, and how its tail reaches the speaker's mouth — all while preserving reading order.

No generative image model is involved. This is a deterministic compiler: constraint solving and computational geometry. The same input always produces byte-identical output.

Status

Alpha — panels and sequences compile end to end, from the command line, the browser, or an editor. Framing, actor placement, balloon placement, reading order, tail routing and SVG emission all work, from either of two frontends. Not yet built: page composition (tiers, panels of varying size) and the interpretation layer that would give a panel a style. See the phase plan for detail.

uv run scenet build examples/duel.panel.yaml --core --debug
uv run scenet build examples/sequence.scene.yaml --strip
uv run scenet build examples/umbrella.script --strip

--core writes the resolved intermediate tier as JSON; --debug writes an overlay showing the geometry the solver was working against — silhouette hulls, face exclusion zones, anchors, gaze vectors and tail routes.

How it works

  duel.panel.yaml     →     Panel Core (.core.json)     →     panel.svg
  authored,                 resolved, fully numeric,          rendered
  no coordinates            still named & inspectable

The intermediate tier is a real, writable format rather than a hidden data structure — so layouts can be inspected, hand-adjusted, and diffed independently of how they are drawn. The approach is borrowed from Vega-Lite, which compiles a high-level grammar into a lower-level one before emitting SVG.

Try it in the browser

The playground runs this compiler — the same Python, unmodified — in your browser under WebAssembly via Pyodide. It is not a reimplementation: the page installs the exact wheel uv build produces, so there is no second copy of the geometry to drift out of step.

Fifteen worked examples, covering every shot type, every balloon kind, both frontends and the constraint priorities. Each one is a real file under examples/gallery/ that the test suite compiles, so the playground cannot offer an example that does not work.

The editor is Monaco, fed the same JSON Schema the VS Code extension uses — generated from the compiler's own models, so completion and hover documentation cannot drift from what compiles. Everything is served from one origin: no CDN, no analytics, nothing fetched from anywhere else.

Editor support

The VS Code extension gives completion and inline validation for panel documents, plus a side-by-side preview. Its JSON Schema is generated from the compiler's own models by scenet schema, so what the editor offers is what actually compiles. A test fails if the shipped schema goes stale.

Install

pip install scenet

Python 3.12 or newer. No system libraries, no fonts to install, nothing to configure. Ships a py.typed marker, so mypy, pyright, ty and basedpyright read the annotations straight from the package.

from scenet import compile_source, render

result = compile_source("cast: {alice: {reference: alice}}")
svg = render(result.core)

Development

Requires uv. It manages the Python version too, so this is the whole setup:

uv sync --all-groups
uv run pytest

Checks, all of which run in CI:

uv run ruff check . && uv run ruff format --check .
uv run ty check
uv run pytest

Documentation

azias.github.io/scenet — or read the Markdown source under docs/, which GitHub renders without a build step.

Tutorial Build a panel from nothing, in fifteen minutes
How-to guides Sequences, comic scripts, your own characters, using it as a library
Language specification Every construct, with examples
Shot types Normative camera framing table
Panel Core The resolved intermediate format
Asset contract What a character puppet must declare
API reference Every public name
Design decisions Why it is shaped this way
Prior art What already exists, and what was taken from it

Every Python example in the documentation is executed by the test suite. An example that omits an import, or that has drifted out of step with the code, fails the build.

License

0BSD — see LICENSE. This is deliberately one step more permissive than MIT: you may use, copy, modify and distribute this software for any purpose, with no obligation to preserve a copyright notice or reproduce the license. No attribution is required, though it is always welcome.

Third-party components are listed in THIRD_PARTY_NOTICES.md. The lettering font arrives as an ordinary dependency under the SIL Open Font License, which does require its own notice be kept with it.

The language specification is free to implement. Anyone may build their own compiler, editor, renderer or tooling for this language, in any project, commercial or otherwise, without restriction or attribution. A notation is only worth having if it is not owned.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scenet-0.1.0.tar.gz (70.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scenet-0.1.0-py3-none-any.whl (82.0 kB view details)

Uploaded Python 3

File details

Details for the file scenet-0.1.0.tar.gz.

File metadata

  • Download URL: scenet-0.1.0.tar.gz
  • Upload date:
  • Size: 70.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scenet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8f3bfc9cd53f278e71f7a61c4171c0cce85a622276da29a89135f8a09f7209e8
MD5 2a391f72dae3235a9ad211dc52ae631a
BLAKE2b-256 73d83daea8c355460d88c133e04cb048298fc28d02ce5940c2661a0a3da40c72

See more details on using hashes here.

Provenance

The following attestation bundles were made for scenet-0.1.0.tar.gz:

Publisher: release.yml on azias/scenet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scenet-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scenet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 82.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for scenet-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4acd8d2ec76ac6a3835490ec9c3cb394969186e6dba98ff8ec4891e65352889a
MD5 f58dad92c636b60a3f47abf357c70bca
BLAKE2b-256 6cc442a4368662cfd93aa0c6431e879c5a788145325e3532ead27b08f2e0e78a

See more details on using hashes here.

Provenance

The following attestation bundles were made for scenet-0.1.0-py3-none-any.whl:

Publisher: release.yml on azias/scenet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page