Skip to main content

lumina-svg-core

Build wheels Python 3.12–3.14 License: AGPL v3

English | 简体中文

A native SVG geometry engine for print workflows. lumina-svg-core resolves SVG paint operations, converts them into polygons, and exposes the result to Python as read-only NumPy arrays. It preserves paint order, holes, clipping, solid-color alpha compositing, and the identity of contributing paints.

Originally developed for Lumina Studio, this independent repository contains the geometry engine, Python bindings, test fixtures, and build tools. It has no runtime dependency on Lumina Studio, its UI, printer settings, or application services. It does not generate meshes or 3MF files.

Status: source version 0.3.2, alpha. CPython 3.12, 3.13 and 3.14 are supported. The geometry result contract is schema version 4.

Installation

Prebuilt wheels

After version 0.3.2 is published on PyPI, the standard installation command is:

python -m pip install lumina-svg-core==0.3.2

Confirm availability on the PyPI version page and publishing workflow. Until that version is available, use the existing public 0.3.1 GitHub wheels:

python -m pip install --only-binary=lumina-svg-core --find-links https://github.com/lumina-layer-studio/lumina-svg-core/releases/expanded_assets/v0.3.1 "lumina-svg-core==0.3.1"

No C++ compiler, third-party checkout, manual patch, or local wheelhouse is needed for a matching prebuilt wheel. The fallback command selects the published 0.3.1 release. LunaSVG/PlutoVG and Clipper2 are compiled into the extension by maintainers.

Alternatively, download a matching wheel from GitHub Releases and install the downloaded file:

python -m pip install /path/to/lumina_svg_core-0.3.1-cp314-cp314-platform.whl

Replace the example filename with the actual downloaded wheel. Wheels are built for Windows x86-64, macOS Apple Silicon, macOS Intel, and Linux x86-64. macOS requires version 12 or newer for Python 3.12/3.13, and version 14 or newer for Python 3.14. Linux wheels use manylinux_2_28 and require glibc 2.28 or newer; Alpine/musl, Windows ARM and free-threaded Python are not covered. Match the wheel's OS, CPU and Python tags.

Build the native library from source (contributors)

You need CPython 3.12–3.14, Git, and a C++17 compiler: MSVC on Windows, Apple Clang on macOS, or GCC/Clang on Linux. The build installs its pinned Python build tools and fetches pinned LunaSVG and Clipper2 source revisions, so network access is required for a fresh build.

This is the library contributor workflow, not a prerequisite for running Lumina Studio from its Python/TypeScript source.

git clone https://github.com/lumina-layer-studio/lumina-svg-core.git
cd lumina-svg-core
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install .

On Windows, use py -3.12 -m venv .venv and activate it with .venv\Scripts\Activate.ps1 in PowerShell. Run the build from a Visual Studio developer shell if MSVC is not already available on your command line.

Quick start

import lumina_svg_core

svg = """<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10">
  <rect width="20" height="10" fill="#e63946"/>
  <circle cx="10" cy="5" r="3" fill="#457b9d" fill-opacity="0.5"/>
</svg>"""

result = lumina_svg_core.analyze_svg_svg(
    svg,
    target_width_mm=40.0,
    tolerance_mm=0.02,
)
if result.status != "supported":
    raise RuntimeError(f"SVG analysis failed: {result.status}: {result.reason_code}")

print(result.visible.geometry_count)
print(result.visible.rgba_f64)

# Coordinates are an integer working grid, not SVG units or millimetres.
coordinates_mm = (
    result.visible.coordinates.astype("float64")
    * result.grid_to_source_unit
    * result.scale_factor
)

To read a file, use lumina_svg_core.analyze_svg("drawing.svg", target_width_mm=40.0, tolerance_mm=0.02). Paths may also be pathlib.Path instances. Both analysis entry points accept allow_strokes=False to omit stroke paints while retaining fills.

Inspect the installed build with lumina_svg_core.__version__, lumina_svg_core.__source_revision__ and lumina_svg_core.__source_dirty__. Git-free source builds report unknown provenance unless the builder supplies it explicitly. Distribution preparation describes the build identity and checked file receipts.

See the API reference for ring traversal, result statuses, source identity, coordinate units, and the lower-level recording and grid APIs.

SVG support

Supported Details
Solid fills and strokes Fill rules, caps, joins, supported dash arrays, and non-scaling strokes
Shapes and paths Rectangles, rounded rectangles, circles, ellipses, polygons, and SVG path curves/arcs
Layout Affine transforms, viewBox origins, nested SVG viewports, and percentage lengths
References and styles Supported CSS selectors and same-document <use> references
Clipping and markers Vector clips, marker paints, and viewport clipping
Transparency Solid-paint alpha and isolated object/group opacity with normal source-over compositing

The SVG root begins transparent. The engine introduces no white background or printer-material matte. Fully opaque documents use reverse-order occlusion; translucent documents are partitioned and composited in premultiplied sRGB.

