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

[REF] convenience commands for testing against a local kernel #425

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions development.html

This file was deleted.

52 changes: 52 additions & 0 deletions development/binder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css" />
<!-- Configure and load Thebe !-->
<!-- two config sections: first binder, second local
switch which one has type="text/x-thebe-config"
to activate it
-->
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/requirements",
},
codeMirrorConfig: {
"theme": "abcdef"
},
}
</script>
<script src="../lib/index.js"></script>
</head>
<body>
<div class="container">
<button id="activateButton">Activate</button>
<script>
var bootstrapThebe = function () {
thebelab.bootstrap();
};

document
.querySelector("#activateButton")
.addEventListener("click", bootstrapThebe);
</script>

<pre data-executable="true" data-language="python" class="pre-element">
print("Hello!")</pre
>
<pre data-executable="true" data-language="python" class="pre-element">
from IPython.display import Math
Math("$x = 5$")
</pre
>
<pre data-executable="true" data-language="python" class="pre-element">
from ipywidgets import IntSlider
w = IntSlider(0, 10)
w
</pre
>
</div>
</body>
</html>
70 changes: 70 additions & 0 deletions development/local.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css" />
<!-- use this one (and set the token!) for local testing (much faster)
e.g.
jupyter notebook \
--NotebookApp.token=thebe-test-secret \
--NotebookApp.allow_origin='http://127.0.0.1:8080'
-->
<script type="text/x-thebe-config">
{
requestKernel: true,
kernelOptions: {
name: "python3",
path: ".",
// notebook server configuration; not needed with binder
serverSettings: {
"baseUrl": "http://127.0.0.1:8888",
"token": "thebe-test-secret",
},
},
codeMirrorConfig: {
"theme": "abcdef"
},
}
</script>
<script src="../lib/index.js"></script>
</head>
<body>
<div class="container">
<div>
<p>
For development against a local kernel, you need to start Jupyter with
the expected token:
</p>
<pre>
jupyter notebook \
--NotebookApp.token=thebe-test-secret \
--NotebookApp.allow_origin='http://127.0.0.1:8080'
</pre
>
</div>
<button id="activateButton">Activate</button>
<script>
var bootstrapThebe = function () {
thebelab.bootstrap();
};

document
.querySelector("#activateButton")
.addEventListener("click", bootstrapThebe);
</script>
<pre data-executable="true" data-language="python" class="pre-element">
print("Hello!")</pre
>
<pre data-executable="true" data-language="python" class="pre-element">
from IPython.display import Math
Math("$x = 5$")
</pre
>
<pre data-executable="true" data-language="python" class="pre-element">
from ipywidgets import IntSlider
w = IntSlider(0, 10)
w
</pre
>
</div>
</body>
</html>
30 changes: 30 additions & 0 deletions development/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
body {
margin: 0;
}
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
#activateButton {
width: 130px;
height: 50px;
font-size: 1.25em;
border: 1px solid black;
border-radius: 5px;
background-color: lightblue;
text-transform: uppercase;
}
.pre-element {
width: 50vw;
height: 20vh;
border: 2px solid #aaa;
border-radius: 4px;
margin-top: 8px;
margin-bottom: 8px;
}
.thebelab-cell {
width: 50vw;
}
Loading