Data Types¶
confkit uses a family of small converter classes to provide type safety and round‑trip serialization.
Base Type¶
BaseDataTypeBaseDataType.convertBaseDataType.validateBaseDataType.castBaseDataType.cast_optional
Primitive Converters¶
Enum Converters¶
All enum types automatically display allowed values as inline comments in the config file, making them self-documenting for end-users. For example:
log_level = info # allowed: debug, info, warning, error
The format varies by enum type:
- StrEnum: Shows member values (e.g., debug, info, warning, error)
- IntEnum/IntFlag: Shows member names with integer values (e.g., LOW(0), MEDIUM(5), HIGH(10))
- Enum: Shows member names (e.g., DEBUG, INFO, WARNING, ERROR)
Comments are automatically stripped when reading values, ensuring they don't interfere with parsing.
Number Representation Helpers¶
Optional & Composite¶
Design note:
Optionalwraps anotherBaseDataTypeand returnsNonewhen a null sentinel is parsed.
Collections¶
Tuple, Set, and Dict mirror their built‑in counterparts. Allowing for collections to be stored in INI files.
Date & Time¶
DateTime, Date, Time and TimeDelta mirror their built-in counterparts. Allowing to store date information in INI files.