From 4cd3c6844e7a047727ada0ccd22cbd0eab129df4 Mon Sep 17 00:00:00 2001 From: Carter Francis Date: Sun, 2 Aug 2026 07:27:44 -0500 Subject: [PATCH] fix(docs): document KeyOverlay id/name once, on the properties The docs build has failed on every commit since the keys work landed (v0.7.0): `KeyOverlay.id` and `.name` were described in the class docstring's `Attributes` block AND defined as bare properties that `autoclass :members:` documents too, so Sphinx emitted duplicate object description of anyplotlib.keys.KeyOverlay.id, other instance in api/keys, use :no-index: for one of them and the build runs with `-W`. Move the two descriptions onto the properties rather than silencing the warning with `:no-index:`. A property's docstring is where its docs belong, the text is unchanged and still renders, and there is no second copy left to drift out of sync. Full `sphinx-build -b html docs build/html -W --keep-going` now succeeds with zero warnings. --- anyplotlib/keys.py | 13 +++++-------- upcoming_changes/53.doc.rst | 4 ++++ 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 upcoming_changes/53.doc.rst diff --git a/anyplotlib/keys.py b/anyplotlib/keys.py index 4de24ba8..6c7e16c6 100644 --- a/anyplotlib/keys.py +++ b/anyplotlib/keys.py @@ -37,14 +37,6 @@ class KeyOverlay: key = plot.add_key(ipf_triangle, corner="bottom-right") key.set(size=0.3, bgcolor="none") key.visible = False # plain attribute assignment also pushes - - Attributes - ---------- - id : str - Short unique identifier. - name : str - Caller-supplied name, or the id when none was given. Use it with - :meth:`~anyplotlib.Plot2D.get_key`. """ #: Fields that live on the light view channel. The image itself does NOT @@ -68,10 +60,15 @@ def __init__(self, plot, image_url: str, *, name=None, **kwargs): @property def id(self) -> str: + """Short unique identifier.""" return self._id @property def name(self) -> str: + """Caller-supplied name, or the id when none was given. + + Use it with :meth:`~anyplotlib.Plot2D.get_key`. + """ return self._name # ── attribute access ────────────────────────────────────────────── diff --git a/upcoming_changes/53.doc.rst b/upcoming_changes/53.doc.rst new file mode 100644 index 00000000..31f0e3e2 --- /dev/null +++ b/upcoming_changes/53.doc.rst @@ -0,0 +1,4 @@ +Fixed the documentation build failing on +:class:`~anyplotlib.keys.KeyOverlay`, whose ``id`` and ``name`` were described +both in the class docstring and by the properties themselves — a duplicate +object description, which the build treats as an error.