-
Hi there! In Strawberry we have a couple of public attributes (and functions[1] defined as attributes)
T = TypeVar("T")
Parent = Annotated[T, StrawberryParent()]
Parent.__doc__ = "Some doc here" I don't know if Anyway, I wonder if there's a way to make this work with griffe, my first attempt was to use the Parent = Annotated[T, StrawberryParent(), Doc("Some doc here")] But that doesn't seem to be supported, and maybe it never will? Do you have any suggestion? While writing this I thought of another option of converting JSON{
"kind": "attribute",
"name": "strawberry.Parent",
"path": "strawberry.parent.Parent",
"filepath": "/private/var/folders/tz/d3_033052gg7k7lrj34yj0lr0000gn/T/tmp78iz_csm/strawberry/strawberry/parent.py",
"relative_filepath": "strawberry/parent.py",
"relative_package_filepath": "strawberry/parent.py",
"lineno": 10,
"endlineno": 14,
"labels": [
"module-attribute"
],
"members": [],
"value": {
"left": {
"name": "Annotated",
"cls": "ExprName"
},
"slice": {
"elements": [
{
"name": "T",
"cls": "ExprName"
},
{
"arguments": [],
"function": {
"name": "StrawberryParent",
"cls": "ExprName"
},
"cls": "ExprCall"
},
{
"arguments": [
"'Example'"
],
"function": {
"name": "Doc",
"cls": "ExprName"
},
"cls": "ExprCall"
}
],
"implicit": true,
"cls": "ExprTuple"
},
"cls": "ExprSubscript"
}
} [1]: Like these, but we can add docs by creating a real function, so I wouldn't worry about them now |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
It definitely looks like it should be supported. Let me look into it 🙂 |
Beta Was this translation helpful? Give feedback.
Yes that would make things ambiguous indeed 🤔 Unless you annotate the type itself, but this feels really weird:
There's always the solution to add a docstring below the assignment, no?