aiidalab / ipyoptimade

Import structures in jupyter notebook using OPTIMADE
MIT License
2 stars 1 forks source link

Make ase an optional dependency #20

Open danielhollas opened 5 months ago

danielhollas commented 5 months ago

It seems that when converting from optimade-client, dependency on ase was added. Was there a specific reason for that? ase brings a lot of other dependencies (matplotlib, scipy) that are not needed here.

It only seems to be used in src/ipyoptimade/subwidgets/summary.py, but is only imported if available. So perhaps it would be better to have ase as an extras dependency?

https://github.com/aiidalab/ipyoptimade/blob/07ff9587b5a3a8e4b872aa90364ff91e30be9905/src/ipyoptimade/summary.py#L12

CC @unkcpz

unkcpz commented 5 months ago

The ase is required to render the structure of the queried results. If the package not installed the notebook will show nothing in the output widget. The reason is that the ase structure object is used as the middle format that can be then converted to other format (.cif, xyz etc.). Although optimade python package has its own Structure object as the middle format, but it used to has some problem with 1D/2D rendering. Usually the ase structure is more robust as the middle structure (for instance https://github.com/Materials-Consortia/optimade-python-tools/issues/1212).

Let's keep this issue open and I'll come back to see if we can using optimade structure object and make ase structure optional.