feat(block-kit): add data table block example - #98
Draft
zimeg wants to merge 5 commits into
Draft
Conversation
Mirrors the official Block Kit data_table docs example in the bolt-python-examples block-kit project: a captioned table with a header row and rich-text badge cells. The data_table block is net-new and not yet in a published slack_sdk release, so the example defines a DataTableBlock(Block) subclass that mirrors the SDK convention, matching the neighboring data_visualization example. Swap to the slack_sdk type once it ships. Docs: https://docs.slack.dev/reference/block-kit/blocks/data-table-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Replace the hand-rolled DataTableBlock(Block) subclass with an import of DataTableBlock from slack_sdk.models.blocks, and build the row cells with model classes (RawTextObject, RichTextBlock / RichTextSectionElement / RichTextElementParts) instead of raw dicts. slack_sdk does not yet export DataTableBlock, so both mypy and pytest (collection) fail by design — the example genuinely cannot run until the SDK ships the class, rather than a local subclass masking the gap. Ruff and formatting pass; the serialized shape is unchanged, so the existing to_dict() assertion stays valid once the class ships. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
…o helper Replace the hand-rolled DataTableBlock(Block) subclass with an import of DataTableBlock from slack_sdk.models.blocks. Keep the row cells as plain dicts (matching the sibling table example, whose TableBlock.rows is typed as Sequence[Sequence[Dict[str, Any]]]) and drop the local helper — the example stays flat and copy-pasteable. slack_sdk does not yet export DataTableBlock, so mypy and pytest fail by design on the missing import (not on cell shapes) — the honest signal that the block is not yet available, unblocking when the SDK ships it. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
force-pushed
the
feat/block-kit-data-table-example
branch
from
August 5, 2026 04:46
bc44e40 to
906b517
Compare
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_tableBlock Kit example to theblock-kitshowcase, mirroring the official docs example.The
data_tableblock is net-new and is not yet inslack_sdk(confirmed absent in the pinnedslack_sdk==3.42.0). This example defines a small, typedDataTableBlockthat subclasses the SDK'sslack_sdk.models.blocks.Blockbase class, following the same implementation pattern the SDK uses forTableBlock(validators for the requiredrowsandcaptionfields,attributescoveringrows,caption,page_size,row_header_column_index,block_id). When the SDK ships a nativeDataTableBlock, this example can be swapped to import it directly.block-kit/src/blocks/data_table.py—example01()returning aDataTableBlock(raw text header + raw text / rich text cells, with a caption), mirroring the docs example JSON.block-kit/tests/blocks/test_data_table.py— asserts the produced block deep-equals the expected literal (same style astest_table.py/test_task_card.py).block-kit/README.md— alphabetical "Data table" entry with docs + implementation links.Docs
https://docs.slack.dev/reference/block-kit/blocks/data-table-block
Validation
Run in
block-kit/against the pinnedrequirements.txt(slack_sdk==3.42.0):ruff check— passedruff format --diff --check— passed (new files already formatted)mypy src/blocks/data_table.py tests/blocks/test_data_table.py— passed (no issues)pytest tests/blocks/test_data_table.py -v— passed (1 passed)pytest -v— all data table tests passNote: a repo-wide
mypy ./**/*.pycurrently reports pre-existing errors insrc/blocks/carousel.py(unrelated work not part of this PR); the files added here are mypy-clean.Co-Authored-By: Claude svc-devxp-claude@slack-corp.com