Skip to content

should not import optional dependencies until actually necessary #176

@yarikoptic

Description

@yarikoptic

while troubleshooting some awkward side effect of my app failing as far as I import tqdm, I discovered that tqdm unconditionally imports ipython (and probably other functionality if present, such as pandas) even if I have no intent on using it. It adds quite quite an overhead to the import, e.g.

with ipython installed/available

buildbot@922f7d817f64:~/build-custom$ time python -c 'import tqdm'

real    0m0.194s
user    0m0.168s
sys     0m0.020s

without:

(venv-ci) buildbot@922f7d817f64:~/build-custom$ time python -c 'import tqdm'

real    0m0.057s
user    0m0.040s
sys     0m0.012s

i.e. having ipython available contributes now almost 300% penalty
I guess ideally all those imports should happen only if related functionality is requested

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions