meta-pytorch / meta-pytorch/data

[BE] Add lazy_import

Open
#95 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Better Engineering
Dominant language
Python
Stars
1.3k
Forks
179
Avg merge
6d 1h
Merged PRs (30d)
2

Description

🚀 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the referenced torchdata/datapipes/iter/load/iopath.py import pattern and inspect how similar third-party imports are handled elsewhere. Define the utility's error messages and behavior for from ... import ... as ... and import xxx.yyy, then add coverage for each required form and verify the existing test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.