Masks, gradients, patterns, text, embedded images, external resources, non-normal blend modes, non-sRGB interpolation, and other unsupported semantics return a whole-document unsupported result. Zero-length dash entries are also unsupported. See support and numerical limits.

The recorder refactor reduces upstream patch additions by 46.5% while preserving the public API and geometry schema. Its prior comparison of 508 private SVGs at 220 mm / 0.02 mm with strokes enabled found the same 504 supported results and four native_geometry_error failures in both builds, with zero output differences. The four failures remain known 2D geometry limitations and are not counted as passes; see the detailed limitation.

Geometry contract

  • raw contains area-bearing paint geometry before paint-order occlusion; visible contains the final non-overlapping painted regions; silhouette contains their combined footprint.
  • Coordinates use an integer working grid with an explicit conversion factor. Arrays preserve polygon components, holes, colors, and paint provenance.
  • rgba_f64 is authoritative straight-sRGB RGBA in [0, 1]; rgba is a compatibility byte representation.
  • Point-only, line-only, empty, and collapsed fragments are reported separately in unprintable_fragments. They are not fabricated into printable polygons.
  • Unsupported or invalid documents are rejected as a whole. The standalone package does not retry them through another parser or silently discard unsupported elements.
  • The parser performs no morphological closing, printer-grid snapping, minimum-area filtering, triangulation, or mesh repair.

Independent normalization work can run in parallel. Set LUMINA_SVG_REPLAY_THREADS to a positive integer to select a worker count; the engine caps it at 16. Parallel and serial replay preserve the same ordered geometry and provenance.

Development and validation

python -m pip install ".[test]" build
python -m pytest tests -q
python -m build
python tools/verify_wheel.py dist/<actual-wheel-filename>.whl --contents-only

CI builds and installs wheels for all three Python versions on all four platform targets, runs the complete Python suite, checks binary/license contents, and exercises installed extensions. A separate Linux job builds a wheel from the source distribution and runs the native canonical-boundary regression. See CONTRIBUTING.md for the development workflow and benchmarks/README.md for reproducible measurements.

Performance numbers depend on the input, compiler, CPU, and thread count. The checked-in benchmark report describes its reference host; it is not a universal latency guarantee.

License and acknowledgements

The project is licensed under the GNU Affero General Public License, version 3 only (AGPL-3.0-only). See LICENSE for the full terms.

The implementation uses pinned LunaSVG/PlutoVG and Clipper2 sources, pybind11 bindings, and adapted hole-selection criteria from ChromaPrint3D. Their licenses and attributions remain separate and are documented in THIRD_PARTY_NOTICES.md and THIRD_PARTY_LICENSES/.

Report reproducible problems through GitHub Issues. For sensitive reports, follow SECURITY.md.

Metadata

Release files for lumina-svg-core 0.3.2

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

Source distribution (sdist)

Source distribution for lumina-svg-core 0.3.2
File Size Uploaded
lumina_svg_core-0.3.2.tar.gz 2.0 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for lumina-svg-core 0.3.2
File
lumina_svg_core-0.3.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
lumina_svg_core-0.3.2-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details
lumina_svg_core-0.3.2-cp314-cp314-macosx_14_0_x86_64.whl CPython 3.14 CPython 3.14 macOS 14.0+ x86-64 Details
lumina_svg_core-0.3.2-cp314-cp314-macosx_14_0_arm64.whl CPython 3.14 CPython 3.14 macOS 14.0+ ARM64 Details
lumina_svg_core-0.3.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
lumina_svg_core-0.3.2-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
lumina_svg_core-0.3.2-cp313-cp313-macosx_12_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 12.0+ x86-64 Details
lumina_svg_core-0.3.2-cp313-cp313-macosx_12_0_arm64.whl CPython 3.13 CPython 3.13 macOS 12.0+ ARM64 Details
lumina_svg_core-0.3.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
lumina_svg_core-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
lumina_svg_core-0.3.2-cp312-cp312-macosx_12_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 12.0+ x86-64 Details
lumina_svg_core-0.3.2-cp312-cp312-macosx_12_0_arm64.whl CPython 3.12 CPython 3.12 macOS 12.0+ ARM64 Details

Total release size: 12.6 MB

Release files / lumina_svg_core-0.3.2.tar.gz

Download URL lumina_svg_core-0.3.2.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
42b7b428d61103e17d6009d98eb4eb733bf1f2fec2a257ef98b0775cfd015a08
BLAKE2b-256 checksum
How to use checksums
5992eefb93a353e24dc4870977c742f330e423967dcfd006896204d3d541b560
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp314-cp314-win_amd64.whl

Download URL lumina_svg_core-0.3.2-cp314-cp314-win_amd64.whl
Size 975.3 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
4bc1f042045ff45492c3ffb20a8bb379450b2adf9666992b7a7680e111c5ae2f
BLAKE2b-256 checksum
How to use checksums
603e276bf9d1aebae190c4e7d3202c573634099230d71db62d85017537428ed8
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL lumina_svg_core-0.3.2-cp314-cp314-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c2f4f89122807d12884cff182b3846150649df2b1fd6621ac13f0f34b9fff8f0
BLAKE2b-256 checksum
How to use checksums
a284f0b0b797187c572762231dd935f22415f02e7beeab2060bf3f24f89701d8
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp314-cp314-macosx_14_0_x86_64.whl

