gdsfactoryx
gdsfactoryx (9.51.0.post3) is the JAX-differentiable port of upstream
GDSFactory (v9.51.0), built to power
bifrost (end-to-end differentiable 3D FDTD photonics simulation with
fdtdx, LayerStack-to-3D permittivity voxelization, and an interactive 3D viewer).
In gdsfactoryx, polygons, ports, references, paths, cross-sections, and routes use a pure-Python/JAX array backend
(gdsfactory._jax.xp), so layout geometry can be differentiated with jax.grad and compiled under fixed-topology
jax.jit (and @bf.jit in bifrost) with respect to component parameters. klayout.db is kept for concrete GDS/OASIS
I/O, viewing, and discrete boolean/DRC operations. The public API remains gdsfactory's: you still
import gdsfactory as gf.
- Documentation:
gdsfactoryxkeeps upstreamgdsfactoryAPIs; see the GDSFactory docs for general layout/PDK usage. - FDTD simulation & 3D viewer: live in bifrost (
import bifrost as bf), which consumesgdsfactoryxComponents andLayerStackdefinitions directly.
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 provides the same top-level gdsfactory import package as upstream
gdsfactory, so the two distributions cannot share an environment. Remove
upstream gdsfactory first, then install gdsfactoryx with uv or pip:
# With uv
uv pip uninstall gdsfactory
uv pip install gdsfactoryx
# Or with pip
pip uninstall -y gdsfactory
pip install gdsfactoryx
To install the latest development version from GitHub:
uv pip install "gdsfactoryx @ git+https://github.com/Sephiram591/gdsfactoryx.git"
# or: pip install "gdsfactoryx @ git+https://github.com/Sephiram591/gdsfactoryx.git"
For local development from a clone:
git clone https://github.com/Sephiram591/gdsfactoryx.git
cd gdsfactoryx
uv sync --all-extras
If both distributions end up installed, import gdsfactory raises an ImportError. Fix it by uninstalling both and
reinstalling gdsfactoryx:
pip uninstall -y gdsfactory gdsfactoryx && pip install gdsfactoryx
Packages that declare a dependency on upstream gdsfactory (for example gplugins) will reinstall upstream gdsfactory
and break the environment unless installed without dependency resolution. Install such packages with --no-deps and
install their remaining dependencies manually:
pip install --no-deps gplugins
Differentiability, SNAP_ENABLED, and jax.jit
Reverse mode (jax.grad, jax.vjp) and forward mode (jax.jvp, jax.jacfwd) work out of the box. Differentiation
runs eagerly by default: wrap your objective in jax.grad, and component factories keep normal Python control flow
on concrete primal values. Without tracers, geometry executes at NumPy speed.
Fixed-topology jax.jit and @bf.jit: jax.jit (and bifrost's @bf.jit) works when the layout's discrete
structure—vertex counts, Python if/loop branches, cell names, and routing topology—does not depend on traced values.
Discrete choices and KLayout-backed operations require concrete values and raise a TypeError /
ConcretizationTypeError inside jax.jit; run those eagerly or keep structural parameters static.
Straight-through DBU grid snapping (gf.snap.SNAP_ENABLED): Manufacturing-grid snapping (1 nm / gf.kcl.dbu)
uses straight-through rounding (primal coordinates snapped to the DBU grid, identity gradient in AD) both eagerly and
under jax.jit. Set gf.snap.SNAP_ENABLED = False when validating analytical gradients against finite differences.
Inside jax.jit, SNAP_ENABLED is read at trace time—changing it does not alter an already-compiled function.
| 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, route.length_um, element positions |
| layer stacks | LayerStack, LayerLevel, DerivedLayer, LogicalLayer (consumed by bifrost for 3D FDTD voxelization) |
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. @gf.cellcalls with tracer arguments bypass the cell 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)computes the merged area as upstream; its derivative is that of the summed polygon areas, exact for non-overlapping polygons.
Differences from upstream API
ComponentandComponentReferencearegdsfactoryxclasses, notkfactoryDKCell/DInstance; usecomponent.to_kfactory()for a concretekfactorycell.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.- Manhattan routes are
gdsfactory.routing.ManhattanRouteobjects withkfactory's attributes plusbackbone_um(differentiable); all-angle and Dubins routes returnOpticalAllAngleRouteobjects withlength/length_umin µm.
Upstream & License
gdsfactoryx is derived from gdsfactory/gdsfactory (v9.51.0) under the
MIT license (see LICENSE). For 3D electromagnetic simulation, LayerStack meshing, and visualization, see
bifrost.
Metadata
Release files for gdsfactoryx 9.51.0.post3
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.post3.tar.gz | 675.3 kB | With provenance | Details for gdsfactoryx-9.51.0.post3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gdsfactoryx-9.51.0.post3-py3-none-any.whl | Python 3 | none | any | Details for gdsfactoryx-9.51.0.post3-py3-none-any.whl |
Total release size: 1.6 MB
Release files / gdsfactoryx-9.51.0.post3.tar.gz
| Download URL | gdsfactoryx-9.51.0.post3.tar.gz |
|---|---|
| Size | 675.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98ef5bb006fbfee0d5b5fa25332cc0c7abcc864e9fcfae89593ae8bb3c24b4f6
|
|
BLAKE2b-256 checksum How to use checksums |
2ca0ddb48a2b3513528cc1bb829cb762642fef1e7cdb75147f4d17e56748c4dc
|
| 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 27, 2026.
Transparency logRelease files / gdsfactoryx-9.51.0.post3-py3-none-any.whl
| Download URL | gdsfactoryx-9.51.0.post3-py3-none-any.whl |
|---|---|
| Size | 936.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc52c8d5c665db952cb992089d1b5daa3f7f1f5ae815b6f4de7e91ea0f68ea4e
|
|
BLAKE2b-256 checksum How to use checksums |
e1295d37f835f3289ebc77f0f0a884ed3b038c5d40f64c05714dc8fc3adb45db
|
| 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 27, 2026.
Transparency logSecurity for gdsfactoryx 9.51.0.post3
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.post3.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 27, 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.