gdsfactoryplus

GDSFactoryplus python library.

Modules:

Name Description
bbox

Generate cell bbox.

cli

GDSFactory+ CLI.

cli_test

Test Component Builds.

core

Core GDSFactory+ utilities.

deduplicate

Deduplication decorator.

export_spice

Uses VLSIRTools to convert from Klayout's DB Netlist to common spice formats.

freeze

Freeze a python cell as schematic netlist.

generate_svg

Generate SVG from cell.

logger

GDSFactory+ Logger.

models

GDSFactory+ Pydantic models.

project

Find the GDSFactory+ project folder.

serve

GDSFactory+ Server.

settings

Parse the GDSFactory+ settings.

show

General Show function.

show3d

3D viewer.

show_cell

Show a python object in a vscode panel.

simulate

Simulate a factory.

version

Simply the GDSFactory+ version.

Classes:

Name Description
ApiSettings

API Settings.

Arange

An array range definition.

DrcSettings

DRC Settings.

ExternalSettings

External Settings.

FrozenPdk

A frozen PDK that prevents modification of its attributes.

GptSettings

GPT Settings.

KwebSettings

Kweb Settings.

Linspace

A linear spacing definition.

LogSettings

Logging settings.

PdkSettings

PDK Settings.

ProjectSettings

Settings.

Settings

Settings.

SimSettings

Simulation Settings.

Functions:

Name Description
activate_pdk_by_name

Activate a PDK by name (deprecated).

add_components

Add multiple components to the database simultaneously.

add_factories

Add multiple factories to the database.

add_models

Add multiple models to the database.

build_by_names

Build multiple GDS cells by names.

check_conn

Run connectivity check on the given GDS file.

check_drc

Run DRC check on the given GDS file.

clear_cells_from_cache

Clear cells from cache by factory names.

cli_environment

Get a CLI environment.

create_callgraph

Create a directed graph from the call graph data.

default_lib_paths

Return default library paths.

extract_function_arguments

Extract function arguments and serialize them as JSON.

find_models

Find all models in the current project.

find_partial_definition

Find a partial function definition.

find_project_dir

Find the GDSFactory+ project folder.

generate_multipolygon

Generate a MultiPolygon from a component.

get_all_factories

Get all factory records from the database.

get_all_factory_names

Get all factory names from the database.

get_all_models

Get all model records from the database.

get_base_pdk

Get the base PDK, which is the generic PDK.

get_base_schema

Get base netlist schema.

get_build_dir

Get the build directory.

get_cells_from_regex

Find all cells in a python file decorated with @cell using a regex.

get_components_by_factories

Get all component records belonging to specific factories.

get_db_path

Get the path to the database.

get_factories_by_components

Get factory records for multiple components.

get_factories_by_idxs

Get factory records by their kcl indices.

get_factories_by_name

Get multiple factory records by their names.

get_factories_by_source

Get factory names for each given source file.

get_factory_sources_by_name

Get source file paths for multiple factories by their names.

get_gds_dir

Get the output GDS directory.

get_log_dir

Get the log directory.

get_logger

Get the GDSFactory+ logger.

get_model_sources_by_name

Get source file paths for multiple models by their factory names.

get_models_by_name

Get multiple model records by their factory names.

get_netlist_schema

Get the schema for a specific netlist.

get_pdk

Import a PDK by name.

get_pdk_name

Get the name of the pdk used in the project.

get_pics_dir

Get the PICs directory.

get_ports

Get the ports from a component.

get_project_dir

Get the project root directory.

get_project_name

Get the name of the project.

get_runtime_factories_dependency_graph

Get a dependency graph for multiple factories.

get_runtime_factory_dependencies

Get the dependencies of a factory.

get_schematic_recnet

Get a schematic record netlist.

get_settings

Get the gdsfactoryplus settings.

get_static_records

Get static records from a call graph.

get_svg

Get the (possible cached) svg for a cell.

get_tags_for_cell

Get tags from a cell.

get_wls