Download URL lumina_svg_core-0.3.2-cp314-cp314-macosx_14_0_x86_64.whl
Size 792.5 kB
Tags CPython 3.14 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
7b41edd86a5327e1e973979a0244985ced4e6f1648bc21ad37c07e2c0bec3f99
BLAKE2b-256 checksum
How to use checksums
02a58656ba1b6cf4bc3e6b79886875fe5718da1988412a10ad078b4ed9a621e5
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp314-cp314-macosx_14_0_arm64.whl

Download URL lumina_svg_core-0.3.2-cp314-cp314-macosx_14_0_arm64.whl
Size 711.7 kB
Tags CPython 3.14 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
893bd22c070373304f5860109af21ea9ecdd6cba5f26db86c5df42403b32685d
BLAKE2b-256 checksum
How to use checksums
d8b27f714c7a04daf90f7c8fa8b9d78645001ca02ce49dfe2be416b278398c5a
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp313-cp313-win_amd64.whl

Download URL lumina_svg_core-0.3.2-cp313-cp313-win_amd64.whl
Size 946.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
c21fabc67c0596de5e2f1172763cc69479914d7b43e2435570932832d674ad7a
BLAKE2b-256 checksum
How to use checksums
52c65ba441333b3d3f3e6cc55ade8fe258867b54cb57bf1e7cb536fa3d16248c
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL lumina_svg_core-0.3.2-cp313-cp313-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
98f7c1c7d19af459f4ae106431cc9d1ec5bc92b89af935e40cb2c0aa6b3dea45
BLAKE2b-256 checksum
How to use checksums
6bb1e2d38fbe81b5a71fee111e6407674caa3025389b85638c8cceac29931feb
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp313-cp313-macosx_12_0_x86_64.whl

Download URL lumina_svg_core-0.3.2-cp313-cp313-macosx_12_0_x86_64.whl
Size 796.2 kB
Tags CPython 3.13 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
95df496e6839c5656c9eeaea9796876e1c5f7fdf7a986db5983cf86941fd6710
BLAKE2b-256 checksum
How to use checksums
3c04654b81c635e8a733e95f6b23478633de8d98c570d377a0e04d58c2038a24
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp313-cp313-macosx_12_0_arm64.whl

Download URL lumina_svg_core-0.3.2-cp313-cp313-macosx_12_0_arm64.whl
Size 715.6 kB
Tags CPython 3.13 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
a5b63748b5bc5f1331184b9d079f2376b1e53131b8dd4bd7789cbd28d35f3824
BLAKE2b-256 checksum
How to use checksums
f7ea6e2c292abd2a96c863f223f2addfa427c4c2afc6e908b9c574a218ec0c47
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp312-cp312-win_amd64.whl

Download URL lumina_svg_core-0.3.2-cp312-cp312-win_amd64.whl
Size 946.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f175aab461fbb0ad7b89fb1466962baa3a65f624bee9fc921833250e56e873d5
BLAKE2b-256 checksum
How to use checksums
9a52d0953ae38b9eeb7150c038232f408e1c80ee1bb9bce29c9d332a30ff6652
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL lumina_svg_core-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl
Size 1.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6a810b47c56d2c7e6e813aeb98a4992e740e441467dd329a8a7a6b1e7915f574
BLAKE2b-256 checksum
How to use checksums
f0014db19e0422b4ae8d7dcf33dbf7404d46b08bdac989307c3d4b630d22a5e0
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp312-cp312-macosx_12_0_x86_64.whl

Download URL lumina_svg_core-0.3.2-cp312-cp312-macosx_12_0_x86_64.whl
Size 796.1 kB
Tags CPython 3.12 macOS 12.0+ x86-64
SHA-256 checksum
How to use checksums
c9f3a3aa319393a29785e3a40e8ce853956837842457a6522cd77fbb1492ead5
BLAKE2b-256 checksum
How to use checksums
ddfcd2c329d5909325df25729f1a7a0efa32060c747221e87bd8d1572096c0ea
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 Oct 15, 2026.

Transparency log

Release files / lumina_svg_core-0.3.2-cp312-cp312-macosx_12_0_arm64.whl

Download URL lumina_svg_core-0.3.2-cp312-cp312-macosx_12_0_arm64.whl
Size 715.4 kB
Tags CPython 3.12 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
22b843abd479f83e87d6d0dc05024485c0d98785dd537b8cba61e0c21292399b
BLAKE2b-256 checksum
How to use checksums
28647080abf3db2b6fd56aeb0988597fed6aea593e5ea91f534b481087c5b0dc
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 Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.3

13 release files

This release

0.3.2 This release

13 release files

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