bittensor/config.py: improvements #2222
Closed
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.
Bug
bt.config()
with default kwargs and it will not complain. This leads to confusion.bt.config()
does some special magic that kills therequired=True
feature of argparse; it will complain that the argument is not set, even when it is set. This leads to devs implementing workarounds such as setting semi-random default values and/or additional post-argparse checks that could/should already be done in argparse.Description of the Change
strict=True
by default, so issues are easier to catchAlternate Designs
Rework
bt.config
, as it is not clear what it intends to add to argparse, that already supports tons of features.Possible Drawbacks
People may experience code not starting anymore because they supply unknown arguments that now lead to errors due to strict checking. This is intended. Having non-functional arguments is not useful and confusing.
Verification Process
I tested this on some bittensor code I'm writing right now, by adding a
required=True
argument and observing that the argument is now required and that the code doesn't bail out on a supposedly missing argument. I tested to see that I now cannot add--whatevercrapinsertedhere
without argparse complaining about an unknown arg.Release Notes
N/A