Get the wavelengths used in the project.

get_ws_port

Get the websocket port from the project directory.

ignore_prints

Ignore any output to stdout or stderr.

ignored_paths

Get paths to ignore.

import_modules

Import all modules from a given directory.

import_path

Import a module from a given path.

import_picyml

Import a yaml file as a module.

is_a_pdk

Check if the settings are for a pdk or a project.

lazy_import

Lazily import a module.

lazy_setattr

Lazily set an attribute on a LazyModule.

maybe_find_project_dir

Maybe find the GDSFactory+ project folder.

merge_rdb_strings

Merge RDB Strings.

none

Serialize as None.

parse_oc_spice

Parse OC spice.

plot_callgraph

Plot a call graph.

print_to_file

Print content to a file.

register_cells

Register PDK cells.

register_models

Register all models in the current project.

remove_components

Remove multiple components from the database simultaneously.

remove_components_by_factories

Remove all components belonging to specific factories from the database.

remove_factories

Remove multiple factories and all their child components from the database.

remove_factories_by_source

Remove factories from the database by their source.

remove_models

Remove multiple models from the database.

reset_timestamps

Reset the timestamps of all factories to the current time.

resolve_modname

Resolve the module name from a given path.

send_message

Send a message to vscode.

set_all_factories_has_model

Set the has_model field for all factories in the database.

set_factories_has_model_by_names

Set the has_model field for multiple factories by their names.

set_factories_status_by_names

Modify the status of multiple factories by their names.

sync_from_kcl

Sync all cells from gf.kcl into the components table of the database.

try_func

Try to execute a function and return the result.

unlazy

Get the underlying object of a lazy import.

validate_access

Validates the API key and returns the license information.

ApiSettings

Bases: BaseSettings

API Settings.

Arange

Bases: BaseSettings

An array range definition.

Attributes:

Name Type Description
arr NDArray[float64]

Create array from arange definition.

num int

Get number of elements.

arr property

Create array from arange definition.

num property

num: int

Get number of elements.

DrcSettings

Bases: BaseSettings

DRC Settings.

ExternalSettings

Bases: BaseSettings

External Settings.

Methods:

Name Description
validate_axiomatic_api_key

Get the axiomatic API key from the environment variable.

validate_axiomatic_api_key

validate_axiomatic_api_key() -> Self

Get the axiomatic API key from the environment variable.

FrozenPdk

Bases: Pdk

A frozen PDK that prevents modification of its attributes.

GptSettings

Bases: BaseSettings

GPT Settings.

KwebSettings

Bases: BaseSettings

Kweb Settings.

Linspace

Bases: BaseSettings

A linear spacing definition.

Attributes:

Name Type Description
arr NDArray[float64]

Create array from linspace definition.

step float

Get step between elements.

arr property

Create array from linspace definition.

step property

step: float

Get step between elements.

LogSettings

Bases: BaseSettings

Logging settings.

PdkSettings

Bases: BaseSettings

PDK Settings.

ProjectSettings

Bases: BaseSettings

Settings.

Methods:

Name Description
settings_customise_sources

Read the [project] section of the pyproject.toml.

settings_customise_sources classmethod

settings_customise_sources(
    settings_cls: type[BaseSettings],
    init_settings: PydanticBaseSettingsSource,
    env_settings: PydanticBaseSettingsSource,
    dotenv_settings: PydanticBaseSettingsSource,
    file_secret_settings: PydanticBaseSettingsSource,
) -> tuple[PydanticBaseSettingsSource, ...]

Read the [project] section of the pyproject.toml.

Settings

Bases: BaseSettings

Settings.

Methods:

Name Description
is_a_pdk

Check if the settings are for a pdk or a project.

settings_customise_sources

Add global gdsfactoryplus.toml and local pyproject.toml to the sources.

is_a_pdk

is_a_pdk() -> bool

Check if the settings are for a pdk or a project.

settings_customise_sources classmethod

