alicatlib.config¶
AlicatConfig and the config_from_env loader. See
Troubleshooting §Timeouts for
tuning guidance and Design §5.18.
alicatlib.config ¶
Core package configuration.
Keeping this as a plain dataclass (rather than pydantic-settings) keeps the
core install free of any validation-library dependency; the tradeoff is that
env coercion lives in :func:config_from_env rather than being automatic.
Design reference: docs/design.md §5.18.
AlicatConfig
dataclass
¶
AlicatConfig(
default_timeout_s=0.5,
multiline_timeout_s=1.0,
write_timeout_s=0.5,
default_baudrate=19200,
drain_before_write=False,
save_rate_warn_per_min=10,
eager_tasks=False,
)
Process-wide default settings.
Individual sessions may override any of these at construction time.
Attributes:
| Name | Type | Description |
|---|---|---|
default_timeout_s |
float
|
Default per-command response timeout for single-line commands, in seconds. |
multiline_timeout_s |
float
|
Default response timeout for multiline table
commands ( |
write_timeout_s |
float
|
Upper bound on a single |
default_baudrate |
int
|
Default serial baudrate when none is specified. |
drain_before_write |
bool
|
Whether the protocol client should drain any stale input bytes before each command. Useful for re-syncing after a timeout; adds latency per command. |
save_rate_warn_per_min |
int
|
EEPROM-wear warning threshold. Any command
carrying a |
eager_tasks |
bool
|
Opt-in to |
config_from_env ¶
Best-effort env loader.
Only reads well-known keys; unknown keys are ignored. Missing or
unparseable values fall back to :class:AlicatConfig's defaults — this
function never raises. Use explicit dataclass construction when you need
strict validation.
Recognised keys (with prefix="ALICATLIB_"):
ALICATLIB_DEFAULT_TIMEOUT_S— float secondsALICATLIB_MULTILINE_TIMEOUT_S— float secondsALICATLIB_WRITE_TIMEOUT_S— float secondsALICATLIB_DEFAULT_BAUDRATE— intALICATLIB_DRAIN_BEFORE_WRITE—"1"/"true"/"yes"ALICATLIB_SAVE_RATE_WARN_PER_MIN— intALICATLIB_EAGER_TASKS—"1"/"true"/"yes"
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Prefix to prepend to each env key. Defaults to |
DEFAULT_ENV_PREFIX
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
AlicatConfig
|
class: |
AlicatConfig
|
unparseable env var. |