legend-exp / legend-pydataobj

LEGEND Python Data Objects
https://legend-pydataobj.readthedocs.io
GNU General Public License v3.0
1 stars 9 forks source link

Handling package dependencies required by `LGDO.view_as()` #48

Open gipert opened 11 months ago

gipert commented 11 months ago

We should make all packages required by view_as() optional, so we need some way to emit an error if you try to view data with an uninstalled package.

This could especially help with making this extensible if people want to plug it into more niche data classes. An interesting example is that we could plug this into ROOT's RDataFrame via this class: https://root.cern.ch/doc/master/classROOT_1_1Internal_1_1RDF_1_1RNumpyDS.html, and I don't think we want ROOT as a hard requirement.

This will also improve the package import time.

MoritzNeuberger commented 10 months ago

How do you think this should be implemented? Should we add an additional option to [options.extras_require] called view_as, which contains the dependencies of awkward, pandas, etc.? I wonder because functions other than view_as also use these packages. Should this extra requirement be explicit for additional external formats like RDataFrame?

gipert commented 10 months ago

I would go through the code base and check which of these third-party libraries are actually used elsewhere. We could then group those that are only used in view_as() in a group called extras or something:

pip install legend-pydataobj[extras]

CC @iguinn