Metadata-Version: 2.5
Name: laylight
Version: 0.2.2
Summary: Photonic layout in Python, compiled to GDSII by the Laylight compiler
Keywords: gds,layout,photonics
Requires-Python: >=3.10
Requires-Dist: laylight-cli==0.2.2
Provides-Extra: klayout
Requires-Dist: klayout>=0.30.8; extra == 'klayout'
Description-Content-Type: text/markdown

# laylight

`laylight` is a Python toolkit for photonic layout design. Devices are Python classes; the library builds the [Laylight IR](https://laylight.photonstack.io/concepts/compilation/) from them, and the Laylight compiler, the `laylight` command line, turns the IR into GDSII.

laylight is a sub-product of [PhotonStack](https://photonstack.io/), focused on making photonic design more programmable, composable, and easier to explore.

## Why laylight

Photonic layout work often mixes device geometry, parameter sweeps, custom scripts, and visualization. laylight provides a Python-first way to:

- define photonic structures with reusable, parameterized devices
- chain devices port to port with `Placer`
- write layouts that carry their cells' parameters, ports and connections, through the same compiler as the [Laylight DSL](https://laylight.photonstack.io/concepts/dsl/)

## Documentation and tools

- Documentation: [laylight.photonstack.io](https://laylight.photonstack.io/)
- Playground: [laylight.photonstack.io/playground](https://laylight.photonstack.io/playground/)
- VS Code extension: [PhotonStack/laylight-vscode-extension](https://github.com/PhotonStack/laylight-vscode-extension)

## Installation

```bash
pip install laylight
```

This installs the `laylight` command line too (the `laylight-cli` package). PNG previews and KLayout PCells need KLayout:

```bash
pip install "laylight[klayout]"
```

## Simple example

```python
import laylight
from laylight.render import new_layout
from laylight.structure.wg import WGStraight

layout, top, tech = new_layout("DEMO")

device = WGStraight(
    length=200,
    width=0.5,
    layout=layout,
    tech=tech,
)

laylight.Placer(device).into(top)
layout.write("demo.gds")
```

This creates a straight waveguide and writes the result to `demo.gds`. `layout.to_ir()` returns the Laylight IR, and `layout.write("demo.lyir")` writes it to a file that Laylight DSL code can `import`.

## Learn more

For guided examples, API usage, and browser-based experiments, start with the documentation site and the online playground.
