Skip to content
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

Implement _repr_html_ representation for base orm types #6378

Open
danielhollas opened this issue May 2, 2024 · 2 comments
Open

Implement _repr_html_ representation for base orm types #6378

danielhollas opened this issue May 2, 2024 · 2 comments
Labels
type/feature request status undecided

Comments

@danielhollas
Copy link
Collaborator

Pretty-printing ORM objects in jupyter notebooks

Jupyter notebooks / ipython allow objects to define special methods for rich display, see:

https://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display

Specifically, it would be nice to implement HTML representation (_repr_html_) for a nice printing in HTML notebooks. And we could then reuse this in AiiDAlab (which is where my motivation comes from).

Describe the solution you'd like

Display something nicer than this:

image

Describe alternatives you've considered

We could implement this as viewer widgets in aiidalab-widgets-base (and we already do for some types such as Dict) but I don't see a good reason why not integrate it to aiida-core so it can be easily used elsewhere as well.

@danielhollas danielhollas added the type/feature request status undecided label May 2, 2024
@mbercx
Copy link
Member

mbercx commented May 2, 2024

As @superstar54 knows, I'm a big fan of having nicer representations in Jupyter notebooks, visualising the structure when a StructureData is returned (as I think he already implemented: aiidateam/aiida-atomistic#18), or showing a band structure when a BandsData is returned. So big +1 from me.

@superstar54
Copy link
Member

superstar54 commented May 2, 2024

👍 For Jupyter notebooks, I suggest using _repr_mimebundle_, which provides more format (includes HTML) for complex data nodes, such as structure and bands.

I proposed a similar idea in the AiiDA meeting, that we provide a viewer for the data node, and one step further, also for the AiiDA WorkChain. The viewer for the workchain is similar to the result panel in QEApp. Thus, when the users finish a PwBandsWorkChain or XpsWorkchain, they can visualize the result (bands, spectra) of the WorkChain in the notebook directly by adding the node in the last line of the cell. In such a way, we really combine the power of AiiDAlab with AiiDA and provide user-friendly features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature request status undecided
Projects
None yet
Development

No branches or pull requests

3 participants