Add displaying and loading of recipe output to the notebook API#957
Add displaying and loading of recipe output to the notebook API#957nielsdrost merged 24 commits intomasterfrom
Conversation
Gets rid of IPython dependency
|
I just realized we do not depend on |
Peter9192
left a comment
There was a problem hiding this comment.
Very cool stuff @stefsmeets, this is really impressive already! Here's a few general comments:
- The documentation (before the API reference) is a bit limited, and I'm not sure if I could readily use it. The notebook helped me to understand how to the items from the output. A slightly more elaborate example would be nice.
- Would it be simple enough to make shorthand methods for these intimidating lines in the example notebook like
data_items = [item for tasks in recipe_output.values() for item in tasks if item.kind == 'data']? Then I think that's worth adding. - How much effort would it be to have a nice markdown rendering of the output, like you did for the Recipe Info? I think that could potentially be awesome as well.
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
|
Thanks @Peter9192
Yeah, I agree. I am collecting the notebooks I'm developing so that they can be used to support the documentation. I will try to see what I can do to add some more information.
This would mean turning recipe output into a class, and then add a method like
Technically it is not too difficult. I'm already using HTML so that I can render the caption as well as the image. This can be extended with other attributes. I think you can do inline html in markdown, which may be a another way to do it. I actually started adding the authors, but I stopped because I was worried of losing scope for this PR. It would require going through the attributes and presenting them in a nice way, including stuff like authors and references (which we already have), but also realms and domains. I think this PR puts a good baseline to continue from. |
This enables nicer output in the notebook, and convenience functions. Also lays the foundation for other functionality, like a `.report` method that can write an html document etc.
|
It was a bit of work, but I added wrappers for the task and recipe output to make it a bit easier to work with these objects. This also lays the foundation to do stuff like |
|
Hi @Peter9192 , I implemented all your feedback. If you approve, I think this PR is ready to be merged! |
Peter9192
left a comment
There was a problem hiding this comment.
Hey Stef! This is starting to be very very cool! I have a couple of follow-up comments/questions, but all-in-all I'm very happy with this PR.
On codacy: shall we just move the imports to the top?
Co-authored-by: Peter Kalverla <peter.kalverla@gmx.com>
I moved |
|
This PR is ready to be merged @nielsdrost ! |
Description
Hi everyone, this PR extends the API to run recipes in an interactive notebook.
It adds functionality to obtain the output data (data or plots), and display or load them directly in the notebook.
Todo
recipe_outputdict and add convenience methodsrecipe_output.get_output_of_type('data')TaskOutputusage (__repr__/ rename.filenameattribute)Before you get started
Checklist
pre-commitoryamllintchecksTo help with the number pull requests: