4. Printing¶

Printing pconfigs produces documentation of how a system functions: the settings and the functions that are executed.

Suppose you have the following configured system.

from pconfigs import pconfig, pconfiged, pdefaults
from pconfigs.examples.quickstart import ThingConfig

@pconfiged
class System:
    config: SystemConfig

    def run(self):
        print(self.config.mode)
        print(self.config.thing_config)


@pconfig(constructs=System)
class SystemConfig:
    mode: str
    thing_config: ThingConfig


system_config = SystemConfig(
    mode="run",
    thing_config=pdefaults(ThingConfig),
)

Configs can printed with print(), and their code can be generated using repr() as follows.