Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Make it easier to show source in docs for thin classes #1459

Open
jlopezpena opened this issue Oct 16, 2024 · 0 comments
Open

[FR] Make it easier to show source in docs for thin classes #1459

jlopezpena opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jlopezpena
Copy link

Minimally reproducible example:

from enum import Enum  # StrEnum for python >= 3.12  
from nbdev import show_doc

class Colors(str, Enum):  # Or `StrEnum` if on python >= 3.12
    "Enum with the valid colors we can use in our package"
    RED = "red"
    GREEN = "green"
    BLUE = "blue"

show_doc(Colors)

image

Issue description

This it not really a bug, more like a feature request. When defining thin classes, such as enums or dataclasses, the documentation for those classes shows a very uninformative ClassName (*values).

For this use case, it would be really useful to have an option that would allow inlining the entire class source in the docs, to get a view of all the possible values. To avoid breaking existing code this could be implemented as an optional argument to the show_doc method, so to enable this one would do something like show_doc(Colors, full_source=True)

@jlopezpena jlopezpena added the bug Something isn't working label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant