Skip to content

Add support for altair 6#13003

Merged
lukasmasuch merged 8 commits intodevelopfrom
support-altair-6
Nov 18, 2025
Merged

Add support for altair 6#13003
lukasmasuch merged 8 commits intodevelopfrom
support-altair-6

Conversation

@lukasmasuch
Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch commented Nov 12, 2025

Describe your changes

Adds support for Altair 6. This is a requirement for official Python 3.14 support.

GitHub Issue Link (if applicable)

Testing Plan

  • Added unit test.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@lukasmasuch lukasmasuch requested a review from a team as a code owner November 12, 2025 18:46
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Nov 12, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 12, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13003/streamlit-1.51.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13003.streamlit.app (☁️ Deploy here if not accessible)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for Altair 6.x by updating the dependency constraint and adapting code to handle version-specific behavior changes in Altair's parameter naming strategy.

Key Changes:

  • Updates Altair version constraint from <6 to <7 to allow Altair 6.x versions
  • Skips parameter counter normalization for Altair >= 6.0.0, as this version no longer uses global counters for unnamed parameters
  • Updates E2E test assertions to use flexible regex patterns that work with both Altair 5.x and 6.x parameter naming schemes

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lib/setup.py Updates Altair version constraint to <7 to allow version 6.x
lib/streamlit/elements/vega_charts.py Adds version check to skip counter reset logic for Altair >= 6.0.0 and updates docstring
e2e_playwright/st_altair_chart_basic_select_test.py Updates regex patterns to match variable parameter names (from param_1 to param_.+) to support both Altair versions


# Altair 6.0.0 introduced a new way to handle parameters,
# by using hashes instead of pure counters:
pattern = re.compile(rf'"{prefix}[0-9a-z]+"')
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Theoretically, altair >=6.0.0 uses stable hashes instead of unstable counters. However, if we would remove this code path for altair >=6.0.0 it would break some apps. Keeping the old logic for now ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we have any tests for this?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Added some unit tests to cover the old-counter and the new hash-based IDs. With this change, all the relevant e2e tests will also run with the new hash-based pattern.

@lukasmasuch lukasmasuch enabled auto-merge (squash) November 18, 2025 00:25
@lukasmasuch lukasmasuch merged commit 300138f into develop Nov 18, 2025
39 checks passed
@lukasmasuch lukasmasuch deleted the support-altair-6 branch November 18, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:other PR contains other type of change impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants