feat(styling): init_sd as augmentation channel (nested merge + delete_keys + demo)#763
Merged
Merged
Conversation
init_sd users can already carry the same nested shape they'd put in
column_config_overrides — e.g. {'comments': {'displayer_args': {'max_length':
2000}, 'ag_grid_specs': {'wrapText': True, 'width': 400}}}. But where
column_config_overrides REPLACES the styled bag via shallow row.update(),
init_sd needs to AUGMENT it so the op-supplied highlights from Search (which
contribute flat top-level keys onto the same column_metadata) coexist with
the user's per-column displayer config.
Two shallow merges in DefaultMainStyling.style_column:
- column_metadata['displayer_args'] (dict) merges into the styled disp
bag — caller wins per-key. Keeps highlight_regex / highlight_phrase /
highlight_color (read separately from flat top-level keys) intact.
- column_metadata['ag_grid_specs'] merges into base_config['ag_grid_specs']
— caller wins per-key, on top of styling's computed minWidth.
This is what makes init_sd a viable augmentation channel for per-column
display config that needs to play nice with lowcode ops.
Tests:
- test_style_column_merges_nested_displayer_args_and_ag_grid_specs:
nested displayer_args.max_length and ag_grid_specs.{wrapText,width,
maxWidth} all flow through, minWidth still computed.
- test_init_sd_displayer_args_and_search_highlight_coexist_on_same_column:
the actual point — Search's highlight_regex AND user's max_length both
end up on the same column's displayer_args after merge_sds.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
style_column's type dispatch unconditionally attaches tooltip_config to string / time / categorical / period / interval / binary / fallback columns. init_sd's nested-merge channel can augment displayer_args and ag_grid_specs, but had no way to *remove* a styled default — so a user who wanted a string column without the permanent tooltip had no path short of subclassing the styling analysis. delete_keys is a top-level list on column_metadata; after all merging, each listed key is popped from base_config. Operates on top-level keys only (tooltip_config, ag_grid_specs, displayer_args, col_name) — nested removal isn't needed for the motivating case and would complicate the merge semantics. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Working example of init_sd carrying displayer_args + ag_grid_specs + delete_keys (drops the auto-attached tooltip_config) on the comments column. Pairs with rowHeight: 105 and wrapText so long complaint text wraps inside a tall cell. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add df.filter(pl.col('viol_status') == 'Fail') to demonstrate the
typical "filter + view" flow with the live-search widget. Tighten
rowHeight to 70px (was 105) — five lines was overkill for the median
comment length. Note in a comment that the Polars Enum is case-sensitive
('Fail' not 'fail') — previously committed version used 'fail' which
silently filters to 0 rows.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
📦 TestPyPI package publishedpip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.14.1.dev25998799685or with uv: uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.14.1.dev25998799685MCP server for Claude Codeclaude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.14.1.dev25998799685" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table📖 Docs preview🎨 Storybook preview |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 467e8ecdfd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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
Turns
init_sdinto a real augmentation channel for per-column display config — one that plays nice with lowcode ops (Search → highlight) instead of clobbering them likecolumn_config_overridesdoes. Twostyle_columnchanges + adelete_keysescape hatch + a working demo notebook.The plumbing this depends on already landed:
highlight_regexvia SDResulthighlight_phrase/highlight_regexon the string displayerThis PR is the styling-layer half: the pieces that let an op's contribution and a user's
init_sdcoexist on the same column.Pieces
feat(styling): merge column_metadata displayer_args + ag_grid_specs— two shallow merges inDefaultMainStyling.style_column. Whencolumn_metadatacarriesdisplayer_args(e.g.{'max_length': 5000}) orag_grid_specs(e.g.{'wrapText': True, 'width': 400}), they merge into the styled bag instead of replacing. Caller wins per-key. Critically, this lets a Search op'shighlight_regexand a user'smax_lengthcoexist on the same column —column_config_overrides's replace semantics would have clobbered the highlight.feat(styling): init_sd delete_keys—column_metadata.delete_keys: list[str]pops the named top-level keys from the finalbase_config. Motivating case: drop the auto-attachedtooltip_configon a string column the user doesn't want a permanent tooltip on, without subclassing the styling analysis. Operates on top-level only (tooltip_config, ag_grid_specs, displayer_args, col_name) — nested removal isn't needed for the motivating case.Restaurant-Complaints demo notebook — working example combining
init_sd(nested displayer_args + ag_grid_specs + delete_keys) withextra_grid_config(rowHeight, pinnedRowHeight) and aviol_status == 'Fail'filter on the polars Enum.Usage
This shape is intentionally the same as
column_config_overrideswould take — butinit_sdaugments viamerge_sds(each key wins per-call), whilecolumn_config_overridesreplaces via shallowrow.update().Provenance
Salvaged from #748 after #755 / #758 landed the underlying SDResult plumbing. Branched fresh off main; the obsolete 2-tuple-contract commits and the now-merged Search/jlisp pieces were dropped.
Test plan
pytest tests/unit/dataflow/— 120 pass (3 new tests: nested-merge, search+max_length coexistence, delete_keys)commentscolumn, wraps long text,max_length: 5000honored🤖 Generated with Claude Code