Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly load plotly and vega libraries #309

Merged
merged 12 commits into from
Mar 16, 2019
Merged

Correctly load plotly and vega libraries #309

merged 12 commits into from
Mar 16, 2019

Conversation

philippjfr
Copy link
Member

Previously I used some horrible code to load plotly and vega dynamically when the models are used. Not only is this horrible, it also doesn't seem to work when exported in a notebook. This PR instead uses the __javascript__ variable on the models, which loads vega and plotly js when the extension is loaded. To avoid it being loaded all the time these models are no longer imported by default, instead the corresponding Pane objects do the import dynamically. This works fine in server and commandline use cases but in the notebook the models need to be imported before the extension is run. Therefore I have added the ability to load these models via the extension, much like in holoviews. So you can now do pn.extension('vega') and it will load vega js in the notebook.

@codecov-io
Copy link

codecov-io commented Mar 16, 2019

Codecov Report

Merging #309 into master will increase coverage by 0.17%.
The diff coverage is 73.46%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #309      +/-   ##
==========================================
+ Coverage    89.1%   89.28%   +0.17%     
==========================================
  Files          63       65       +2     
  Lines        6583     6617      +34     
==========================================
+ Hits         5866     5908      +42     
+ Misses        717      709       -8
Impacted Files Coverage Δ
panel/models/__init__.py 100% <ø> (ø) ⬆️
setup.py 0% <0%> (ø) ⬆️
panel/tests/test_vega.py 96.61% <100%> (ø) ⬆️
panel/tests/test_plotly.py 97.46% <100%> (ø) ⬆️
panel/pane/base.py 90.8% <100%> (+0.21%) ⬆️
panel/models/vega.py 100% <100%> (ø)
panel/models/plotly.py 100% <100%> (ø)
panel/io.py 66.77% <20%> (-0.47%) ⬇️
panel/pane/plotly.py 86.95% <57.14%> (-3.52%) ⬇️
panel/pane/vega.py 78.37% <70%> (-1.93%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7c3a49...a6e9898. Read the comment docs.

@philippjfr philippjfr merged commit 966ca9a into master Mar 16, 2019
@philippjfr philippjfr deleted the load_extensions branch September 9, 2019 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants