traitlets
traitlets copied to clipboard
Fix Container.from_string
Closes: #645
It looks like #645 might actually be a slightly bigger problem than it would initially seem. You can't even do "{'tag'}" and get it to work because the Container calls self.validate(None, value) and fails because, down the callstack, a HasTraits instance is expected instead of None.
Assuming we fix that though, it looks like this issue would still persist because DeferredConfigString calls Container.from_string which blindly attempts a literal_eval and fails (because tag is not a literal Python expression), resulting in a fallback value (the raw string) being used; thus the TraitError. The solution to this (from what I can tell) is for Container.from_string(s) to call Container.from_string_list([s]).
@rmorshea Closed/reopened this PR to run GH Actions.