Skip to content

fix: configure() no longer overwrites config set by configure_*() sub-methods - #4105

Open
mayuriphad wants to merge 1 commit into
vega:mainfrom
mayuriphad:fix/configure-overwrites-config
Open

fix: configure() no longer overwrites config set by configure_*() sub-methods#4105
mayuriphad wants to merge 1 commit into
vega:mainfrom
mayuriphad:fix/configure-overwrites-config

Conversation

@mayuriphad

Copy link
Copy Markdown

Summary

Fixes #3841.

configure() unconditionally replaced the whole config object:

def configure(self, *args, **kwargs) -> Self:
    copy = self.copy(deep=False)
    copy.config = core.Config(*args, **kwargs)
    return copy

So calling it after any configure_*() sub-method (configure_axisBottom(), configure_view(), etc.) silently discarded everything the sub-method had set, e.g.:

chart = (
    alt.Chart(data)
    .mark_circle()
    .encode(x="foo", y="bar")
    .configure_axisBottom(orient="top")  # discarded by the next call
    .configure(tooltipFormat={"numberFormat": ".2f"})
)

The configure_*() sub-methods already merge into the existing config (copy.config["{prop}"] = ...), so configure() was the odd one out.

Fix

Updated the CONFIG_METHOD template in tools/generate_schema_wrapper.py (this generates ConfigMethodMixin.configure in altair/vegalite/v6/schema/mixins.py) so configure() 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. Ran uv run python tools/generate_schema_wrapper.py to regenerate mixins.py from 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

  • Added test_configure_merges_with_configure_prop_methods in tests/vegalite/v6/test_api.py, covering both the reported case (config set by configure_axisBottom() survives a later configure() call) and that configure() still overrides a key it set previously.
  • uv run pytest tests/ -k config -q — 14 passed.
  • Manually reproduced the exact repro from Bug: chart configure_axisBottom() has no effect if configure() is called later #3841 before the fix (bug confirmed) and after (fixed).

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
Copilot AI lite review requested due to automatic review settings August 21, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the bug label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: chart configure_axisBottom() has no effect if configure() is called later

2 participants