Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: deeply merge_configs #88

Closed
Jasha10 opened this issue Jan 29, 2022 · 3 comments · Fixed by #89
Closed

Feature request: deeply merge_configs #88

Jasha10 opened this issue Jan 29, 2022 · 3 comments · Fixed by #89

Comments

@Jasha10
Copy link
Contributor

Jasha10 commented Jan 29, 2022

Using the new merge_configs option to the ProjectConfig.__init__ method, configs like the following can be merged:

merged({"foo": "bar"}, {"baz": "qux"}) == {"foo": "bar", "baz": "qux"})

However, dictionaries nested more deeply than the toplevel are not merged:

# current behavior:
merged({"inner": {"foo": "bar"}}, {"inner": {"baz": "qux"}}) == {"inner": {"baz": "qux"}})
# left config overwritten by right config

I would expect that nested configuration gets merged instead of being overwritten:

# expected:
merged({"inner": {"foo": "bar"}}, {"inner": {"baz": "qux"}}) == {"inner": {"foo": "bar", "baz": "qux"}})
@Jasha10
Copy link
Contributor Author

Jasha10 commented Jan 29, 2022

For context: deep merging will be useful for autoimport. Specifically, deep merging will enable the use-case where multiple autoimport config files each specify part of the common_statements mapping.

cc @lyz-code

@dbatten5
Copy link
Owner

hi @Jasha10 thanks for raising the issue and the pr, i like the proposal. will take a look at the pr now

@dbatten5
Copy link
Owner

dbatten5 commented Feb 4, 2022

@Jasha10 @lyz-code this should now be available in 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants