Skip to content

Render class signatures with a class prefix - #997

Open
ywxy12138 wants to merge 1 commit into
AnswerDotAI:mainfrom
ywxy12138:fix/class-signature-prefix
Open

ywxy12138 wants to merge 1 commit into
AnswerDotAI:mainfrom
ywxy12138:fix/class-signature-prefix

Conversation

@ywxy12138

@ywxy12138 ywxy12138 commented Dec 1, 2026 •

Copy link
Copy Markdown

Class signatures currently render with def, so MarkdownRenderer(MyClass) presents a class as a function. Select class for class objects in the shared DocmentText renderer. Preserve def and async def for functions and callable instances.

Update the source Notebook and generated module together. Regression coverage includes a constructor with annotated/default parameters, a dataclass, a built-in class, and the rendered Markdown code block, with regular/async function and callable-instance controls. The documentation explains the prefix distinction.

Fixes #829.

Validation on Linux:

  • The focused eight-case check has four class-related failures against unchanged main and eight passes with the fix. The fixed check also passes on Python 3.14.4.
  • Python 3.11.16: nbdev-test --n-workers 2 --timing --cell-timeout 90 passes all 24 Notebooks, including the added regressions.
  • nbdev-clean --fname nbs/04_docments.ipynb and a repeat nb_export leave the intended source/generated files consistent. uv pip check and git diff --check pass.

Upstream CI for the submitted head is awaiting maintainer authorization (action_required): https://github.com/AnswerDotAI/fastcore/actions/runs/46574837792. It has not run yet.

Prepared and tested with OpenAI Codex assistance.

Distinguish class objects before choosing the function prefix in DocmentText. Keep function and callable-instance signatures unchanged, and cover the behavior in the source notebook.

Fixes AnswerDotAI#829.

This branch has not been deployed

No deployments
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.

show_doc renders classes with def prefix instead of class

1 participant