settings_customise_sources(
    settings_cls: type[BaseSettings],
    init_settings: PydanticBaseSettingsSource,
    env_settings: PydanticBaseSettingsSource,
    dotenv_settings: PydanticBaseSettingsSource,
    file_secret_settings: PydanticBaseSettingsSource,
) -> tuple[PydanticBaseSettingsSource, ...]

Add global gdsfactoryplus.toml and local pyproject.toml to the sources.

SimSettings

Bases: BaseSettings

Simulation Settings.

activate_pdk_by_name

activate_pdk_by_name(name: str) -> Pdk

Activate a PDK by name (deprecated).

Parameters:

Name Type Description Default
name str

Name of the PDK to activate. (deprecated, will be ignored)

required

Returns:

Type Description
Pdk

gf.Pdk: The activated PDK object.

add_components

add_components(*records: ComponentRecord) -> None

Add multiple components to the database simultaneously.

Parameters:

Name Type Description Default
records ComponentRecord

ComponentRecord objects containing component information.

()

add_factories

add_factories(*records: FactoryRecord, update_last_modified: bool = True) -> None

Add multiple factories to the database.

Parameters:

Name Type Description Default
records FactoryRecord

FactoryRecord objects containing factory information.

()
update_last_modified bool

If True, updates the last_updated timestamp to current time. If False, preserves existing timestamp or uses default.

True

add_models

add_models(*records: ModelRecord) -> None

Add multiple models to the database.

Parameters:

Name Type Description Default
records ModelRecord

ModelRecord objects containing model information.

()

build_by_names

build_by_names(*names: str, with_metadata: bool = True) -> None

Build multiple GDS cells by names.

Parameters:

Name Type Description Default
names str

List of cell names to build.

()
with_metadata bool

Whether to include metadata in the GDS files.

True

check_conn

check_conn(path: str | Path, *, verbose: bool = True) -> str

Run connectivity check on the given GDS file.

Parameters:

Name Type Description Default
path str | Path

path to the GDS file to run the check on.

required
verbose bool

if True, print status messages to stderr.

True

check_drc

check_drc(
    path: str | Path,
    pdk: str = pdk or name,
    process: str = process,
    timeout: int = timeout,
    host: str = host,
    api_key: str = key,
    *,
    verbose: bool = True,
) -> str

Run DRC check on the given GDS file.

Parameters:

Name Type Description Default
path str | Path

path to the GDS file to run the check on.

required
pdk str

PDK to use for the check.

pdk or name
process str

the drc rules might be slightly different depending on the process

process
timeout int

timeout in seconds for the check (DRC only).

timeout
host str

api host (DRC only).

host
api_key str

the api key (DRC only).

key
verbose bool

if True, print status messages to stderr.

True
Note

the connectivity check runs locally, so for this check the api parameters timeout, host, api_key will be ignored.

clear_cells_from_cache

clear_cells_from_cache(*factory_names: str, remove_unnamed: bool = True) -> list[int]

Clear cells from cache by factory names.

cli_environment

cli_environment(*, no_stdout: bool, no_stderr: bool) -> Iterator[None]

Get a CLI environment.

create_callgraph

create_callgraph(
    graph_data: dict | None = None, /, *, lib_paths: dict[str, Path] | None = None
) -> DiGraph

Create a directed graph from the call graph data.

Parameters:

Name Type Description Default
graph_data dict | None

Optional pre-generated call graph data.

None
lib_paths dict[str, Path] | None

module name -> library path mapping of all relevant python libraries.

None

default_lib_paths cached

default_lib_paths() -> dict[str, Path]

Return default library paths.

extract_function_arguments

extract_function_arguments(func: Callable) -> dict

Extract function arguments and serialize them as JSON.

Parameters:

Name Type Description Default
func Callable

The function to extract arguments from.

required

Returns:

Type Description
dict

JSON string in format {argument_name: default_value} or None if extraction fails.

dict

Arguments without defaults have None as default.

dict

*args and **kwargs are ignored.

find_models

