Skip to content

Conversation

@kjsanger
Copy link
Member

@kjsanger kjsanger commented Jul 8, 2025

Where dataclasses declare the type of a field, parse the INI file value to that type, if possible. Also parse environment variable fallback values.

Support int, float, bool and pathlib.Path

Where dataclasses declare the type of a field, parse the INI file
value to that type, if possible. Also parse environment variable
fallback values.

Support int, float, bool and pathlib.Path
@kjsanger kjsanger force-pushed the feature/parse-declared-types branch 2 times, most recently from 816cf12 to cb04389 Compare July 8, 2025 20:49
If a dataclass declares fields of a builtin type (int, float, bool),
IniData will attempt parse values into the correct type. It will also
parse Optional[] and pathlib.Path, where that is declared. Both values
in INI files and from the environment are supported.

The parsing methods may be overridden to create custom parsers.
@kjsanger kjsanger force-pushed the feature/parse-declared-types branch from cb04389 to 71aad88 Compare July 8, 2025 20:57
@nerdstrike nerdstrike self-requested a review July 9, 2025 10:14
Copy link

@nerdstrike nerdstrike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good. Two options to change if you think appropriate.

@kjsanger kjsanger merged commit 2953e9f into wtsi-npg:devel Jul 9, 2025
4 checks passed
@kjsanger kjsanger deleted the feature/parse-declared-types branch July 9, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants