Comments (7)
What happens if you, do this?
from lazy_loader import extension, pn
extension()
pn.template.FastListTemplate(title="Hello", main=["world"]).servable()
from panel.
Lazy loading is tricky. Maybe try to take a look at how polars does it here: https://github.com/pola-rs/polars/blob/main/py-polars/polars/dependencies.py
from panel.
The problem is that template
is not imported in __init__.py
:-) I'm working on a PR. But I need to figure out how to add test first.
from panel.
from lazy_loader import extension, pn extension() pn.template.FastListTemplate(title="Hello", main=["world"]).servable()
The problem is still there.
from panel.
This pytest will replicate issue
import importlib.util
import sys
def lazy_import(name):
spec = importlib.util.find_spec(name)
loader = importlib.util.LazyLoader(spec.loader)
spec.loader = loader
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
loader.exec_module(module)
return module
def test_pn_template():
lazy_import("panel")
import panel as pn
assert hasattr(pn, "template")
from panel.
Additional Context: Also issue for static analysis
The cause is that template
is not imported in __init__
. This also means that static analysis cannot discover it and an error is highlighted like below.
from panel.
Thanks @philippjfr
Unfortunately I start seeing more of these issues. If I lazy import holoviews then it starts failing because of below.
Do you think these are issues that can and should be solved? Or are they not issues and I should not try to use lazy loading?
I would really like to lazy load panel and holoviews as they add 3s to import time! And that is a lot of import time in a cli tool or if users are constantly running script that imports these packages.
I think these issue would have been identified if we where running mypy on the code base.
from panel.
Related Issues (20)
- cache func.clear() is clearing another function
- Possible Open Redirect Vulnerability
- Cannot sync Tabulator.value to url - DataFrame is not JSON serializable
- [Build] Minified PlotlyPlot can't be downloaded HOT 2
- Allow panel serve of notebook that starts with magics
- Pyodide Conversion: requirements.txt not able to deal with wheel-urls HOT 2
- Pyodide Conversion: add ability to include resources for the panel app HOT 1
- Pyodide Conversion: Bundle all the necessary ressources to load from a single webserver HOT 1
- MenuButton with custom Panel objects
- Apps on front page have 503 Service Temporarily Unavailable
- Multi-index columns all blank in Tabulator
- Select options not visible when using MaterialTemplate dark theme
- Plotly plots not displayed when Plotly extension loaded after Bokeh's on a website HOT 2
- reacton failed to load in docs
- Make Panel Chat Interface callback not require user and instance args
- Tabulator with frozen_rows scrolling/paging to top when updating content HOT 4
- In the Reactive HTML doc page, 2 hyperlinks are missing.
- Improve experience for Multifile/Folder Upload
- Can't update message reaction icons after click
- Save layout yields blank html HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panel.