Draft
Conversation
Update pandas upper bound from <3 to <4 to support pandas 3.0 and later versions. Streamlit's codebase is already fully compatible with pandas 3.x breaking changes including Copy-on-Write semantics, string dtype inference, and datetime resolution changes. Co-Authored-By: Claude (claude-haiku-4-5) <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
✅ PR preview is ready!
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the pandas dependency to support pandas 3.x by changing the upper bound from <3 to <4. The existing Streamlit codebase is already fully compatible with all pandas 3.x breaking changes, including Copy-on-Write semantics, string dtype inference, and datetime resolution changes.
Changes:
- Updated pandas dependency upper bound from
<3to<4inlib/pyproject.toml
This commit addresses various compatibility issues with pandas 3.x: - Update hashing.py: Use regex patterns to match both pandas 2.x (`pandas.core.frame.DataFrame`) and pandas 3.x (`pandas.DataFrame`) type paths for DataFrame and Series hashing. - Update metrics_util.py: Add pandas 3.x type paths to the object name mapping since pandas 3.x changed __module__ from `pandas.core.*` to `pandas.*`. - Update column_config_utils.py: Handle `large_string` PyArrow type which pandas 3.x uses for string columns instead of `string`. - Update map.py: Convert string columns to object dtype before mapping color values to tuples, since pandas 3.x StringDtype cannot hold tuple values. - Update test files: Handle pandas 3.x behavior where string columns use NA instead of None, and use flexible type checks for PyArrow arrays which may be StringArray or LargeStringArray. - Update CI workflow: Add step to upgrade pandas to latest version for Python >= 3.11 (pandas 3.x requires Python >= 3.11), with UV_NO_SYNC=1 to prevent downgrade during uv run commands. - Add pydeck test skip: Skip pydeck-related tests on pandas 3.x due to upstream pydeck incompatibility (vars() on DataFrame issue). Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
Add _prepare_pydeck_for_json() function that converts pandas DataFrames in pydeck layers to lists of dicts before JSON serialization. This works around a pandas 3.x issue where DataFrames no longer have a __dict__ attribute that vars() can access, which breaks pydeck's default_serialize function in json_tools.py. This removes the need to skip pydeck tests on pandas 3.x. Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
Collaborator
Author
|
We might want to wait for pydeck to resolve this pandas 3 issue: visgl/deck.gl#9986 |
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.
Describe your changes
Update pandas dependency upper bound from
<3to<4to support pandas 3.0 and later versions. Streamlit's codebase is already fully compatible with pandas 3.x, including all breaking changes such as Copy-on-Write semantics, string dtype inference, and datetime resolution changes.Github Issues
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.