class benchopt.safe_import_context#

Context used to manage import in benchmarks.

This context allows to avoid errors on ImportError, to be able to report that a solver/dataset is not installed.

Moreover, this context also allows to skip the import when simply listing all solvers, for benchmark’s installation or auto completion. Note that all costly imports should be protected with this import for benchopt to perform best.

Finally, this context also catches import warnings.