CfgData#

class pyedb.configuration.cfg_data.CfgData(pedb=None, **kwargs)#

Runtime container and programmatic builder for pyedb configuration.

Can be instantiated with or without a live EDB session. When pedb is None the object works as a standalone builder for constructing configuration payloads in Python.

Parameters:
pedbEdb, optional

Live EDB session. When supplied, section objects can resolve existing database objects via get helpers.

**kwargs

Configuration section data. Recognised keys: general, boundaries, nets, components, padstacks, pin_groups, terminals, ports, sources, setups, stackup, s_parameters, spice_models, package_definitions, operations, modeler, variables, probes. Unknown keys trigger a UserWarning.

Attributes:
generalCfgGeneral

Global library paths and design flags.

stackupCfgStackup

Materials and layer definitions.

netsCfgNets

Signal and power/ground net classification.

componentsCfgComponents

Component model and package configuration.

padstacksCfgPadstacks

Padstack definitions and instances.

pin_groupsCfgPinGroups

Named pin-group creation.

terminalsCfgTerminals

Explicit low-level terminal objects.

portsCfgPorts

Port excitations.

sourcesCfgSources

Current and voltage source excitations.

probesCfgProbes

Voltage probes.

setupsCfgSetups

HFSS and SIwave simulation setup entries.

boundariesCfgBoundaries

Open-region and extent configuration.

operationsCfgOperations

Cutout and auto HFSS-region operations.

s_parametersCfgSParameters

S-parameter model assignments by component definition.

spice_modelsCfgSpiceModels

SPICE model assignments.

package_definitionsCfgPackageDefinitions

Thermal package definitions.

variablesCfgVariables

Design and project variables.

modelerCfgModeler

Geometry creation and cleanup.

Examples

Standalone construction (no EDB session):

>>> from pyedb.configuration.cfg_data import CfgData
>>> cfg = CfgData()
>>> cfg.nets.add_signal_nets(["SIG1", "CLK"])
>>> cfg.to_json("my_config.json")

From an open EDB session (recommended):

>>> cfg = edb.configuration.create_config_builder()
>>> cfg.general.anti_pads_always_on = False
>>> edb.configuration.run(cfg)

Overview#

from_dict

Create a CfgData from an existing config dictionary.

from_json

Load a CfgData from a JSON file.

from_toml

Load a CfgData from a TOML file.

to_dict

Serialize the full configuration to a plain Python dictionary.

to_json

Write the configuration to a JSON file.

to_toml

Write the configuration to a TOML file.

Import detail#

from pyedb.configuration.cfg_data import CfgData

Attribute detail#

CfgData.general#
CfgData.boundaries#
CfgData.nets#
CfgData.components#
CfgData.padstacks#
CfgData.pin_groups#
CfgData.terminals#
CfgData.ports#
CfgData.sources#
CfgData.setups#
CfgData.stackup#
CfgData.s_parameters#
CfgData.spice_models#
CfgData.package_definitions#
CfgData.operations#
CfgData.modeler#
CfgData.variables#
CfgData.probes#

Method detail#

CfgData.__repr__() str#
CfgData.to_dict() dict#

Serialize the full configuration to a plain Python dictionary.

Only sections that contain at least one value are included; empty sections ({}, [], None) are silently omitted.

Returns:
dict

Configuration payload keyed by section name.

Examples

>>> cfg = CfgData()
>>> cfg.nets.add_signal_nets(["SIG"])
>>> cfg.to_dict()
{'nets': {'signal_nets': ['SIG']}}
CfgData.to_json(file_path: str | pathlib.Path, indent: int = 4) pathlib.Path#

Write the configuration to a JSON file.

Parameters:
file_pathstr or Path

Destination file path.

indentint, optional

JSON indentation level. Default is 4.

Returns:
Path

Resolved path of the written file.

Examples

>>> cfg.to_json("my_project_config.json")
CfgData.to_toml(file_path: str | pathlib.Path) pathlib.Path#

Write the configuration to a TOML file.

Parameters:
file_pathstr or Path

Destination file path.

Returns:
Path

Resolved path of the written file.

Raises:
ImportError

If the toml package is not installed.

Examples

>>> cfg.to_toml("my_project_config.toml")
classmethod CfgData.from_dict(data: dict, pedb=None) CfgData#

Create a CfgData from an existing config dictionary.

Parameters:
datadict

Raw configuration dictionary.

pedbEdb, optional

Live EDB session.

Returns:
CfgData

Populated instance.

Examples

>>> cfg = CfgData.from_dict({"nets": {"signal_nets": ["CLK"]}})
>>> cfg.nets.signal_nets
['CLK']
classmethod CfgData.from_json(file_path: str | pathlib.Path, pedb=None) CfgData#

Load a CfgData from a JSON file.

Parameters:
file_pathstr or Path

Path to a valid JSON configuration file.

pedbEdb, optional

Live EDB session.

Returns:
CfgData

Populated instance.

Examples

>>> cfg = CfgData.from_json("base_config.json")
>>> cfg.general.suppress_pads = True
>>> cfg.to_json("modified_config.json")
classmethod CfgData.from_toml(file_path: str | pathlib.Path, pedb=None) CfgData#

Load a CfgData from a TOML file.

Parameters:
file_pathstr or Path

Path to a valid TOML configuration file.

pedbEdb, optional

Live EDB session.

Returns:
CfgData

Populated instance.

Raises:
ImportError

If the toml package is not installed.

Examples

>>> cfg = CfgData.from_toml("base_config.toml")