Simplify debugging of configuration errors during setup #479
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.
Simplify configuration failure tracebacks
This PR is the primary resolution of #251 in that it allows for the passing of the class name that validates a configuration dictionary so that an errors also include the source class. Inclusion of the source model's class name allows a user to refer back to their configuration file and locate the offending or missing parameters in the specific model section. Paired with #468, the connection is direct because it removes the obfuscation of the offending class by enforcing users to list the actual model class rather than a short hand reference.
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO:
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.mdhas been updated to describe the changes made in this PRSection 3: Related Issues
#251
Section 4: Impacted Areas of the Software
Section 4.1: New Files
N/A
Section 4.2: Modified Files
h2integrate/core/utilities.pyBaseConfig: Adds the optional keyword argumentadditional_cls_nameand modifies the error message depending on the usage.h2integrate/core/test/test_utilities.py: Adds demo classes and tests forBaseConfig.from_dict().XXConfig.from_dict(config, additional_cls_name=self.__class__.__name__)to ensure the child class always shows up in the traceback.Section 5: Additional Supporting Information
Please refer to #251 for further details and discussion.
Section 6: Test Results, if applicable
Tests pass, including newly added tests.
Section 7 (Optional): New Model Checklist
docs/developer_guide/coding_guidelines.mdattrsclass to define theConfigto load in attributes for the modelBaseConfigorCostModelBaseConfiginitialize()method,setup()method,compute()methodCostModelBaseClasssupported_models.pycreate_financial_modelinh2integrate_model.pytest_all_examples.pydocs/user_guide/model_overview.mddocs/section<model_name>.mdis added to the_toc.yml