Conf
conf
Kfactory configuration.
LogFilter
pydantic-model
Bases: BaseModel
Filter certain messages by log level or regex.
Filtered messages are not evaluated and discarded.
Fields:
-
level(LogLevel) -
regex(str | None)
Source code in kfactory/conf.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
__call__
__call__(record: Record) -> bool
Loguru needs the filter to be callable.
Source code in kfactory/conf.py
160 161 162 163 164 165 166 167 | |
LogLevel
Bases: StrEnum
KFactory logger levels.
Source code in kfactory/conf.py
126 127 128 129 130 131 132 133 134 135 | |
PROPID
Bases: IntEnum
Mapping for GDS properties.
Source code in kfactory/conf.py
60 61 62 63 64 65 66 | |
NAME
class-attribute
instance-attribute
NAME = 0
Instance name.
PURPOSE
class-attribute
instance-attribute
PURPOSE = 1
Instance purpose (e.g. 'routing').
Settings
Bases: BaseSettings
KFactory settings object.
Attrs
n_threads: Number of threads to use for tiling processor, defaults to all available cores. logger: The loguru class to use for logging. Shouldn't be necessary to configure by hand. logfilter: The filter to use. Can be configured to set log level and filter messages by regex. display_type: The type of image to show when calling the jupyter display function. meta_format: Metadata format to use for reading KLayout metadata. If set to 'default', metadata will be read as instances such as Trans/DCplxTrans. If the metadata is in the old string format (there was a bug in how to read metadata in some versions), use 'string'. console: The rich console to use for displaying rich content. max_cellname_length: The maximum length of a cell name.
Source code in kfactory/conf.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
display_type
class-attribute
instance-attribute
display_type: Literal['widget', 'image'] = 'image'
The default behavior for displaying cells in jupyter.
logfilter
class-attribute
instance-attribute
logfilter: LogFilter = Field(default_factory=LogFilter)
Can configure the logger to ignore certain levels or by regex.
meta_format
class-attribute
instance-attribute
meta_format: Literal['v3', 'v2', 'v1'] = 'v3'
The format of the saving of metadata.
Transformations and other KLayout objects are stored as a string. In
case of ports they are converted back to KLayout objects on read.
v2: All objects can be stored in the nativ KLayout format (klayout>=0.28.13)
n_threads
class-attribute
instance-attribute
n_threads: int = get_affinity()
Number of threads to use for multithreaded operations.
project_dir
cached
property
project_dir: Path | None
Find the current working directory's project dir.
This is the git repo if it exists, cwd otherwise.
write_kfactory_settings
class-attribute
instance-attribute
write_kfactory_settings: bool = True
Write kfactory version into the gds/oasis.
__init__
__init__(**data: Any) -> None
Set log filter and run pydantic.
Source code in kfactory/conf.py
342 343 344 | |
add_traceback
add_traceback(record: Record) -> None
Add a traceback to the logger.
Source code in kfactory/conf.py
93 94 95 96 97 98 99 | |
get_affinity
get_affinity() -> int
Get number of cores/threads available.
On (most) linux we can get it through the scheduling affinity. Otherwise, fall back to the multiprocessing cpu count.
Source code in kfactory/conf.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
tracing_formatter
tracing_formatter(record: Record) -> str
Traceback filtering.
Filter out frames coming from Loguru internals.
Source code in kfactory/conf.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |