gdsfactoryx
gdsfactoryx is a port of GDSFactory (9.51.0) with a differentiable
JAX geometry backend: polygons, ports, references and routes are float64 JAX-compatible
arrays, so any scalar computed from a layout can be differentiated with jax.grad with respect to the parameters of
the cell functions. KLayout is kept for GDS I/O, viewing and boolean operations. The API is gdsfactory's: you still
import gdsfactory as gf.
- Documentation: gdsfactoryx has no docs of its own. Use the gdsfactory docs: https://gdsfactory.github.io/gdsfactory/
- FDTD simulation of components and layer stacks (fdtdx), and the 3D viewer, live in bifrost.
import jax
import gdsfactory as gf
gf.gpdk.PDK.activate()
jax.grad(lambda r: gf.components.ring_single(radius=r).dxsize)(10.0)
Installation
gdsfactoryx installs the same top-level gdsfactory package as upstream
gdsfactory, so the two cannot share an environment. Remove upstream
first, then install:
pip uninstall -y gdsfactory
pip install gdsfactoryx
To install the latest development version from GitHub instead:
pip install "gdsfactoryx @ git+https://github.com/Sephiram591/gdsfactoryx.git"
If both distributions end up installed, import gdsfactory raises an ImportError that says so. Fix it with
pip uninstall -y gdsfactory gdsfactoryx && pip install gdsfactoryx.
Packages that depend on upstream gdsfactory (for example gplugins) will install it again. Install such packages
with pip install --no-deps and add their other dependencies yourself, so they use gdsfactoryx.
Differentiability
Reverse mode (jax.grad, jax.vjp) and forward mode (jax.jvp, jax.jacfwd) work. Differentiation runs eagerly
by default: wrap the objective in jax.grad, and component functions keep their ordinary Python control flow on concrete
values. Without tracers, geometry runs at numpy speed.
jax.jit also works when the geometry's structure does not depend on the traced values: polygons with a fixed number
of vertices, ports and reference transforms, grid snapping included, give the same results as eagerly. Discrete choices
(number of points, if on a value, routing topology) and KLayout operations need concrete values and raise a
TypeError inside jax.jit; use the eager mode for them.
| Quantity | How |
|---|---|
| polygon vertices | component.get_polygons_points() returns (N, 2) arrays |
| ports | port.x, port.y, port.center_array, port.width, port.orientation |
| references | ref.transform, ref.move/rotate/mirror/connect, ref.xmin = ... |
| bounding boxes and areas | component.dbbox(), xmin/xmax/ymin/ymax/xsize/ysize/center, component.area(layer) |
| paths and extrusion | gf.path.arc/euler/straight/smooth/spiral_archimedean, Path.length(), gf.path.extrude |
| routes | route_single, route_bundle, route_bundle_all_angle, route_dubins: route.length, element positions |
| rasterization | gf.rasterize.rasterize(component, layer, resolution) |
Notes:
- Discrete choices (number of points,
ifbranches, cell names, routing topology) use concrete primal values, so the gradient is exact for the chosen topology and zero across a discrete switch. - 1 nm grid snapping uses straight-through rounding (value snapped, gradient identity). Set
gf.snap.SNAP_ENABLED = Falseto compare with finite differences. Insidejax.jitthe flag is read when the function is traced: changing it does not affect a function that is already compiled. @gf.cellcalls with tracer arguments bypass the cache.- KLayout is used only for discrete operations (I/O,
show/plot, booleans, sizing, DRC fixes, fill, merged areas); gradients stop there.gf.boolean,offset,over_under,fix_width,fix_spacing,trim,fill,get_polygons(merge=True)and A* routing are not differentiable. component.area(layer)is the merged area as upstream; its derivative is that of the summed polygon areas, exact for non-overlapping polygons.
Differences from upstream API
ComponentandComponentReferenceare gdsfactoryx classes, not kfactoryDKCell/DInstance; usecomponent.to_kfactory()for a (concrete) kfactory cell.component.get_polygons()returns KLayout polygons as upstream;get_polygons_points()returns differentiable arrays.port.centeris an(x, y)tuple; useport.center_array(orport.xy) for array math.- Routes are
gdsfactory.routing.ManhattanRouteobjects with kfactory's attributes plusbackbone_um(differentiable).
The rest of this README is upstream GDSFactory's.
GDSFactory is a Python library for designing chips (Photonics, Analog, Quantum, MEMS), PCBs, and 3D-printable objects. We aim to make hardware design accessible, intuitive, and fun—empowering everyone to build the future.
As input you write python code, as an output GDSFactory creates CAD files (GDS, OASIS, STL, GERBER).
Quick Start
import gdsfactory as gf
# Activate the built-in generic process design kit
gf.gpdk.PDK.activate()
# Create a new component
c = gf.Component()
# Add a rectangle
r = gf.components.rectangle(size=(10, 10), layer=(1, 0))
rect = c.add_ref(r)
# Add text elements
t1 = gf.components.text("Hello", size=10, layer=(2, 0))
t2 = gf.components.text("world", size=10, layer=(2, 0))
text1 = c.add_ref(t1)
text2 = c.add_ref(t2)
# Position elements
text1.xmin = rect.xmax + 5
text2.xmin = text1.xmax + 2
text2.rotate(30)
# Show the result
c.show()
4M+ downloads · 116+ contributors · 42+ PDKs
GDSFactory provides a comprehensive end-to-end design flow:
- Design (Layout, Simulation, Optimization) — Define parametric cell functions in Python to generate components. Test component settings, ports, and geometry to avoid unwanted regressions, and capture design intent in a schematic.
- Verify (DRC, DFM, LVS) — Run simulations directly from the layout using our simulation interfaces, removing the need to redraw your components in simulation tools. Conduct component and circuit simulations, study design for manufacturing. Ensure complex layouts match their design intent through Layout Versus Schematic verification (LVS) and are DRC clean.
- Validate — Define layout and test protocols simultaneously for automated chip analysis post-fabrication. Extract essential component parameters and build data pipelines from raw data to structured data to monitor chip performance.
Input: Python or YAML. Output: GDSII, OASIS, STL, or GERBER files for fabrication, plus component settings and netlists in YAML.
GDSFactory integrates with Ansys, Lumerical, Tidy3d, MEEP, DEVSIM, SAX, MEOW, SPICE, and more.
Open-Source PDKs (No NDA Required)
These PDKs are publicly available and do not require an NDA:
Photonics
| PDK | Code | Docs |
|---|---|---|
| Cornerstone PDK | GitHub | Docs |
| SiEPIC Ebeam UBC PDK | GitHub | Docs |
| VTT PDK | GitHub | Docs |
| Luxtelligence GF PDK | GitHub | Docs |
Quantum
| PDK | Code | Docs |
|---|---|---|
| Quantum RF PDK | GitHub | Docs |
RF / AMS / Digital / Analog
| PDK | Code | Docs |
|---|---|---|
| IHP | GitHub | Docs |
| GlobalFoundries 180nm MCU CMOS | GitHub | Docs |
| SkyWater 130nm CMOS | GitHub | Docs |
Foundry PDKs (NDA Required)
Access PDKs under NDA require a GDSFactory+ subscription. To sign up, visit GDSFactory.com. See list of available PDKs under NDA here.
GDSFactory+
GDSFactory+ offers Graphical User Interface for chip design, built on top of GDSFactory and VSCode. It provides you:
- Foundry PDK access
- Schematic capture
- Device and circuit Simulations
- Design verification (DRC, LVS)
- Data analytics
Getting Started
- See slides
- Read docs
- See announcements on GitHub, google-groups or LinkedIn
- PIC training
- Online course UBCx: Silicon Photonics Design, Fabrication and Data Analysis, where students can use GDSFactory to create a design, have it fabricated, and tested.
- Visit website
Who is using GDSFactory?
Hundreds of organisations are using GDSFactory. Some companies and organizations around the world using GDSFactory include:
"I've used GDSFactory since 2017 for all my chip tapeouts. I love that it is fast, easy to use, and easy to extend. It's the only tool that allows us to have an end-to-end chip design flow (design, verification and validation)."
"I've relied on GDSFactory for several tapeouts over the years. It's the only tool I've found that gives me the flexibility and scalability I need for a variety of projects."
"The best photonics layout tool I've used so far and it is leaps and bounds ahead of any commercial alternatives out there. Feels like GDSFactory is freeing photonics."
"As an academic working on large scale silicon photonics at CMOS foundries I've used GDSFactory to go from nothing to full-reticle layouts rapidly (in a few days). I particularly appreciate the full-system approach to photonics, with my layout being connected to circuit simulators which are then connected to device simulators. Moving from legacy tools such as gdspy and phidl to GDSFactory has sped up my workflow at least an order of magnitude."
"I use GDSFactory for all of my photonic tape-outs. The Python interface makes it easy to version control individual photonic components as well as entire layouts, while integrating seamlessly with KLayout and most standard photonic simulation tools, both open-source and commercial."
Why Use GDSFactory?
- Fast, extensible, and easy to use – designed for efficiency and flexibility.
- Free and open-source – no licensing fees, giving you the freedom to modify and extend it.
- A thriving ecosystem – the most popular EDA tool with a growing community of users, developers, and integrations with other tools.
- Built on the open-source advantage – just like the best machine learning libraries, GDSFactory benefits from continuous contributions, transparency, and innovation.
GDSFactory is really fast thanks to KLayout C++ library for manipulating GDS objects. You will notice this when reading/writing big GDS files or doing large boolean operations.
| Benchmark | gdspy | GDSFactory | Gain |
|---|---|---|---|
| 10k_rectangles | 80.2 ms | 4.87 ms | 16.5 |
| boolean-offset | 187 μs | 44.7 μs | 4.19 |
| bounding_box | 36.7 ms | 170 μs | 216 |
| flatten | 465 μs | 8.17 μs | 56.9 |
| read_gds | 2.68 ms | 94 μs | 28.5 |
Contributors
A huge thanks to all the contributors who make this project possible!
We welcome all contributions—whether you're adding new features, improving documentation, or even fixing a small typo. Every contribution helps make GDSFactory better!
Join us and be part of the community. 🚀
LLM-Friendly Documentation
GDSFactory provides machine-readable documentation optimized for LLM agents and AI-assisted development:
- llms.txt — concise overview with links to all documentation sections
- llms-full.txt — complete API reference and usage guide in a single document
These follow the llms.txt standard for making documentation easily ingestable by large language models.
Community
Join our growing community:
Metadata
Release files for gdsfactoryx 9.51.0.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gdsfactoryx-9.51.0.post1.tar.gz | 664.9 kB | With provenance | Details for gdsfactoryx-9.51.0.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gdsfactoryx-9.51.0.post1-py3-none-any.whl | Python 3 | none | any | Details for gdsfactoryx-9.51.0.post1-py3-none-any.whl |
Total release size: 1.6 MB
Release files / gdsfactoryx-9.51.0.post1.tar.gz
| Download URL | gdsfactoryx-9.51.0.post1.tar.gz |
|---|---|
| Size | 664.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45b748336eb97c0bf5e436323a9666327a74102adf01e64095bdfa11b0441085
|
|
BLAKE2b-256 checksum How to use checksums |
3e4892294707489784f19043c49a6f8e8d39408525fa32716e8922065506b1a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 6, 2026.
Transparency logRelease files / gdsfactoryx-9.51.0.post1-py3-none-any.whl
| Download URL | gdsfactoryx-9.51.0.post1-py3-none-any.whl |
|---|---|
| Size | 923.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6140551cb2f610eecd81817e3e77c8638c3ffa38ccbf2fc0209c626d3ef829bf
|
|
BLAKE2b-256 checksum How to use checksums |
64d65f6baa2a6a6f14b1fd5825bec6849cc63b5bf74d32bd9d0457791575b183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 6, 2026.
Transparency logSecurity for gdsfactoryx 9.51.0.post1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gdsfactoryx-9.51.0.post1.tar.gz
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 Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.