Python Library
Examples
Runnable examples that generate GDS outputs.
pypkg/laylight-examples currently provides two runnable examples:
straight_waveguide.gdsring_coupler.gds
Generation command, run from the repository root:
uv run --package laylight-examples laylight-examples --output-dir build/examplesIf the workspace dependencies are not installed yet, you can also run:
PYTHONPATH=pypkg/laylight:pypkg/laylight-examples python -m laylight_examples --output-dir build/examplesExample Structure
The example code follows a simple pattern:
- Create a layout, its top cell and the technology with
new_layout() - Instantiate a device from
laylight.structure - Place it with
laylight.Placer(device).into(top) - Call
layout.write("out.gds"), which compiles the layout's IR with thelaylightcommand line
This pattern is a good base for more complex composition examples, such as:
- Multi-segment waveguide routing
- MZI structures
- Tunable devices with heaters
- Probe pad and routing examples