superstar54 / weas-widget

A widget to visualize and edit atomic structures in Jupyter Notebook
https://weas-widget.readthedocs.io/en/latest/index.html
MIT License
19 stars 3 forks source link

pre-compile widget? #41

Closed ltalirz closed 5 months ago

ltalirz commented 6 months ago

I'm not sure what is happening exactly, but the first time I try to run the quickstart

from ase.build import molecule
from weas_widget import WeasWidget
atoms = molecule("C2H6SO")
viewer = WeasWidget()
viewer.from_ase(atoms)
viewer

it took more than 30 seconds on a reasonably fast machine (M1 Macbook Air), which is enough to make a new user think the widget is broken.

This only happens the first time; I suspect it is compiling something in the background?

Perhaps this is necessary for installing from source, but this happened for installing the package from PyPI. Is it possible to do ship the widget already precompiled in this case?

superstar54 commented 6 months ago

This is because it downloads the weas library for the first time, then cashing by the browser for later usage. Since the Python widget and JS library are developed in separate repositories, widget imports the URL for simplicity.

it took more than 30 seconds on a reasonably fast machine (M1 Macbook Air), which is enough to make a new user think the widget is broken.

I agree. I think we can bundle the WEAS library localy and publish the package to PyPI.

ltalirz commented 6 months ago

Yes, having the package work without an internet connection is also an important criterion in some scenarios