Skip to content

Consolidate AWB preview handling - #220

Merged
yakutovicha merged 11 commits into
mainfrom
update/make-awb-soft-dependency
Jun 2, 2026
Merged

Consolidate AWB preview handling#220
yakutovicha merged 11 commits into
mainfrom
update/make-awb-soft-dependency

Conversation

@yakutovicha

Copy link
Copy Markdown
Member

AWB is still called in some places, but only to display widgets. In this PR we make sure that AWB is only called when it is installed. Otherwise, nothing is shown and a helper message is given to the user.

AWB is still called in some places, but only to display widgets. In this
PR we make sure that AWB is only called when it is installed. Otherwise,
nothing is shown and a helper message is given to the user.
Comment thread home/node_preview.py

@edan-bainglass edan-bainglass left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment 🙂

@danielhollas danielhollas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative, instead of displaying the message, you could display a fallback view of the node with just it's __repr__ or __str__, i.e. the same thing that the AWB viewer does for nodes that don't have dedicated viewer.

(presumably, if the plan still to pre-install an AWB version to the image in the future, this fallback should be rare)

@danielhollas danielhollas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yakutovicha can we get this one merged? Then we can make a aiidalab-home release.

Comment thread tests/test_process.py Outdated
Comment thread home/node_preview.py Outdated
Comment thread home/node_preview.py Outdated
try:
from aiidalab_widgets_base import viewer # noqa: PLC0415
except ImportError:
return AWB_UNAVAILABLE_MESSAGE

@danielhollas danielhollas Jun 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion here was to return the node instead of the AWB_UNAVAILABLE_MESSAGE to simplify things, since AWB should anyway be present in typical case. @yakutovicha If you disagree can you explain why?

EDIT: Sorry, just saw your message on Slack, I'll defer to Edan what he thinks.

@edan-bainglass edan-bainglass Jun 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear how "since AWB should anyway be present in typical case" justifies "return the node instead of the AWB_UNAVAILABLE_MESSAGE" 🤔 Can you clarify?

In any case, I would do here what is best for the user. If we return the node without an available viewer, the user would just see the repr of the node, right? And no clear message as to why they don't see the viewer. Is this useful to the common user? It might be sufficient to some to see the node repr message, but I would still notify them somehow that there's more to see if they install AWB.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this?

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that looks good to me, thanks! Maybe wrap the command in <pre> tags.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For a richer node view, please install the AiiDAlab widgets with pip install aiidalab-widgets-base"

Not sure if "node view" is clear to the common user. Maybe "output view" is better.

@yakutovicha yakutovicha Jun 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that looks good to me, thanks! Maybe wrap the command in \<pre\> tags.

<pre> puts it on a separate line, so I used <code>.

image

here 91e78a7.

@yakutovicha yakutovicha Jun 2, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"For a richer node view, please install the AiiDAlab widgets with pip install aiidalab-widgets-base"

Not sure if "node view" is clear to the common user. Maybe "output view" is better.

done in 3165788.

image

@edan-bainglass edan-bainglass left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unclear on the goal of this change. AWB import was already guarded with a try/except. This PR appears to simply consolidate it (which is fine/cleaner). But then I would state that more clearly, rather than stating that THIS PR makes AWB a soft dependency. Feels like I'm missing something 😅

@yakutovicha

Copy link
Copy Markdown
Member Author

I'm a bit unclear on the goal of this change. AWB import was already guarded with a try/except. This PR appears to simply consolidate it (which is fine/cleaner). But then I would state that more clearly, rather than stating that THIS PR makes AWB a soft dependency. Feels like I'm missing something 😅

Fair point, it is indeed more about consolidation. I am going to rename the PR.

@yakutovicha yakutovicha changed the title Make AWB a soft dependency Consolidate AWB preview handling Jun 2, 2026

@edan-bainglass edan-bainglass left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yakutovicha. LGTM!

@edan-bainglass
edan-bainglass self-requested a review June 2, 2026 11:03
@edan-bainglass

Copy link
Copy Markdown
Member

@danielhollas could you also approve this one please? 🙏

@danielhollas

Copy link
Copy Markdown
Contributor

Yrp, will do do after lunch

@danielhollas danielhollas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yakutovicha!

Comment thread home/node_preview.py Outdated
yakutovicha and others added 2 commits June 2, 2026 16:37
Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
@yakutovicha
yakutovicha merged commit c33d49b into main Jun 2, 2026
4 checks passed
@yakutovicha
yakutovicha deleted the update/make-awb-soft-dependency branch June 2, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants