ConfigTree.merge_configs fails when one ConfigTree comes from file and another from dict
On recent versions of pyhocon the merge_configs methods make reference to the attribute "history" of the ConfigTree. This attribute is set when read from file, but is not set when CofigFactory.from_dict is called. This causes the merge_configs methods to fail when e.g. a file is read and some dictionary of overrides is to be merged on top of the file options.
Also experienced this. The error is
AttributeError: 'ConfigTree' object has no attribute 'history'
I'm also running into this. For me it's a little more subtle and appears to be dependent on whether the dict overrides values in some or all sub-trees of the file-based config.
My temporary/hacky workaround for this is to parse the dictionary once using ConfigFactory.from_dict() to ensure any dot.separated keys are handled correctly, then dump it to json and re-parse with ConfigFactory.parse_string(). E.g.
c1 = ConfigFactory.parse_file("some.conf")
c2 = ConfigFactory.from_dict({"foo": 1, "bar.splat": 2})
c2 = ConfigFactory.parse_string(json.dumps(c2))
It's a little hacky, but seems to handle everything and results in a valid config.