CONFIG#
You have 2 ways of configuring gdsfactory:
Use
.env
files with CONFIG variables
gdsfactory can store settings in a .env
file in the current directory or any parent directories.
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=99
kfactory_logfilter_regex='^KLayout GUI version'
kfactory_cell_overwrite_existing=True
You can import CONF in the beginning of your script and then overwrite any settings.
import gdsfactory as gf
gf.CONF
Settings(n_threads=4, logfilter=LogFilter(level=<LogLevel.INFO: 'INFO'>, 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=<CHECK_INSTANCES.RAISE: 'error'>, max_cellname_length=32, debug_names=False, write_cell_properties=True, write_context_info=True, write_file_properties=True, show_function=None, 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), pdk='generic', layer_label=(100, 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'])
gf.CONF.max_cellname_length = 9 # making the cell name ridiculously short
c1 = gf.Component("Example_long_name_123456789")
print(c1.name)
Example_long_name_123456789
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)
Example_l