find_models(lib_paths: dict[str, Path] | None = None) -> dict[str, ModelRecord]

Find all models in the current project.

Parameters:

Name Type Description Default
lib_paths dict[str, Path] | None

module name -> library path mapping of all relevant python libraries.

None

Returns:

Type Description
dict[str, ModelRecord]

dict[str, ModelRecord]: mapping of model names to their records.

find_partial_definition

find_partial_definition(partial_name: str) -> Path | None

Find a partial function definition.

Parameters:

Name Type Description Default
partial_name str

Name of the partial function to find.

required
dirpath

Directory path to search in.

required

Returns:

Type Description
Path | None

Path to the file containing the partial definition, or None if not found.

find_project_dir

find_project_dir() -> Path

Find the GDSFactory+ project folder.

Returns:

Type Description
Path

The path to the GDSFactory+ project folder.

Raises:

Type Description
FileNotFoundError

if no project dir is found.

generate_multipolygon

generate_multipolygon(comp: Component) -> MultiPolygon

Generate a MultiPolygon from a component.

get_all_factories

get_all_factories() -> dict[str, FactoryRecord]

Get all factory records from the database.

Returns:

Type Description
dict[str, FactoryRecord]

Dict mapping factory names to their FactoryRecord objects.

get_all_factory_names

get_all_factory_names() -> list[str]

Get all factory names from the database.

get_all_models

get_all_models() -> dict[str, ModelRecord]

Get all model records from the database.

Returns:

Type Description
dict[str, ModelRecord]

Dict mapping factory names to their ModelRecord objects.

get_base_pdk cached

get_base_pdk() -> Pdk | FrozenPdk

Get the base PDK, which is the generic PDK.

Returns:

Type Description
Pdk | FrozenPdk

gf.Pdk: The base PDK object.

get_base_schema

get_base_schema() -> Schema

Get base netlist schema.

get_build_dir

get_build_dir() -> Path

Get the build directory.

get_cells_from_regex

get_cells_from_regex(path: Path) -> list[str]

Find all cells in a python file decorated with @cell using a regex.

Parameters:

Name Type Description Default
path Path

the path to the python file.

required

get_components_by_factories

get_components_by_factories(*factory_names: str) -> dict[str, list[ComponentRecord]]

Get all component records belonging to specific factories.

Parameters:

Name Type Description Default
factory_names str

Names of the factories to get components for.

()

Returns:

Type Description
dict[str, list[ComponentRecord]]

List of ComponentRecords that belong to the specified factories.

get_db_path

get_db_path() -> Path

Get the path to the database.

get_factories_by_components

get_factories_by_components(*components: str) -> dict[str, FactoryRecord]

Get factory records for multiple components.

Parameters:

Name Type Description Default
components str

Names of components to get factories for.

()

Returns:

Type Description
dict[str, FactoryRecord]

List of FactoryRecord objects for the components' factories.

dict[str, FactoryRecord]

Components with missing factories are skipped.

get_factories_by_idxs

get_factories_by_idxs(*idxs: int) -> dict[int, FactoryRecord]

Get factory records by their kcl indices.

Parameters:

Name Type Description Default
idxs int

KCL indices of the factories.

()

Returns:

Type Description
dict[int, FactoryRecord]

List of FactoryRecord objects for the factories. Skips any not found.

get_factories_by_name

get_factories_by_name(*names: str) -> dict[str, FactoryRecord]

Get multiple factory records by their names.

Parameters:

Name Type Description Default
names str

Names of the factories to get.

()

Returns:

Type Description
dict[str, FactoryRecord]

Dict mapping factory names to their FactoryRecord objects.

dict[str, FactoryRecord]

Raises ValueError if any factory not found.

get_factories_by_source

get_factories_by_source(*sources: Path | str) -> dict[str, list[str]]

Get factory names for each given source file.

Parameters:

Name Type Description Default
sources Path | str

Source file paths to match factories.

()

Returns:

Type Description
dict[str, list[str]]

