Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

LayMesh

Reproducible scientific figures and precise physical layouts from readable code. Compose native plots, images, vector shapes, text and formulas in one editable .lay source; export SVG, PDF and PNG with a native Rust engine.

中文文档 · English documentation · Examples · Source

Install

Requires Python 3.10+. Version 0.3.0a2 is an alpha prerelease:

python -m pip install --pre laymesh
python -m laymesh --version

Platform wheels bundle one native Rust executable and formula fonts. Rendering requires no Rust compiler, Node.js or TeX installation and downloads no engine or fonts. Body fonts come from the operating system or user-provided files; missing glyphs warn and display vector boxes. Supply font files with a layout for reproducible text across machines.

Optional feature Install
NumPy / pandas data python -m pip install --pre "laymesh[data]"
Matplotlib Figure import python -m pip install --pre "laymesh[plot]"
Both python -m pip install --pre "laymesh[data,plot]"

Wheel targets are Windows x64, macOS 14+ on Intel and Apple Silicon, and Linux x64 / arm64. Linux requires glibc at least as new as the wheel's manylinux_2_XX tag. Availability depends on uploaded wheels; Alpine/musl, 32-bit platforms and Windows ARM64 have no wheels. Native plots work without Matplotlib.

First figure: CLI

Save this complete source as figure.lay:

page = canvas(size=(120 mm, 90 mm), background="#ffffff")
p = plot(size=(110 mm, 80 mm),
         x=axis(label="Time (s)"), y=axis(label="Signal"))
p.line(x=[0, 1, 2, 3], y=[1, 3, 2, 4], label="Experiment")
p.legend(position="top_left")
page.add(p, offset=(5 mm, 5 mm))
laymesh validate figure.lay
laymesh inspect figure.lay --json
laymesh render figure.lay -o figure.svg
laymesh render figure.lay -o figure.pdf
laymesh render figure.lay -o figure.png --dpi 300

python -m laymesh invokes the same CLI. Geometry defaults to mm; typography and line widths default to pt. PNG DPI changes output pixels while preserving physical dimensions. .lay is a restricted standalone language, separate from Python.

Python API

from laymesh import render_source

source = '''
page = canvas(size=(120 mm, 90 mm), background="#ffffff")
p = plot(size=(110 mm, 80 mm),
         x=axis(label="Time (s)"), y=axis(label="Signal"))
p.line(x=[0, 1, 2, 3], y=[1, 3, 2, 4], label="Experiment")
p.legend(position="top_left")
page.add(p, offset=(5 mm, 5 mm))
'''
result = render_source(source, output="python-figure.svg", save_source="python-figure.lay")
print(result.output)

Use render_file("figure.lay", output="figure.pdf") to render existing source. Pass Python variables via namespace={"values": values} and refer to them with an unquoted {{values}} placeholder in .lay. Lists, dictionaries, NumPy arrays and pandas DataFrames can feed native plots. Matplotlib Figures can be placed as image assets. Keep calculations in Python; placeholders accept variable names, not expressions.

save_source saves expanded source and a sibling .assets/ directory for independent CLI rendering. Preserve that directory and any referenced modules, stylesheets or fonts with the .lay file. Python API and data examples.

Jupyter

Install LayMesh in the active kernel's environment. First run:

%load_ext laymesh.ipython
values = [1, 3, 2, 4]

Then run this separate cell:

%%laymesh -o notebook.pdf --save-source notebook.lay
page = canvas(size=(120 mm, 90 mm))
p = plot(size=(110 mm, 80 mm))
p.line(x=[0, 1, 2, 3], y={{values}})
page.add(p, offset=(5 mm, 5 mm))

The magic displays an SVG preview and writes the requested export. %laymesh figure.lay -o figure.png --dpi 300 renders an existing file. Both magics support --warnings show|hide. Notebook guide.

Scope

LayMesh provides physical units, anchors, cropping, paths, reusable modules, LCSS styles and native scientific plots including statistical, polar and radar layers. Layouts are single-page; panels use explicit positioning. Finish plot layers and decorations before placing a chart. Fixed plot areas keep their physical dimensions; decoration overflow emits a warning. Language reference.

