AnswerDotAI / AnswerDotAI/nbdev
[FR] Make it easier to show source in docs for thin classes
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 5.3k
- Forks
- 514
- Ø Merge
- 2 T. 30 Min.
- Gemergte PRs (30 T.)
- 8
Beschreibung
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)
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)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne am show_doc-Einstiegspunkt von nbdev und reproduziere das Colors-Beispiel, um zu untersuchen, wie eine dünne Klasse derzeit gerendert wird. Verfolge anschließend den Dokumentations-Rendering-Pfad und überprüfe dann, dass eine optionale Form mit full_source=True den vollständigen Quelltext der Klasse anzeigt, während das bestehende Verhalten von show_doc(Colors) unverändert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- jupyter, python
- Bereich
- documentation
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100