Skip to content

[ENH] How to deal with mtypes that have soft dependencies? #2957

@fkiraly

Description

@fkiraly

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?

Metadata

Metadata

Assignees

Labels

API designAPI design & software architectureenhancementAdding new functionalitymodule:datatypesdatatypes module: data containers, checkers & converters

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions