NVIDIA-NeMo / NVIDIA-NeMo/DataDesigner

Conflicting guidance on lazy heavy imports

Open Beginner friendly
#759 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triaged
Dominant language
Python
Stars
2.2k
Forks
211
Avg merge
2d 6h
Merged PRs (30d)
40

Description

Summary

STYLEGUIDE.md and lazy_heavy_imports.py give conflicting guidance on importing heavy third-party libraries. The two sources should be aligned to clarify the expected pattern to use when writing new code.

The style guide

STYLEGUIDE.md notes that large dependencies should be lazy-loaded by importing the library alias from the data_designer.lazy_heavy_imports module:

https://github.com/NVIDIA-NeMo/DataDesigner/blob/7c2c15e3acfa716fc9de86d9b05fc4793962d9ca/STYLEGUIDE.md?plain=1#L145-L147

STYLEGUIDE.md also explains that any newly added heavy dependencies (e.g., your_lib) should use that same pattern:

https://github.com/NVIDIA-NeMo/DataDesigner/blob/7c2c15e3acfa716fc9de86d9b05fc4793962d9ca/STYLEGUIDE.md?plain=1#L176

The module docstring

In lazy_heavy_imports.py, the docstring warns against the exact pattern that STYLEGUIDE.md recommended:

https://github.com/NVIDIA-NeMo/DataDesigner/blob/7c2c15e3acfa716fc9de86d9b05fc4793962d9ca/packages/data-designer-config/src/data_designer/lazy_heavy_imports.py#L19-L21

Proposed resolution

Align both documentation sources to the same pattern to avoid confusion about which method is preferable, i.e., either importing the library alias from lazy_heavy_imports:

from data_designer.lazy_heavy_imports import pd, np 

or importing the lazy_heavy_imports module and accessing its attributes at runtime:

import data_designer.lazy_heavy_imports as lazy

# ...when needed in the code:
df = lazy.pd.DataFrame(...)

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

Read the guidance around lines 145-147 and 176 in STYLEGUIDE.md, then compare it with the docstring around lines 19-21 of packages/data-designer-config/src/data_designer/lazy_heavy_imports.py. Determine which lazy-import pattern the project wants to recommend, update both sources consistently, and verify that the examples and warnings no longer conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.