Dict mapping each source path (as relative string) to a list of

dict[str, list[str]]

factory names using that source.

get_factory_sources_by_name

get_factory_sources_by_name(*names: str) -> dict[str, Path]

Get source file paths for multiple factories by their names.

Parameters:

Name Type Description Default
names str

Names of the factories to get sources for.

()

Returns:

Type Description
dict[str, Path]

Dict mapping factory names to their source file paths.

dict[str, Path]

Source paths are relative to project root, or None if not found.

get_gds_dir

get_gds_dir() -> Path

Get the output GDS directory.

get_log_dir

get_log_dir() -> Path

Get the log directory.

get_logger cached

get_logger(source: str = 'server') -> Logger

Get the GDSFactory+ logger.

get_model_sources_by_name

get_model_sources_by_name(*names: str) -> dict[str, Path]

Get source file paths for multiple models by their factory names.

Parameters:

Name Type Description Default
names str

Names of the factories to get model sources for.

()

Returns:

Type Description
dict[str, Path]

Dict mapping factory names to their source file paths.

dict[str, Path]

Source paths are relative to project root, or None if not found.

get_models_by_name

get_models_by_name(*names: str) -> dict[str, ModelRecord]

Get multiple model records by their factory names.

Parameters:

Name Type Description Default
names str

Names of the factories to get models for.

()

Returns:

Type Description
dict[str, ModelRecord]

Dict mapping factory names to their ModelRecord objects.

dict[str, ModelRecord]

Raises ValueError if any model not found.

get_netlist_schema

get_netlist_schema(netlist: dict) -> Schema

Get the schema for a specific netlist.

get_pdk

get_pdk() -> Pdk

Import a PDK by name.

Returns:

Type Description
Pdk

gf.Pdk: The imported PDK object.

Raises:

Type Description
ImportError

If the specified PDK cannot be found.

get_pdk_name

get_pdk_name() -> str

Get the name of the pdk used in the project.

Returns:

Name Type Description
str str

Name of the PDK.

Raises:

Type Description
RuntimeError

If the PDK name is not set in the project settings.

get_pics_dir

get_pics_dir() -> Path

Get the PICs directory.

get_ports

get_ports(comp: str, **kwargs: Any) -> dict[str, str]

Get the ports from a component.

Parameters:

Name Type Description Default
comp str

Name of the component to get ports from.

required
**kwargs Any

Additional keyword arguments.

{}

Returns:

Type Description
dict[str, str]

A dictionary mapping port names to their directions.

get_project_dir

get_project_dir() -> Path

Get the project root directory.

get_project_name

get_project_name() -> str

Get the name of the project.

get_runtime_factories_dependency_graph

get_runtime_factories_dependency_graph(*names: str) -> DiGraph

Get a dependency graph for multiple factories.

Parameters:

Name Type Description Default
names str

Names of the factories to build the dependency graph for.

()

Returns:

Type Description
DiGraph

NetworkX DiGraph with factory dependencies. Edges represent dependencies

DiGraph

where an edge from A to B means A depends on B (B is a child of A).

get_runtime_factory_dependencies

get_runtime_factory_dependencies(name: str) -> tuple[list[str], list[str]]

Get the dependencies of a factory.

Parameters:

Name Type Description Default
name str

Name of the factory to get dependencies for.

required

Returns:

Type Description
tuple[list[str], list[str]]

Tuple of lists of factory names: (parents, children)

get_schematic_recnet

get_schematic_recnet(name: str) -> dict

Get a schematic record netlist.

Parameters:

Name Type Description Default
name str

name of the factory.

required

Returns:

Name Type Description
recnet dict

recursive netlist.

get_settings cached

get_settings() -> Settings

Get the gdsfactoryplus settings.

get_static_records

get_static_records(
    G: DiGraph | None = None, /, *, paths: Iterable[Path] = ()
) -> dict[str, FactoryRecord]

Get static records from a call graph.

Parameters:

Name Type Description Default
G DiGraph | None

the call graph to extract records from (will be generated if not given).

None
paths Iterable[Path]

list of paths to filter the records by. If empty, reutrns all records.

()

Returns:

Type Description
dict[str, FactoryRecord]

A dictionary mapping factory names to their corresponding FactoryRecord.

get_svg cached

get_svg(comp: Component, width: int, height: int, theme: str = 'dark') -> str

Get the (possible cached) svg for a cell.

get_tags_for_cell

get_tags_for_cell(cell_name: str) -> list[str]

Get tags from a cell.

get_wls

get_wls() -> Linspace | Arange

Get the wavelengths used in the project.

get_ws_port

get_ws_port() -> int

Get the websocket port from the project directory.

ignore_prints

ignore_prints(*, stdout: bool = True, stderr: bool = False) -> Iterator[None]

Ignore any output to stdout or stderr.

ignored_paths

ignored_paths() -> list[Path]

Get paths to ignore.

import_modules

import_modules(
    *, reload: bool = False, paths: Iterable[Path] = (), from_project: bool = True
) -> tuple[dict[Path, ModuleType], dict[Path, tuple[str, Exception]]]

Import all modules from a given directory.

Parameters:

Name Type Description Default
reload bool

If True, reloads the modules if they are already imported.

False
paths Iterable[Path]

An iterable of paths of specific files to import. If empty, all Python files in the pics_dir will be imported.

()
from_project bool

If True, only imports modules from the project directory.

True

Returns:

Type Description
tuple[dict[Path, ModuleType], dict[Path, tuple[str, Exception]]]

list[ModuleType]: A list of imported modules.

Raises:

Type Description
NotADirectoryError

If the given path is not a directory.

import_path

import_path(path: Path, *, reload: bool = False) -> ModuleType

Import a module from a given path.

Parameters:

Name Type Description Default
path Path

The path to the module or package.

required
reload bool

If True, reloads the module if it is already imported.

False

Returns:

Name Type Description
ModuleType ModuleType

The imported module.

import_picyml

import_picyml(
    path: Path, module_name: str | None = None, *, reload: bool = False
) -> ModuleType

Import a yaml file as a module.

Parameters:

Name Type Description Default
path Path

the path to the yaml file.

required
module_name str | None

the name of the module to create (if not given, derive from path).

None
reload bool

whether to reload the module if it was already imported.

False

Returns:

Name Type Description
ModuleType ModuleType

The imported module.

is_a_pdk

is_a_pdk() -> bool

Check if the settings are for a pdk or a project.

lazy_import

lazy_import(module_name: str, *callables: str) -> Any

Lazily import a module.

lazy_setattr

lazy_setattr(module_with_attrs: str, value: Any) -> None

Lazily set an attribute on a LazyModule.

maybe_find_project_dir

maybe_find_project_dir() -> Path | None

Maybe find the GDSFactory+ project folder.

Returns:

Type Description
Path | None

The path to the GDSFactory+ project folder or None if not found.

merge_rdb_strings

merge_rdb_strings(*xml_strings: str) -> str

Merge RDB Strings.

none

none(_: Any) -> None

Serialize as None.

parse_oc_spice

parse_oc_spice(
    path_or_buf: str | Path,
    settings_keymap: dict[str, Any] | None = None,
    component_map: dict[str, Any] | None = None,
    **kwargs: Any,
) -> dict[str, Any]

Parse OC spice.

plot_callgraph

plot_callgraph(G: DiGraph, /, *, prog: str = 'neato', show: bool = True) -> None

Plot a call graph.

Parameters:

Name Type Description Default
G DiGraph

the call graph to plot

required
prog str

the graphviz program to use for layout (e.g., 'neato', 'dot')

'neato'
show bool

whether to show the plot

True

print_to_file

print_to_file(path: str, value: str) -> None

Print content to a file.

register_cells

register_cells(
    *, paths: Iterable[Path] = (), reload: bool = True
) -> tuple[list[str], list[str]]

Register PDK cells.

