[BE] Add lazy_import
See original GitHub issue🚀 Feature
Currently we used import
in each DataPipe class to make lazy importing happens like
https://github.com/pytorch/data/blob/4802a350d1bf954d0785e0f22fd1fcde2deded76/torchdata/datapipes/iter/load/iopath.py#L21-L29
As more potential libraries used in TorchData to support different functionalities, we could add a methods to support lazy import module to global namespace. Then, we don’t need to duplicate the import
inside each class used the same third-party module.
Features needed:
- Error message generation
- Support
from ... import ... as ...
- Support submodule lazy import
import xxx.yyy
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Code-Splitting - React
The React.lazy function lets you render a dynamic import as a regular component. Before: import OtherComponent from './OtherComponent';. After:.
Read more >Lazy Loading React Components (with react.lazy and suspense)
Head to the index.js file and import lazy and suspense from react like ... Below is the syntax for adding suspense component to...
Read more >Lazy loading React components - LogRocket Blog
React.lazy() is a function that enables you to render a dynamic import as a regular component. Dynamic imports are a way of code-splitting, ......
Read more >React Lazy Loading: The Best Complete Guide - CopyCat Blog
`React lazy()` makes it easy to render react components that are imported using the dynamic import() technique. The components are rendered as ...
Read more >Lazy loading in React - LoginRadius Blog
We will perform lazy loading with React suspense and without it. First of all, create the app using npm create-react-app npm create-react-app my-app....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So you want to stick with the current, but wrap up the try/except logic?
Yeah, you are right. The Error should be raised at the first place. Otherwise, it should be a bug.