Refactor/autoshapes-use-shape-label #5424
Closed
+170
−22
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.
vline: switch to shape.label (no separate annotation) + legacy shim
Summary
add_vline now produces one labeled shape (no layout.annotations).
Legacy annotation_* kwargs are accepted and translated (with FutureWarning).
Date strings (and other non-numeric x) no longer cause TypeError because we removed arithmetic from annotation placement.
Code highlights
_coerce_shape_label_from_legacy_annotation_kwargs (prep): copies annotation_text/font/textangle → label.text/font/textangle (non-destructive).
_normalize_legacy_line_position_to_textposition maps legacy positions to start|middle|end for lines (vline: top→end, bottom→start).
_process_multiple_axis_spanning_shapes: new vline branch adds a single shape with label, skips add_annotation.
Tests
Current failures are expected: tests still assert layout.annotations for vline.
Follow-ups will update tests to assert shape.label for vline only (others unchanged until refactored).
Migration
annotation_bgcolor / annotation_bordercolor aren’t supported by shape.label; warning emitted and ignored.
annotation_* is deprecated; prefer label={...}.
Next steps
Update vline tests.
Mirror refactor to hline, then vrect/hrect.
Update tests per helper; keep diffs small.