DoRoutes

raw JSON →
0.5.0 verified Fri May 01 auth: no python

DoRoutes is an advanced routing library for GDSFactory, providing optimized wire routing and placement algorithms for photonic integrated circuit design. Current version is 0.5.0, with a monthly release cadence.

pip install doroutes
error RuntimeError: Port .* has no width attribute
cause Ports passed to route() lack a 'width' property, required for the routing algorithm.
fix
Add width to ports: e.g., port.width = 0.5 or use GDSFactory's built-in port creation with width.
error AttributeError: module 'doroutes' has no attribute 'core'
cause Trying to import from internal submodules that are not exposed.
fix
Import from the top-level package: from doroutes import route.
error ImportError: cannot import name 'Route' from 'doroutes.routing'
cause The public API moved; submodule no longer exports core classes.
fix
Use from doroutes import Route.
breaking DoRoutes 0.5.0 requires Python >=3.12.0. Older Python versions are not supported.
fix Upgrade Python to 3.12 or later.
deprecated The `doroutes.routing` module is deprecated as of 0.5.0. Import functions from the top-level package instead.
fix Use `from doroutes import route` instead of `from doroutes.routing import route`.
gotcha DoRoutes expects ports to have a 'width' attribute. If missing, route may fail or produce unexpected results.
fix Ensure your components have ports with `width` defined (either via GDSFactory's port system or manually).
gotcha Routing multiple paths in sequence can cause collisions if not carefully planned. DoRoutes does not auto-avoid existing routes by default.
fix Use the `avoid` parameter or manually check for overlaps.

Basic usage: create a component, add references, then route between ports.

import gdsfactory as gf
from doroutes import route

# Create a simple circuit with two components
c = gf.Component()

# Add a waveguide and a taper (simplified for example)
wg = c.add_ref(gf.c.waveguide(length=5))
taper = c.add_ref(gf.c.taper(length=3))
taper.move((10, 0))

# Route between the ports
ports = [wg.ports['opt1'], taper.ports['opt2']]
route(c, ports, layer=(1, 0))

c.show()