Skip to content

feat(models): add data_visualization Block Kit block - #1899

Draft
zimeg wants to merge 3 commits into
mainfrom
chore/block-kit-data-visualization
Draft

zimeg wants to merge 3 commits into
mainfrom
chore/block-kit-data-visualization

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the net-new data_visualization Block Kit block to the SDK's block models. The block renders data as a pie, bar, area, or line chart.

  • New DataVisualizationBlock (type: "data_visualization") in slack_sdk/models/blocks/blocks.py with title (required, max 50 chars), chart (required), and optional block_id.
  • The chart object is accepted as a dict (consistent with how TableBlock/DataTableBlock model their nested structures): a pie chart carries segments; bar/area/line carry series plus axis_config.
  • Validation: title presence + length (<=50), chart presence, and chart.type membership in {pie, bar, area, line}.
  • Registered in Block.parse() and exported from slack_sdk/models/blocks/__init__.py (DataVisualizationBlock in both the import and __all__).
  • Tests in tests/slack_sdk/models/test_blocks.py mirroring the existing DataTableBlock coverage (doc example, bar chart with block_id, line chart with negatives, required-arg and validation cases).

Docs

https://docs.slack.dev/reference/block-kit/blocks/data-visualization-block

Validation steps run

  • black --line-length 125 on the touched files: no changes (already compliant).
  • pytest tests/slack_sdk/models/test_blocks.py: 97 passed (7 new DataVisualizationBlock cases included).
  • mypy slack_sdk/models/blocks/blocks.py: success, no issues.
  • Smoke test: construct + to_dict() round-trip and Block.parse() resolve to DataVisualizationBlock.

No changeset added: this repo does not use .changeset/ (version is managed via slack_sdk/version.py).

Co-Authored-By: Claude svc-devxp-claude@slack-corp.com

Add DataVisualizationBlock supporting pie, bar, area, and line charts,
including title length and chart type validation, parse() registration,
package exports, and tests mirroring existing block coverage.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.43%. Comparing base (d9618f8) to head (f685d68).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
slack_sdk/models/blocks/blocks.py 98.21% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1899      +/-   ##
==========================================
+ Coverage   84.38%   84.43%   +0.05%     
==========================================
  Files         118      118              
  Lines       13812    13868      +56     
==========================================
+ Hits        11655    11710      +55     
- Misses       2157     2158       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

zimeg and others added 2 commits November 4, 2026 18:01
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant