Skip to content

Commit

Permalink
refactor to work with jupyter_server
Browse files Browse the repository at this point in the history
  • Loading branch information
Zsailer committed Jun 26, 2019
1 parent 5dfb744 commit 388121a
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 438 deletions.
2 changes: 1 addition & 1 deletion etc/jupyter/jupyter_server_config.d/voila.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"voila.server_extension": true
"voila": true
}
}
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def get_data_files():
},
'entry_points': {
'console_scripts': [
'voila = voila.app:main'
'jupyter-voila = voila.app:main'
]
},
'install_requires': [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

{%- block html_head_js -%}

<script src="{{resources.base_url}}voila/static/jquery.min.js"></script>
<script src="{{resources.base_url}}static/voila/jquery.min.js"></script>

<script id="jupyter-config-data" type="application/json">
{
Expand All @@ -34,15 +34,18 @@
{% block footer %}
{% block footer_js %}
<script
src="{{resources.base_url}}voila/static/require.min.js"
src="{{resources.base_url}}static/voila/require.min.js"
integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA="
crossorigin="anonymous">
</script>
<script>
requirejs.config({ baseUrl: '{{resources.base_url}}voila/', waitSeconds: 30})
requirejs.config({
baseUrl: '{{resources.base_url}}static/voila/',
waitSeconds: 30
})
requirejs(
[
"static/main",
"main",
{% for ext in resources.nbextensions -%}
"{{resources.base_url}}voila/nbextensions/{{ ext }}.js",
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
{% from 'mathjax.tpl' import mathjax %}

{%- block html_head_css -%}
<link rel="stylesheet" type="text/css" href="{{resources.base_url}}voila/static/index.css"></link>
<link rel="stylesheet" type="text/css" href="{{resources.base_url}}static/voila/index.css"></link>

{% if resources.theme == 'dark' %}
<link rel="stylesheet" type="text/css" href="{{resources.base_url}}voila/static/theme-dark.css"></link>
<link rel="stylesheet" type="text/css" href="{{resources.base_url}}static/voila/theme-dark.css"></link>
{% else %}
<link rel="stylesheet" type="text/css" href="{{resources.base_url}}voila/static/theme-light.css"></link>
<link rel="stylesheet" type="text/css" href="{{resources.base_url}}static/voila/theme-light.css"></link>
{% endif %}

{% for css in resources.inlining.css %}
Expand Down
2 changes: 1 addition & 1 deletion share/jupyter/voila/templates/default/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
****************************************************************************/

// NOTE: this file is not transpiled, async/await is the only modern feature we use here
require(['static/voila'], function(voila) {
require(['voila'], function(voila) {
// requirejs doesn't like to be passed an async function, so create one inside
(async function() {
var kernel = await voila.connectKernel()
Expand Down
3 changes: 2 additions & 1 deletion voila/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#############################################################################

from ._version import __version__ # noqa
from .server_extension import load_jupyter_server_extension # noqa
from .app import Voila # noqa

load_jupyter_server_extension = Voila.load_jupyter_server_extension

def _jupyter_nbextension_paths():
return [dict(
Expand Down
Loading

0 comments on commit 388121a

Please sign in to comment.