中文

LayMesh 用一个可编辑的 .lay 文件组织科研图表、图片、文字与公式,导出 SVG、PDF、PNG。需要 Python 3.10+;预发布版本使用 python -m pip install --pre laymesh,数据和 Matplotlib 支持可选 laymesh[data,plot]。平台 wheel 内置原生 Rust 引擎和公式字体,正文使用系统或用户字体。支持 laymesh 命令、Python API 和 Jupyter Magic;保存源码与资源后可独立重新导出。中文入门。

LayMesh is MIT licensed. Bundled native dependencies, formula fonts and colormap data retain their own license texts inside the installed package. _vendor/manifest.json records engine, platform and build hashes; _vendor/licenses/manifest.json records dependency license provenance.

Metadata

Release files for laymesh 0.3.0a2

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

Built distributions (wheels)

Table of built distributions (wheels) for laymesh 0.3.0a2
File
laymesh-0.3.0a2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
laymesh-0.3.0a2-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details
laymesh-0.3.0a2-py3-none-manylinux_2_35_aarch64.whl Python 3 none Linux glibc 2.35+ ARM64 Details
laymesh-0.3.0a2-py3-none-macosx_14_0_x86_64.whl Python 3 none macOS 14.0+ x86-64 Details
laymesh-0.3.0a2-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details

Total release size: 29.7 MB

Release files / laymesh-0.3.0a2-py3-none-win_amd64.whl

Download URL laymesh-0.3.0a2-py3-none-win_amd64.whl
Size 5.9 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
15bd1228b826543bdf5cc5758960cfe10123519a71fc7b7a5c0a669841e76f51
BLAKE2b-256 checksum
How to use checksums
f0d7ac30b9bc37df8fe548a0a74ed2b1489852b762f4202d1cc53d240eb5efaa
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 4, 2026.

Transparency log

Release files / laymesh-0.3.0a2-py3-none-manylinux_2_35_x86_64.whl

Download URL laymesh-0.3.0a2-py3-none-manylinux_2_35_x86_64.whl
Size 6.3 MB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
2da33c354f7540d245c5e29fc104f0e6816b60e3b092b574e72e55713487691d
BLAKE2b-256 checksum
How to use checksums
6b9ba9bfc9faac5e83c7d83492dd0efd5ccd67a5ede899ad3fefab4f2cbb9379
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 4, 2026.

Transparency log

Release files / laymesh-0.3.0a2-py3-none-manylinux_2_35_aarch64.whl

Download URL laymesh-0.3.0a2-py3-none-manylinux_2_35_aarch64.whl
Size 5.8 MB
Tags Linux glibc 2.35+ ARM64 Python 3
SHA-256 checksum
How to use checksums
520e0ce486ee9289fb682ba056c2bfddf25a82e7fd059ed1d865ada50b6f9790
BLAKE2b-256 checksum
How to use checksums
db8e96f1dbbe03bb64274e41eefb76465fea648c59edb98004be247cd169e8de
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 4, 2026.

Transparency log

Release files / laymesh-0.3.0a2-py3-none-macosx_14_0_x86_64.whl

Download URL laymesh-0.3.0a2-py3-none-macosx_14_0_x86_64.whl
Size 6.1 MB
Tags Python 3 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
a306aff1d6a81ce8195cfac7bf79bca1e47be2e9208f4300c83683787ddc5f23
BLAKE2b-256 checksum
How to use checksums
a30d53f0af90b0608d9335746d6f78dd7695bd951f6e226358f0feab9f8e5137
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 4, 2026.

Transparency log

Release files / laymesh-0.3.0a2-py3-none-macosx_14_0_arm64.whl

Download URL laymesh-0.3.0a2-py3-none-macosx_14_0_arm64.whl
Size 5.5 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
dfb80f55c8cc4e5411751a2d56fd5de8d4398c7127d6ba801bb561b20a9394fe
BLAKE2b-256 checksum
How to use checksums
0e2d680cadef9fe7b8d52d11f96d9ba28ea649881d72ca0f8516954897b55f59
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 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

5 release files

0.3.0

5 release files

This release

0.3.0a2 This release

5 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