6 ms·
One interesting use case of overwriting `builtins.__import__` I've encountered was the automatic hooking by ClearML [0] (experiment tracking, ...) into all sort
by AdrianoKF 5y ago
One interesting use case of overwriting `builtins.__import__` I've encountered was the automatic hooking by ClearML [0] (experiment tracking, ...) into all sorts of common libraries like Matplotlib, Tensorflow, Pytorch, and friends.
The implementation is surprisingly straightforward, once you've come to terms with the basic idea, see [1] and the rest of the `clearml.binding` package.
[0]: https://clear.ml https://clear.ml
[1]: https://github.com/allegroai/clearml/blob/master/clearml/binding/import_bind.py https://github.com/allegroai/clearml/blob/master/clearml/bin...