-
Notifications
You must be signed in to change notification settings - Fork 906
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
Render concrete parameter/return types for dataset save
/load
#2199
Comments
This would indeed be great to fix but I think only someone very brave should attempt it as I can see it being very frustrating and difficult to achieve... Do you have any idea how you could actually get Sphinx to do that without us having to manually override every single page of automatically generated docs for datasets? Possibly we can edit a higher-level rst template to do it? |
To do: Try updating to the newest version of |
We are using a later version of Sphinx and this is still not resolved. It may be something that @astrojuanlu has familiarity with but if it's a non-trivial fix I suggest we put it as a very low priority. Could we potentially have an explanation of what is going on somewhere so if people want to know what it means, they can search and find the reasoning? |
Upgrading sphinx or sphinx-autodoc-typehints proved to create lots of headaches in the past. I agree the current result is less than ideal but I don't think this is trivial to fix at all. It might be easier to actually redesign the datasets... |
It doesn't look much better on The root cause is that the heavy lifting is done by |
I think it's easier to just wait on a redesign of our catalog and datasets #1778. |
Desired outputWe can redefine from pandas.util._decorators import doc # We could roll our own, simpler version
class LambdaDataset(AbstractDataset):
...
@doc(AbstractDataset.save.__doc__)
def save(self, data: int) -> None:
super().save(data)
@doc(AbstractDataset.load.__doc__)
def load(self) -> pd.DataFrame:
return super().load() Note that clicking through to the code on the docs will show that generated code, so maybe we should make it explicit that this is a generated function in the comments: Possible implementationsNow, the question is—how do we accomplish this for all datasets? It is possible to either:
Notes
|
We discussed this on tech design today (2024-05-08). While there weren't clear arguments against this solution, we discussed alternative approaches:
Lines 190 to 202 in c8a0e22
|
Thanks @astrojuanlu! Just copying in my summary, but I think you covered it:
I have some ideas on the latter, and I will investigate this. |
Description
The parameter type for a dataset's
save
is_DI
, and the return type forload
is_DO
. This doesn't make any sense to a user (and barely makes sense to me, as a Kedro developer, because I saw the typing PR go in and have that context). I'd rather it not display any types, if getting the correct concrete types is too difficult.The text was updated successfully, but these errors were encountered: