AnswerDotAI / AnswerDotAI/nbdev

Add option to expand wildcard imports

Open
#656 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jupyter Notebook
Stars
5.3k
Forks
513
Avg merge
2d 30m
Merged PRs (30d)
8

Description

E.g

from foo import *

...would be optionally exported to:

from foo import a,b

...if `a` and `b` were used in that module.

There's something a bit similar here we could borrow ideas from: https://github.com/fake-name/autoflake/blob/master/autostar.py

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how nbdev handles Python imports and compare the requested behavior with the ideas in autoflake's autostar.py. Define the optional expansion for `from foo import *` so only names used in the module are exported, then verify the generated import matches the example and preserves current behavior when the option is disabled.

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.