Skip to content

feat(block-kit): add data table block example - #98

Draft
zimeg wants to merge 5 commits into
mainfrom
feat/block-kit-data-table-example
Draft

feat(block-kit): add data table block example#98
zimeg wants to merge 5 commits into
mainfrom
feat/block-kit-data-table-example

Conversation

@zimeg

@zimeg zimeg commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds a data_table Block Kit example to the block-kit showcase, mirroring the official docs example.

The data_table block is net-new and is not yet in slack_sdk (confirmed absent in the pinned slack_sdk==3.42.0). This example defines a small, typed DataTableBlock that subclasses the SDK's slack_sdk.models.blocks.Block base class, following the same implementation pattern the SDK uses for TableBlock (validators for the required rows and caption fields, attributes covering rows, caption, page_size, row_header_column_index, block_id). When the SDK ships a native DataTableBlock, this example can be swapped to import it directly.

  • block-kit/src/blocks/data_table.pyexample01() returning a DataTableBlock (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 as test_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 pinned requirements.txt (slack_sdk==3.42.0):

  • ruff check — passed
  • ruff 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)
  • Full pytest -v — all data table tests pass

Note: a repo-wide mypy ./**/*.py currently reports pre-existing errors in src/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

zimeg and others added 5 commits June 26, 2026 17:06
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
zimeg force-pushed the feat/block-kit-data-table-example branch from bc44e40 to 906b517 Compare August 5, 2026 04:46
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