Skip to content

🔧 Deprecate the never-functional needtable style_col option - #1779

Merged
chrisjsewell merged 3 commits into
masterfrom
remove-needtable-style-col
Aug 19, 2026
Merged

🔧 Deprecate the never-functional needtable style_col option#1779
chrisjsewell merged 3 commits into
masterfrom
remove-needtable-style-col

Conversation

@chrisjsewell

@chrisjsewell chrisjsewell commented Aug 19, 2026

Copy link
Copy Markdown
Member

The option has never done anything

git grep -n style_col across the whole tree returns exactly five hits, every one a declaration or a dump of one:

  • sphinx_needs/directives/needtable.py — the option_spec entry, the self.options.get, and the node-attribute assignment
  • sphinx_needs/data.py — the NeedsTableType TypedDict field
  • one style_col="" in a doctree snapshot

process_needtables never reads current_needtable["style_col"] back. There is no CSS and no JS keyed on it, and it is absent from docs/directives/needtable.rst, which documents every other option (including its functional sibling :style_row:). A build that sets it renders exactly as one that does not.

Shape: deprecate-and-warn, not remove (maintainer ruling)

The option stays in option_spec so existing documents keep building unchanged, and setting it now emits a deprecated warning stating the truth:

The 'style_col' option has never had any effect (it was collected but never applied) and will be removed; the line can be deleted.

This is the export_id pattern — an easy deprecation pathway instead of an unknown-option error. The dead plumbing is still removed (the TypedDict field, the node attribute, the collection), so nothing stores or transports the value anymore.

A test pins the warning firing exactly once (tests/doc_test/doc_needtable/test_styles.rst gained a table carrying the option), and the doctree snapshot loses its inert style_col="" attribute.

Also folded in: the show_parts docs example was rendering an empty table

The example needtable in docs/directives/needtable.rst's show_parts section filters on :tags: test_table — but none of the three needs its dropdown defines (table_001..table_003) carried that tag, so the rendered table selected nothing. The three needs are now tagged, and a scratch build confirms the intended output: each need's row, with table_001's three part rows directly beneath it and the part links resolved. (This example doubles as the manual cross-check for ubCode's :show_parts: implementation in useblocks/ubcode#2990.)

Found while implementing the needtable options in ubCode (useblocks/ubcode#2983 / useblocks/ubcode#2990): ubCode used to warn that :style_col: was "not yet applied", which wrongly implied a Sphinx-Needs build applies it — its warning now states the option has no effect in either tool.

Declared in option_spec, collected, and stored on the node — but
process_needtables never reads it back, there is no CSS or JS for it,
and it is absent from the needtable documentation. It has never had
any effect. A document that sets it must delete the line.
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.56%. Comparing base (4e10030) to head (ecb26ac).
⚠️ Report is 327 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1779      +/-   ##
==========================================
+ Coverage   86.87%   90.56%   +3.68%     
==========================================
  Files          56       76      +20     
  Lines        6532    11336    +4804     
==========================================
+ Hits         5675    10267    +4592     
- Misses        857     1069     +212     
Flag Coverage Δ
pytests 90.56% <100.00%> (+3.68%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Maintainer ruling: keep the option accepted so existing documents build
unchanged, and emit a 'deprecated' warning naming the truth — it has never
had any effect. The dead plumbing (TypedDict field, node attribute,
collection) stays removed; a test pins the warning firing once.
@chrisjsewell chrisjsewell changed the title 🔧 Remove the dead needtable style_col option 🔧 Deprecate the never-functional needtable style_col option Aug 19, 2026
The example needtable filters on :tags: test_table, but none of the three
needs its dropdown defines carried that tag, so the rendered table was
empty. Tagging them restores the intended output: each need's row with
table_001's three part rows directly beneath it, part links resolved.
Verified with a scratch build (3 need rows + 3 need_part rows).
@chrisjsewell
chrisjsewell merged commit 151b611 into master Aug 19, 2026
25 checks passed
@chrisjsewell
chrisjsewell deleted the remove-needtable-style-col branch August 19, 2026 09:54
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.

2 participants