chore: implement yaml settings inheritance#618
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #618 +/- ##
==========================================
+ Coverage 83.63% 83.78% +0.14%
==========================================
Files 232 238 +6
Lines 19826 19990 +164
Branches 2714 2735 +21
==========================================
+ Hits 16582 16749 +167
+ Misses 2644 2642 -2
+ Partials 600 599 -1
|
msbrogli
requested changes
May 19, 2023
32b1a34 to
5533c70
Compare
msbrogli
previously approved these changes
May 19, 2023
5533c70 to
7abde54
Compare
jansegre
reviewed
May 22, 2023
9a41c03 to
0bd2a67
Compare
jansegre
previously approved these changes
May 23, 2023
jansegre
approved these changes
May 24, 2023
msbrogli
approved these changes
May 24, 2023
17eacb2 to
688c29b
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Acceptance Criteria
deep_merge()dict utils functionvalidated_named_tuple_from_dict()utils functiondict_from_extended_yaml()utils function, allowing parsing of extensible yaml filesdict_from_yaml()utils function, adding error handlingHathorSettingsparsing to use new utils functionsThis change resolves #614. Now, yaml settings support an inheritance mechanism that can be used to create custom configurations by changing just a subset of settings attributes.
For example, in the
hathor/conf/my_network.ymlfile:Then, if this file is set in
--config-yamlorHATHOR_CONFIG_YAML, settings would behave exactly like mainnet settings, and only theNETWORK_NAMEwould be changed. Changing specific nested attributes is also supported.Both relative and absolute file paths are supported (relative from the yaml file location, or from a custom root if the
custom_rootarg is set).