Docs: a module docstring does not become the button tooltip

Open Beginner friendly
#4,285 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp, python, yaml
Domain
documentation

Research direction

Read the three named targets: docs/build-extensions/scripting/ironpython.md, docs/build-extensions/tutorials/first-command.md, and pyrevitlib/pyrevit/agent/skills/extension-authoring/SKILL.md. Update each to explain that ribbon tooltips come from tooltip in bundle.yaml, and preserve the stated legacy status of __doc__ where relevant. Done when the docstring tooltip claim and example are removed and the tutorial includes the bundle.yaml step and folder tree entry.

Written by the indexing model from the issue text.

Description

Bundles Documentation

Summary

The docs and the extension-authoring agent skill say that a script's module docstring becomes the button tooltip. The C# extension parser does not read it. ParseScriptConstants in ExtensionParser.cs takes an in-script tooltip only from a __doc__ assignment, and TooltipManager.BuildButtonTooltip has no docstring fallback.

The suggestion is to correct the docs, not add the fallback. #3657 tracks dropping inline metadata, so new tooltip text belongs in bundle.yaml.

Steps to reproduce

Checked on develop at ae79903e0 with the extension parser (no Revit needed).

  1. Create a .pushbutton with no bundle.yaml, whose script.py has only a module docstring:
    """Calculates total volume of all walls in the model."""
    
  2. Parse the extension with the C# parser and read the button's tooltip.

Expected (according to the docs)

The tooltip is the docstring.

Actual

The parsed tooltip is empty. From the code, the ribbon tooltip would then show only the bundle name and any authors. I did not check this by hovering the button in Revit.

The Python parser (pyrevitlib/pyrevit/extensions/genericcomps.py) still falls back to the docstring, but the ribbon tooltip comes from the C# parser.

Suggested change

  1. docs/build-extensions/scripting/ironpython.md, "DocString (Tooltip)":
    • Remove the claim and the example for the docstring as tooltip.
    • Show tooltip: in bundle.yaml as the way to set it.
    • If __doc__ stays documented, mark it as legacy inline metadata. It is still read while "Read script metadata" is on.
  2. docs/build-extensions/tutorials/first-command.md:
    • Keep the explanation of what a docstring is, but remove "pyRevit places this string inside the button tooltip".
    • Add a short step that creates a bundle.yaml with the tooltip, and add that file to the folder tree that holds script.py and icon.png:
      tooltip: Calculates total volume of all walls in the model.
      
  3. pyrevitlib/pyrevit/agent/skills/extension-authoring/SKILL.md: replace "A module docstring at the top of script.py can become the button's tooltip, so keep it the same as tooltip in bundle.yaml" with a statement that the docstring is not shown on the ribbon and that the tooltip is set with tooltip in bundle.yaml.

Shipped buttons affected

A static scan found 54 of 361 shipped script buttons with a module docstring, but no __doc__ line and no tooltip: in bundle.yaml:

  • 49 in pyRevitDevTools
  • 5 in pyRevitTutor
  • none in the other shipped extensions

Correcting the docs does not give these buttons a tooltip. Where one is wanted, the docstring text can be copied to tooltip: in bundle.yaml, in the same PR or a follow-up.

Not proposed

Reading the module docstring in the C# parser. It would add another way to define metadata in the script while #3657 aims to remove that.

Related: #3657

Dominant language
Python
Stars
2.1k
Forks
514
Avg merge
1d 4h
Merged PRs (30d)
245

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyrevitlabs/pyRevit

All issues in pyrevitlabs/pyRevit

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.