Parameters:

Name Type Description Default
paths Iterable[Path]

Paths to Python modules containing PDK cells. If empty, it will import all modules.

()
reload bool

Whether to reload the modules we're importing from.

True

Returns:

Type Description
tuple[list[str], list[str]]

tuple[list[str], list[str]]: - List of names of newly registered cells. - List of names of deleted cells.

register_models

register_models(
    G: DiGraph | None = None, /, *, reload: bool = True
) -> tuple[list[str], list[str]]

Register all models in the current project.

Parameters:

Name Type Description Default
G DiGraph | None

(optional) the call graph to extract factory dependencies from.

None
reload bool

Whether to reload the modules containing the models.

True

Returns:

Type Description
tuple[list[str], list[str]]

tuple[list[str], list[str]]: - List of names of newly registered models. - List of names of deleted models.

remove_components

remove_components(*names: str) -> None

Remove multiple components from the database simultaneously.

Parameters:

Name Type Description Default
names str

List of component names to remove.

()

remove_components_by_factories

remove_components_by_factories(*factory_names: str) -> None

Remove all components belonging to specific factories from the database.

Parameters:

Name Type Description Default
factory_names str

Names of factories whose components should be removed.

()

remove_factories

remove_factories(*names: str) -> None

Remove multiple factories and all their child components from the database.

Parameters:

Name Type Description Default
names str

Names of the factories to remove.

()

remove_factories_by_source

remove_factories_by_source(*sources: Path | str) -> list[str]

Remove factories from the database by their source.

Parameters:

Name Type Description Default
sources Path | str

Source file paths to match factories for removal.

()

Returns:

Type Description
list[str]

List of factory names that were removed.

remove_models

remove_models(*names: str) -> None

Remove multiple models from the database.

Parameters:

Name Type Description Default
names str

Names of the models to remove.

()

reset_timestamps

reset_timestamps() -> None

Reset the timestamps of all factories to the current time.

resolve_modname

resolve_modname(path: Path) -> str

Resolve the module name from a given path.

send_message

send_message(message: Message) -> None

Send a message to vscode.

set_all_factories_has_model

set_all_factories_has_model(*, has_model: bool) -> None

Set the has_model field for all factories in the database.

Parameters:

Name Type Description Default
has_model bool

Boolean value to set for the has_model field.

required

set_factories_has_model_by_names

set_factories_has_model_by_names(*names: str, has_model: bool) -> None

Set the has_model field for multiple factories by their names.

Parameters:

Name Type Description Default
names str

Names of the factories to modify.

()
has_model bool

Boolean value to set for the has_model field.

required

set_factories_status_by_names

set_factories_status_by_names(*names: str, status: str) -> None

Modify the status of multiple factories by their names.

Parameters:

Name Type Description Default
names str

Names of the factories to modify.

()
status str

New status to set for the factories.

required

sync_from_kcl

sync_from_kcl() -> None

Sync all cells from gf.kcl into the components table of the database.

try_func

try_func(
    func: F | None = None,
    /,
    *,
    default: Any = None,
    default_factory: Callable | None = None,
) -> F

Try to execute a function and return the result.

Parameters:

Name Type Description Default
func F | None

The function to execute.

None
default Any

Default value to return if the function raises an exception.

None
default_factory Callable | None

Optional callable to generate a default value.

None

Returns:

Name Type Description
Callable F

A wrapped function that returns the result or a default value.

unlazy

unlazy(obj: Any) -> Any

Get the underlying object of a lazy import.

validate_access

validate_access(
    pdk_name: str,
    api_key: str = "",
    pdk_key: str = "",
    *,
    check_pdk_access: bool = False,
) -> dict[str, Any]

Validates the API key and returns the license information.

Parameters:

Name Type Description Default
pdk_name str

Name of the PDK to check access for.

required
api_key str

API key to validate.

''
pdk_key str

PDK secret key to validate.

''
check_pdk_access bool

Whether to check access to the specified PDK.

False
On This Page