fix: Declare pandas in the dashboard extra - #95
Merged
Conversation
`dashboard.py` guards its gradio import and then imports pandas unguarded, but the extra only listed gradio. It has worked so far because gradio depends on pandas, so the extra has been relying on another package's dependency list to be complete. If gradio ever drops that dependency the failure is a bare ModuleNotFoundError, and the advice already attached to the gradio guard -- "Install it with: pip install pyetwkit[dashboard]" -- is no help, because the user has run exactly that. The test reads the installed metadata rather than importing gradio, which is heavy and not installed in CI. It checks the extra declares what the module imports, so adding another unguarded import without declaring it will fail. Closes #93 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HhPcm483PrDmuQEUSALBFn
5 tasks
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
dashboard.pyguards its gradio import and then imports pandas unguarded, but thedashboardextra only listed gradio.It works today only because gradio depends on pandas — the extra has been relying on another package's dependency list to be complete.
Changes
pyproject.toml:dashboardextra declarespandas>=2.0test_dashboard.pyRelated Issue
Closes #93
Test Plan
Added/Modified Tests
The test reads the installed metadata rather than importing gradio, which is heavy and not installed in CI. It asserts the extra declares what the module imports, so another unguarded import added later without declaring it will fail here.
A second test pins that importing
pyetwkit.dashboardneeds neither package — only_create_gradio_appdoes.Test Results
Failing before the fix, against the previous metadata:
After:
One thing worth noting: my first version of the test matched
extra == "dashboard"with double quotes and kept failing after the fix was already correct. The metadata uses single quotes. It now matches either, rather than one build backend's formatting.Checklist
Additional Notes
Not done: putting the
dashboardextra in CI, the way #87 did forexport._create_gradio_app()has no test coverage at all —tests/test_dashboard.pynever mentions gradio — so installing it would currently buy nothing without new tests to go with it, and gradio is a heavy install across five matrix entries. Worth deciding separately.🤖 Generated with Claude Code
https://claude.ai/code/session_01HhPcm483PrDmuQEUSALBFn