fix: configure() no longer overwrites config set by configure_*() sub-methods - #4105
Open
mayuriphad wants to merge 1 commit into
Open
fix: configure() no longer overwrites config set by configure_*() sub-methods#4105mayuriphad wants to merge 1 commit into
mayuriphad wants to merge 1 commit into
Conversation
configure() unconditionally replaced the whole Config object, silently discarding anything set by an earlier configure_axisBottom() (or any other configure_*() sub-method) call earlier in the chain. Merge the existing config's keys with the new ones instead, matching how the configure_*() sub-methods already merge into config. Fixes vega#3841
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #3841.
configure()unconditionally replaced the wholeconfigobject:So calling it after any
configure_*()sub-method (configure_axisBottom(),configure_view(), etc.) silently discarded everything the sub-method had set, e.g.:The
configure_*()sub-methods already merge into the existing config (copy.config["{prop}"] = ...), soconfigure()was the odd one out.Fix
Updated the
CONFIG_METHODtemplate intools/generate_schema_wrapper.py(this generatesConfigMethodMixin.configureinaltair/vegalite/v6/schema/mixins.py) soconfigure()merges its kwargs into the existing config instead of replacing it outright — same-key values still get overridden as expected, but unrelated keys set by earlier calls survive. Ranuv run python tools/generate_schema_wrapper.pyto regeneratemixins.pyfrom the updated template (the only functional change in the regenerated file is this method; unrelated dataset/theme metadata files that also get touched by the generator were left untouched).Testing
test_configure_merges_with_configure_prop_methodsintests/vegalite/v6/test_api.py, covering both the reported case (config set byconfigure_axisBottom()survives a laterconfigure()call) and thatconfigure()still overrides a key it set previously.uv run pytest tests/ -k config -q— 14 passed.configure_axisBottom()has no effect ifconfigure()is called later #3841 before the fix (bug confirmed) and after (fixed).