feat(block-kit): add data visualization block example#101
Draft
zimeg wants to merge 1 commit into
Draft
Conversation
Mirror the official docs data_visualization block with pie, bar, area, and line chart examples, plus tests and a README entry. Docs: https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
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
Adds a
data_visualizationBlock Kit example to theblock-kitexample set, mirroring the official docs reference. Includes fourexampleNN()variants covering every chart type the docs demonstrate:example01()— pie chart (labeled segments)example02()— bar chart (single series + axis_config)example03()— area chart (multiple series + axis_config)example04()— line chart (multiple series over time + axis_config)Each example follows the existing block pattern (e.g.
header.py,section.py): it imports the block type from the published SDK and constructs an instance. No block type is defined or inlined in this example repo.A matching test (
tests/blocks/test_data_visualization.py) asserts each produced block.to_dict()deep-equals the expected literal, and a README entry was added (alphabetically, between Context actions and Divider) with docs + implementation links.Docs: https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block
Dependency
data_visualizationis a net-new block type. The example importsDataVisualizationBlockfromslack_sdk.models.blocks, which is not yet present in the releasedslack_sdk(3.42.0 in this repo's requirements). This PR depends on the corresponding SDK PR that adds the typedDataVisualizationBlockclass landing and being released. The import is written as if the type exists, per repo convention; it is intentionally NOT hand-rolled here.Validation
pytest tests/blocks/test_data_visualization.py— FAILS to collect on the currentslack_sdk3.42.0 withImportError: cannot import name 'DataVisualizationBlock' from 'slack_sdk.models.blocks'. This is expected until the SDK PR lands; the test will pass once the type is available.test_header.py,test_section.py) still pass (4 passed), confirming the change does not break unrelated collection.Reporting honestly: the new test does not pass yet because the SDK type it imports is unreleased.
Co-Authored-By: Claude svc-devxp-claude@slack-corp.com