You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To type hint the methods in class A, I've specified the return type as typing.Self, which works fine in my editor. When building the docs using python-apigen, the entity pages for classes B and C look something like this:
I have also tried type-hinting with the name of the parent class, like this:
That also works in my editor, but results in incorrect documentation pages, that show the methods always return an object of class A, even on the pages for class B and C:
Ideally, the correct interpretation would be that those methods would return type B on the B page, and C on the C page. Is there anyway to configure things so this is the output?
The text was updated successfully, but these errors were encountered:
There isn't currently an option to do that, but it could potentially be implemented similar to how type parameters of inherited methods are also resolved.
Arguably Self is useful to display if the user might inherit from the class. If users aren't expected to inherit from the class then just showing the resolved return type could make sense.
Ok, thanks for the context. Feel free to leave this open as a feature request, or close it if you wish. It would be nice if it worked the way I mentioned, but far from a deal-breaker on how useful this theme is!
I have a basic inherited class structure that looks more or less like this, with some methods in the base class that return objects of the same type:
To type hint the methods in class
A
, I've specified the return type astyping.Self
, which works fine in my editor. When building the docs usingpython-apigen
, the entity pages for classesB
andC
look something like this:I have also tried type-hinting with the name of the parent class, like this:
That also works in my editor, but results in incorrect documentation pages, that show the methods always return an object of class
A
, even on the pages for classB
andC
:Ideally, the correct interpretation would be that those methods would return type
B
on the B page, andC
on the C page. Is there anyway to configure things so this is the output?The text was updated successfully, but these errors were encountered: