-
-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build pyodide wheels and load from CDN (#3858)
- Loading branch information
1 parent
11d5833
commit 1a2be00
Showing
18 changed files
with
141 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
from jinja2.loaders import FileSystemLoader | ||
from markupsafe import Markup | ||
|
||
from ..config import config | ||
from ..util import isurl, url_path | ||
from .state import state | ||
|
||
|
@@ -59,19 +60,19 @@ def conffilter(value): | |
ERROR_TEMPLATE = _env.get_template('error.html') | ||
DEFAULT_TITLE = "Panel Application" | ||
JS_RESOURCES = _env.get_template('js_resources.html') | ||
CDN_DIST = f"https://unpkg.com/@holoviz/panel@{js_version}/dist/" | ||
CDN_DIST = f"{config.npm_cdn}/@holoviz/panel@{js_version}/dist/" | ||
DOC_DIST = "https://panel.holoviz.org/_static/" | ||
LOCAL_DIST = "static/extensions/panel/" | ||
COMPONENT_PATH = "components/" | ||
|
||
CSS_URLS = { | ||
'font-awesome': 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css', | ||
'bootstrap4': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' | ||
'bootstrap4': f'{config.npm_cdn}/[email protected]/dist/css/bootstrap.min.css' | ||
} | ||
|
||
JS_URLS = { | ||
'jQuery': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js', | ||
'bootstrap4': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js' | ||
'jQuery': f'{config.npm_cdn}/[email protected]/dist/jquery.slim.min.js', | ||
'bootstrap4': f'{config.npm_cdn}/[email protected]/dist/js/bootstrap.bundle.min.js' | ||
} | ||
|
||
extension_dirs['panel'] = str(DIST_DIR) | ||
|
@@ -318,8 +319,6 @@ def js_modules(self): | |
from ..config import config | ||
modules = list(config.js_modules.values()) | ||
self.extra_resources(modules, '__javascript_modules__') | ||
|
||
|
||
return modules | ||
|
||
@property | ||
|
@@ -365,6 +364,9 @@ def __init__(self, **kwargs): | |
self.js_modules = kwargs.pop("js_modules", js_modules) | ||
super().__init__(**kwargs) | ||
|
||
def _replace_cdn(self, resources): | ||
return [resource.replace('https://unpkg.com', config.npm_cdn) for resource in resources] | ||
|
||
@classmethod | ||
def from_bokeh(cls, bk_bundle): | ||
return cls( | ||
|
@@ -377,6 +379,6 @@ def from_bokeh(cls, bk_bundle): | |
|
||
def _render_js(self): | ||
return JS_RESOURCES.render( | ||
js_raw=self.js_raw, js_files=self.js_files, | ||
js_modules=self.js_modules, hashes=self.hashes | ||
js_raw=self.js_raw, js_files=self._replace_cdn(self.js_files), | ||
js_modules=self._replace_cdn(self.js_modules), hashes=self.hashes | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
import param | ||
|
||
from ..config import config | ||
from ..io.resources import bundled_files | ||
from ..reactive import ReactiveHTML | ||
from ..util import classproperty | ||
|
@@ -103,17 +104,17 @@ class GridStack(ReactiveHTML, GridSpec): | |
} | ||
|
||
__css_raw__ = [ | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack.min.css', | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack-extra.min.css' | ||
f'{config.npm_cdn}/[email protected]/dist/gridstack.min.css', | ||
f'{config.npm_cdn}/[email protected]/dist/gridstack-extra.min.css' | ||
] | ||
|
||
__javascript_raw__ = [ | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack-h5.js' | ||
f'{config.npm_cdn}/[email protected]/dist/gridstack-h5.js' | ||
] | ||
|
||
__js_require__ = { | ||
'paths': { | ||
'gridstack': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack-h5' | ||
'gridstack': f'{config.npm_cdn}/[email protected]/dist/gridstack-h5' | ||
}, | ||
'exports': { | ||
'gridstack': 'GridStack' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
) | ||
from bokeh.models import ColumnDataSource, HTMLBox | ||
|
||
from ..config import config | ||
from ..io.resources import bundled_files | ||
from ..util import classproperty | ||
|
||
|
@@ -30,12 +31,12 @@ def __css__(cls): | |
return bundled_files(cls, 'css') | ||
|
||
__javascript_raw__ = [ | ||
"https://unpkg.com/[email protected]/dist/h3-js.umd.js", | ||
"https://cdn.jsdelivr.net/npm/[email protected]/dist.min.js", | ||
"https://cdn.jsdelivr.net/npm/@deck.gl/[email protected]/dist.min.js", | ||
"https://cdn.jsdelivr.net/npm/@loaders.gl/[email protected]/dist/dist.min.js", | ||
"https://cdn.jsdelivr.net/npm/@loaders.gl/[email protected]/dist/dist.min.js", | ||
"https://cdn.jsdelivr.net/npm/@loaders.gl/[email protected]/dist/dist.min.js", | ||
f"{config.npm_cdn}/[email protected]/dist/h3-js.umd.js", | ||
f"{config.npm_cdn}/[email protected]/dist.min.js", | ||
f"{config.npm_cdn}/@deck.gl/[email protected]/dist.min.js", | ||
f"{config.npm_cdn}/@loaders.gl/[email protected]/dist/dist.min.js", | ||
f"{config.npm_cdn}/@loaders.gl/[email protected]/dist/dist.min.js", | ||
f"{config.npm_cdn}/@loaders.gl/[email protected]/dist/dist.min.js", | ||
"https://api.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.js", | ||
] | ||
|
||
|
@@ -52,13 +53,13 @@ def __js_skip__(cls): | |
|
||
__js_require__ = { | ||
'paths': OrderedDict([ | ||
("h3", "https://unpkg.com/[email protected]/dist/h3-js.umd"), | ||
("deck-gl", "https://cdn.jsdelivr.net/npm/[email protected]/dist.min"), | ||
("deck-json", "https://cdn.jsdelivr.net/npm/@deck.gl/[email protected]/dist.min"), | ||
("loader-csv", "https://cdn.jsdelivr.net/npm/@loaders.gl/[email protected]/dist/dist.min"), | ||
("loader-json", "https://cdn.jsdelivr.net/npm/@loaders.gl/[email protected]/dist/dist.min"), | ||
("loader-tiles", "https://cdn.jsdelivr.net/npm/@loaders.gl/[email protected]/dist/dist.min"), | ||
("mapbox-gl", 'https://cdn.jsdelivr.net/npm/[email protected]/dist/mapbox-gl.min'), | ||
("h3", f"{config.npm_cdn}/[email protected]/dist/h3-js.umd"), | ||
("deck-gl", f"{config.npm_cdn}/[email protected]/dist.min"), | ||
("deck-json", f"{config.npm_cdn}/@deck.gl/[email protected]/dist.min"), | ||
("loader-csv", f"{config.npm_cdn}/@loaders.gl/[email protected]/dist/dist.min"), | ||
("loader-json", f"{config.npm_cdn}/@loaders.gl/[email protected]/dist/dist.min"), | ||
("loader-tiles", f"{config.npm_cdn}/@loaders.gl/[email protected]/dist/dist.min"), | ||
("mapbox-gl", f"{config.npm_cdn}/[email protected]/dist/mapbox-gl.min"), | ||
]), | ||
'exports': {"deck-gl": "deck", "mapbox-gl": "mapboxgl", "h3": "h3"}, | ||
'shim': { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
) | ||
from bokeh.models import LayoutDOM | ||
|
||
from ..config import config | ||
from ..io.resources import bundled_files | ||
from ..util import classproperty | ||
|
||
|
@@ -17,8 +18,8 @@ class ECharts(LayoutDOM): | |
""" | ||
|
||
__javascript_raw__ = [ | ||
"https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js", | ||
"https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts-gl.min.js" | ||
f"{config.npm_cdn}/[email protected]/dist/echarts.min.js", | ||
f"{config.npm_cdn}/[email protected]/dist/echarts-gl.min.js" | ||
] | ||
|
||
@classproperty | ||
|
@@ -33,8 +34,8 @@ def __js_skip__(cls): | |
|
||
__js_require__ = { | ||
'paths': { | ||
"echarts": "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min", | ||
"echarts-gl": "https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts-gl.min.js" | ||
"echarts": f"{config.npm_cdn}/[email protected]/dist/echarts.min", | ||
"echarts-gl": f"{config.npm_cdn}/[email protected]/dist/echarts-gl.min.js" | ||
}, | ||
'exports': {} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
from bokeh.events import ModelEvent | ||
from bokeh.models import HTMLBox | ||
|
||
from ..config import config | ||
from ..io.resources import bundled_files | ||
from ..util import classproperty | ||
|
||
|
@@ -40,15 +41,15 @@ class JSONEditor(HTMLBox): | |
templates = List(Any) | ||
|
||
__javascript_raw__ = [ | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min.js' | ||
f"{config.npm_cdn}/[email protected]/dist/jsoneditor.min.js" | ||
] | ||
|
||
__css_raw__ = [ | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/jsoneditor.min.css' | ||
f"{config.npm_cdn}/[email protected]/dist/jsoneditor.min.css" | ||
] | ||
|
||
__resources__ = [ | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/img/jsoneditor-icons.svg' | ||
f"{config.npm_cdn}/[email protected]/dist/img/jsoneditor-icons.svg" | ||
] | ||
|
||
@classproperty | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
""" | ||
from bokeh.models import Markup | ||
|
||
from ..config import config | ||
|
||
|
||
class KaTeX(Markup): | ||
""" | ||
|
@@ -13,7 +15,7 @@ class KaTeX(Markup): | |
|
||
__javascript__ = [ | ||
"https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js", | ||
"https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" | ||
f"{config.npm_cdn}/[email protected]/dist/contrib/auto-render.min.js" | ||
] | ||
|
||
__js_skip__ = { | ||
|
@@ -23,7 +25,8 @@ class KaTeX(Markup): | |
|
||
__js_require__ = { | ||
'paths': { | ||
'katex': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min', | ||
'autoLoad': 'https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min'}, | ||
'katex': "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min", | ||
'autoLoad': f"{config.npm_cdn}/[email protected]/dist/contrib/auto-render.min" | ||
}, | ||
'exports': {'katex': 'katex', 'autoLoad': 'renderMathInElement'} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
) | ||
from bokeh.models import ColumnDataSource, HTMLBox | ||
|
||
from ..config import config | ||
|
||
|
||
class Perspective(HTMLBox): | ||
|
||
|
@@ -38,10 +40,10 @@ class Perspective(HTMLBox): | |
|
||
# pylint: disable=line-too-long | ||
__javascript__ = [ | ||
"https://unpkg.com/@finos/[email protected]/dist/umd/perspective.js", | ||
"https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer.js", | ||
"https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-datagrid.js", | ||
"https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-d3fc.js", | ||
f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective.js", | ||
f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective-viewer.js", | ||
f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective-viewer-datagrid.js", | ||
f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective-viewer-d3fc.js", | ||
] | ||
|
||
__js_skip__ = { | ||
|
@@ -50,10 +52,10 @@ class Perspective(HTMLBox): | |
|
||
__js_require__ = { | ||
"paths": { | ||
"perspective": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective", | ||
"perspective-viewer": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer", | ||
"perspective-viewer-datagrid": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-datagrid", | ||
"perspective-viewer-d3fc": "https://unpkg.com/@finos/[email protected]/dist/umd/perspective-viewer-d3fc", | ||
"perspective": f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective", | ||
"perspective-viewer": f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective-viewer", | ||
"perspective-viewer-datagrid": f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective-viewer-datagrid", | ||
"perspective-viewer-d3fc": f"{config.npm_cdn}/@finos/[email protected]/dist/umd/perspective-viewer-d3fc", | ||
}, | ||
"exports": { | ||
"perspective": "perspective", | ||
|
@@ -63,4 +65,4 @@ class Perspective(HTMLBox): | |
}, | ||
} | ||
|
||
__css__ = ["https://unpkg.com/@finos/[email protected]/dist/css/themes.css"] | ||
__css__ = [f"{config.npm_cdn}/@finos/[email protected]/dist/css/themes.css"] |
Oops, something went wrong.