holoviz / holoviz/hvplot

Improve performance of `import hvplot` by lazily loading dependencies

Open
#1,252 8 comments 6 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### Is your feature request related to a problem? Please describe.

Importing `hvplot` takes around 1,5 seconds on my machine. That's relatively slow.

I ran into this issue when trying to plot a DataFrame in Polars. The first time you run `df.plot` is remarkably slow.

#### Describe the solution you'd like

hvplot seems to be importing a lot of unnecessary things on the first import. By utilizing lazy imports, functionality is only imported when used, which is more efficient. I think this is really important for a library such as hvplot which intends to support all kinds of backends.

#### Describe alternatives you've considered

I am no export on this topic, so I don't really know the best way to solve it. But in Polars we have greatly reduced our import times using lazy loading. The following module does the heavy lifting:
https://github.com/pola-rs/polars/blob/main/py-polars/polars/dependencies.py

#### Additional context

I reported the issue at the Polars repo initially, there is some context there:
https://github.com/pola-rs/polars/issues/13500#issuecomment-1880078547

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.