Skip to content

Configuration

You have 2 ways of configuring gdsfactory:

  1. Use .env files with CONFIG variables

gdsfactory can store settings in a .env file in the current directory or any parent directories. Environment variables do not require any prefix.

You can create a .env file in this directory, restart the notebook and see what CONFIG values you are getting.

difftest_ignore_cell_name_differences=True
difftest_ignore_sliver_differences=False
difftest_ignore_label_differences=False
layer_error_path=[1000, 0]
max_cellname_length=64
connect_use_mirror=False
cell_layout_cache=True
  1. You can import CONF at the beginning of your script and then overwrite any settings.

Here is a list of all the available config fields with their defaults:

Field Default
pdk None
layer_label (100, 0)
difftest_ignore_label_differences False
difftest_ignore_sliver_differences False
difftest_ignore_cell_name_differences True
bend_radius_error_type ErrorType.ERROR
layer_error_path (1000, 0)
layer_marker (205, 0)
connect_use_mirror False
max_cellname_length 64
cell_layout_cache True
port_types ["optical", "electrical", "placement", ...]
port_types_grating_couplers ["vertical_te", "vertical_tm", "vertical_dual"]
exclude_layers None
import gdsfactory as gf



gf.gpdk.PDK.activate()
gf.CONF
Settings(n_threads=4, logfilter=LogFilter(level=<LogLevel.ERROR: 'ERROR'>, regex=None), display_type='image', meta_format='v3', console=<console width=115 ColorSystem.TRUECOLOR>, allow_width_mismatch=False, allow_layer_mismatch=False, allow_type_mismatch=False, allow_undefined_layers=False, cell_layout_cache=True, cell_overwrite_existing=False, connect_use_angle=True, connect_use_mirror=False, check_instances=<CheckInstances.RAISE: 'error'>, check_unnamed_cells=<CheckUnnamedCells.WARNING: 'warning'>, max_cellname_length=64, debug_names=False, write_context_info=True, write_cell_properties=True, write_file_properties=True, write_timestamps=False, write_kfactory_settings=True, multi_xy_records=False, show_function=None, pdk=None, layer_label=(100, 0), difftest_ignore_label_differences=False, difftest_ignore_sliver_differences=False, difftest_ignore_cell_name_differences=True, bend_radius_error_type=<ErrorType.ERROR: 1>, layer_error_path=(1000, 0), layer_marker=(205, 0), port_types=['optical', 'electrical', 'placement', 'vertical_te', 'vertical_tm', 'vertical_dual', 'electrical_rf', 'pad', 'pad_rf', 'bump', 'edge_coupler'], port_types_grating_couplers=['vertical_te', 'vertical_tm', 'vertical_dual'], exclude_layers=None, on_collision='warning', on_placer_error='warning', raise_on_error=False)
gf.CONF.max_cellname_length = 9  # Making the cell name ridiculously short.
c1 = gf.Component("c123456789")
print(c1.name) # The name will only be truncated when saving to GDS
c123456789

As you can see the cell names are truncated when writing them to GDS.

gdspath = c1.write_gds()
c2 = gf.import_gds(gdspath)
print(c2.name)
c12345678