The following question is emerging from two different workstreams, deep learning and pywatts.
How do we deal with mtypes that rely on soft dependencies? In the datatypes module.
Example 1: xarray (series, panel, and hierarchical), as used in pywatts. FYI @benHeid, @kalebphipps, @SMEISEN
Related: #2655
Example 2: ListDataset (panel data), as used in gluonts. FYI @TNTran92, @AurumnPegasus, @ltsaprounis.
Related: #2893
The main problem is that adding examples naively, as of now, would attach the soft dependency imports to large parts of the datatypes module.
Some ways out:
- encapsulation as fixtures, similar to
pytest, or directly via pytest, with imports inside the fixture. Plus, calling fixtures only when soft dependencies are installed.
- relying on checks that does not import, or only imports late. E.g., instead of
isinstance(obj, ListDataset), use type(obj).__name__ == "ListDataset" etc.
Any good ideas?
The following question is emerging from two different workstreams, deep learning and pywatts.
How do we deal with mtypes that rely on soft dependencies? In the
datatypesmodule.Example 1:
xarray(series, panel, and hierarchical), as used inpywatts. FYI @benHeid, @kalebphipps, @SMEISENRelated: #2655
Example 2:
ListDataset(panel data), as used ingluonts. FYI @TNTran92, @AurumnPegasus, @ltsaprounis.Related: #2893
The main problem is that adding examples naively, as of now, would attach the soft dependency imports to large parts of the
datatypesmodule.Some ways out:
pytest, or directly viapytest, with imports inside the fixture. Plus, calling fixtures only when soft dependencies are installed.isinstance(obj, ListDataset), usetype(obj).__name__ == "ListDataset"etc.Any good ideas?