j1-template 2022.4.1 → 2022.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/content_generator_article_navigator.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_blog_archive.html +1 -1
- data/_includes/themes/j1/layouts/content_generator_news_panel_posts.html +1 -1
- data/assets/themes/j1/adapter/js/nbinteract.js +11 -0
- data/assets/themes/j1/modules/bokeh/README.md +380 -0
- data/assets/themes/j1/modules/bokeh/js/v2.4.3/bokeh.min.js +596 -0
- data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.css +7 -0
- data/assets/themes/j1/modules/nbInteract/css/theme/uno/nbinteract-core.min.css +1 -1
- data/assets/themes/j1/modules/vega/js/vega/LICENSE +27 -0
- data/assets/themes/j1/modules/vega/js/vega/README.md +42 -0
- data/assets/themes/j1/modules/vega/js/vega/vega-core.js +34550 -0
- data/assets/themes/j1/modules/vega/js/vega/vega-core.min.js +2 -0
- data/assets/themes/j1/modules/vega/js/vega/vega-core.min.js.map +1 -0
- data/assets/themes/j1/modules/vega/js/vega/vega.js +49095 -0
- data/assets/themes/j1/modules/vega/js/vega/vega.min.js +2 -0
- data/assets/themes/j1/modules/vega/js/vega/vega.min.js.map +1 -0
- data/assets/themes/j1/modules/vega/js/vega-embed/LICENSE +27 -0
- data/assets/themes/j1/modules/vega/js/vega-embed/README.md +230 -0
- data/assets/themes/j1/modules/vega/js/vega-embed/vega-embed.js +6607 -0
- data/assets/themes/j1/modules/vega/js/vega-embed/vega-embed.js.map +1 -0
- data/assets/themes/j1/modules/vega/js/vega-embed/vega-embed.min.js +21 -0
- data/assets/themes/j1/modules/vega/js/vega-embed/vega-embed.min.js.map +1 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/LICENSE +27 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/README.md +34 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/vega-lite-schema.json +30999 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/vega-lite.js +24585 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/vega-lite.js.map +1 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/vega-lite.min.js +2 -0
- data/assets/themes/j1/modules/vega/js/vega-lite/vega-lite.min.js.map +1 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/Gemfile +1 -1
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/nbinteract.yml +1 -1
- data/lib/starter_web/_data/modules/navigator_menu.yml +40 -23
- data/lib/starter_web/_data/modules/nbinteract.yml +314 -295
- data/lib/starter_web/_data/resources.yml +101 -0
- data/lib/starter_web/_plugins/lunr_index.rb +1 -1
- data/lib/starter_web/assets/images/modules/attics/wrongtog-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/attics/yellow-cactus-1920x1280.jpg +0 -0
- data/lib/starter_web/assets/images/modules/icons/bokeh/bokeh-32x32.ico +0 -0
- data/lib/starter_web/assets/images/modules/icons/bokeh/bokeh.ico +0 -0
- data/lib/starter_web/assets/images/modules/icons/bokeh/logo-160x160.png +0 -0
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/jupyter/examples/{j1-circular-times-table.adoc → distributed/j1-circular-times-table.adoc} +7 -2
- data/lib/starter_web/pages/public/jupyter/examples/{j1-interactive-widgets.adoc → distributed/j1-common-used-widgets.adoc} +14 -6
- data/lib/starter_web/pages/public/jupyter/examples/{j1-odes-in-python.adoc → distributed/j1-odes-in-python.adoc} +7 -2
- data/lib/starter_web/pages/public/jupyter/examples/{j1_climate-change-forecast.adoc → localized/j1_climate-change-forecast.adoc} +10 -5
- data/lib/starter_web/pages/public/jupyter/where_to_go.adoc +239 -0
- data/lib/starter_web/pages/public/learn/where_to_go.adoc +23 -7
- data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
- data/lib/starter_web/utilsrv/package.json +1 -1
- metadata +35 -30
- data/lib/starter_web/pages/public/jupyter/docs/_includes/attributes.asciidoc +0 -58
- data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +0 -232
- data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +0 -563
- data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +0 -465
- data/lib/starter_web/pages/public/jupyter/docs/nbinteract-doc.adoc +0 -473
- data/lib/starter_web/pages/public/jupyter/examples/j1-testing-plotly.adoc +0 -94
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_circular_times_table-checkpoint.ipynb +0 -12387
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +0 -1058
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +0 -14478
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +0 -738
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +0 -14478
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +0 -15227
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/factor_by_factor.mp4 +0 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/line_by_line.mp4 +0 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/j1/point_by_point.mp4 +0 -0
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_central_limit_theorem-checkpoint.ipynb +0 -247
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_variability_of_the_sample_mean-checkpoint.ipynb +0 -323
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -387
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +0 -185
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_layout-checkpoint.ipynb +0 -384
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_interact-checkpoint.ipynb +0 -254
- data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_tutorial_monty_hall-checkpoint.ipynb +0 -732
- data/lib/starter_web/pages/public/jupyter/services/binderhub.adoc +0 -564
- data/lib/starter_web/pages/public/jupyter/services/jupyterhub.adoc +0 -244
@@ -1,473 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: NBI docs
|
3
|
-
tagline: creating interactive websites
|
4
|
-
date: 2022-03-28 00:00:00
|
5
|
-
description: >
|
6
|
-
The package nbinteract aims to enable authors and educators to create and
|
7
|
-
share interactive web pages easily. Interactive explanations of concepts are
|
8
|
-
useful for communicating and explaining tricky concepts.
|
9
|
-
keywords: >
|
10
|
-
opensource, free, load, download, start, starter, example,
|
11
|
-
high, easy, use, secure, encrypt, standard, popular,
|
12
|
-
generate, create, learn, distribute, publish, deploy,
|
13
|
-
beginner, advanced, expert, student, learner, writer, reader, visitor
|
14
|
-
framework, toolkit, integration, extension, module, api,
|
15
|
-
dynamic, static, generator, client, server, internet, local, localhost
|
16
|
-
page, web, website, webdesign, material, design, responsive,
|
17
|
-
javascript, nodejs, ruby, windows, linux, osx, mac, os,
|
18
|
-
http, https, html, html5, css, scss, style,
|
19
|
-
browser, firefox, chrome, edge, opera, safari,
|
20
|
-
configuration, generator, navigation, menu, dropdown, fab, action, button
|
21
|
-
application, interface, provider, api, repository,
|
22
|
-
cookie, language, translation, gdpr, dsgvo, privacy,
|
23
|
-
asciidoc, aciidoctor, bootstrap, jekyll, liquid,
|
24
|
-
hyvor, disqus, git, github, netlify, heroku, apple, microsoft,
|
25
|
-
provider, service, internet, support,
|
26
|
-
google, analytics, advertising, search, console, silverlight, score,
|
27
|
-
j1, template, jekyllone, comment,
|
28
|
-
python, jupyter, notebook, textbook, api, app, nbinteract,
|
29
|
-
nbi, integration, binder, binderhub, jupyterhub
|
30
|
-
|
31
|
-
categories: [ Software, Python ]
|
32
|
-
tags: [ Binder, Jupyter, Notebooks ]
|
33
|
-
|
34
|
-
scrollbar: false
|
35
|
-
fab_menu_id: open_toc_reload
|
36
|
-
personalization: true
|
37
|
-
|
38
|
-
permalink: /pages/public/jupyter/textbooks/nbinteract-docs/
|
39
|
-
regenerate: false
|
40
|
-
|
41
|
-
resources: [ nbinteract, rouge ]
|
42
|
-
resource_options:
|
43
|
-
- attic:
|
44
|
-
padding_top: 400
|
45
|
-
padding_bottom: 50
|
46
|
-
opacity: 0.5
|
47
|
-
slides:
|
48
|
-
- url: /assets/images/modules/attics/john-schnobrich-2-1920x1280.jpg
|
49
|
-
alt: Photo by John Schnobrich on Unsplash
|
50
|
-
badge:
|
51
|
-
type: unsplash
|
52
|
-
author: John Schnobrich
|
53
|
-
href: https://unsplash.com/@johnschno
|
54
|
-
---
|
55
|
-
|
56
|
-
// Page Initializer
|
57
|
-
// =============================================================================
|
58
|
-
// Enable the Liquid Preprocessor
|
59
|
-
:page-liquid:
|
60
|
-
|
61
|
-
// Set (local) page attributes here
|
62
|
-
// -----------------------------------------------------------------------------
|
63
|
-
// :page--attr: <attr-value>
|
64
|
-
:badges-enabled: true
|
65
|
-
:binder-badge-enabled: false
|
66
|
-
:binder--home: https://mybinder.org/
|
67
|
-
:binder--docs: https://mybinder.readthedocs.io/en/latest/
|
68
|
-
:binder-app-launch--tree: https://mybinder.org/v2/gh/jekyll-one/j1-binder-repo/main?urlpath=/tree
|
69
|
-
|
70
|
-
// Load Liquid procedures
|
71
|
-
// -----------------------------------------------------------------------------
|
72
|
-
{% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
|
73
|
-
|
74
|
-
// Load page attributes
|
75
|
-
// -----------------------------------------------------------------------------
|
76
|
-
{% include {{load_attributes}} scope="global" %}
|
77
|
-
|
78
|
-
|
79
|
-
// Page content
|
80
|
-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
81
|
-
// Include sub-documents (if any)
|
82
|
-
// -----------------------------------------------------------------------------
|
83
|
-
// image:/assets/images/badges/myBinder.png[Binder, link="https://mybinder.org/", {browser-window--new}]
|
84
|
-
// image:/assets/images/badges/docsBinder.png[Binder, link="https://mybinder.readthedocs.io/en/latest/", {browser-window--new}]
|
85
|
-
|
86
|
-
ifeval::[{binder-badges-enabled} == true]
|
87
|
-
image:https://mybinder.org/badge_logo.svg[Binder, link="{binder-app-launch--tree}", {browser-window--new}]
|
88
|
-
endif::[]
|
89
|
-
|
90
|
-
CAUTION: Each interactive element presented on this page uses *time-consuming*
|
91
|
-
operations that take a while to finish. The elements are built through a
|
92
|
-
backend in the cloud. Please be patient to see the results.
|
93
|
-
|
94
|
-
The package *nbinteract* aims to enable authors and educators to create and
|
95
|
-
share interactive web pages easily. Interactive explanations of concepts are
|
96
|
-
useful for communicating and explaining tricky concepts. Consider these
|
97
|
-
explanations for linear regression and conditional probability, for example.
|
98
|
-
|
99
|
-
However, making an interactive web page often requires significant knowledge
|
100
|
-
of web technologies, especially Javascript. While Jupyter widgets allow authors
|
101
|
-
to generate interactive interfaces directly in a Jupyter notebook,
|
102
|
-
sharing these demos typically requires the readers to run the notebook. Th
|
103
|
-
missing knowledge causes issues when the reader's computer lacks the correct
|
104
|
-
versions of the packages required to run the notebook completely.
|
105
|
-
|
106
|
-
The library `nbinteract` provides a single binary that converts Jupyter
|
107
|
-
notebooks into HTML pages. The resulting HTML pages can be shared with the
|
108
|
-
public, keeping any interactivity created using Jupyter widgets. For example,
|
109
|
-
the interactive parts of this website are entirely generated from notebooks
|
110
|
-
using `nbinteract`.
|
111
|
-
|
112
|
-
In addition, `nbinteract` provides a Python package. Once imported, the package
|
113
|
-
provides helper methods that allow users to create simple interactive
|
114
|
-
visualizations with single function calls.
|
115
|
-
|
116
|
-
[NOTE]
|
117
|
-
====
|
118
|
-
This document is a port for J1 Template of the original document pages
|
119
|
-
at link:{url-nbinteract--docs}[nbinteract Docs, {browser-window--new}].
|
120
|
-
Some sections are rewritten for the text to improve clarity and simplify the
|
121
|
-
language for future translation.
|
122
|
-
|
123
|
-
Meanwhile, a lot of changes were done for the services at
|
124
|
-
link:{url-binder--home}[Binder, {browser-window--new} ], which causes the
|
125
|
-
original pages doesn't work anymore. On clicking the NBI button `Show Widgets`,
|
126
|
-
you'll encounter that all interactive pages never change their state and
|
127
|
-
get stuck in `Initializing widgets...` for an infinite initializing loop.
|
128
|
-
====
|
129
|
-
|
130
|
-
|
131
|
-
== Getting Started
|
132
|
-
|
133
|
-
The following pages will show you how to use `nbinteract` and its related
|
134
|
-
tools. At the end of this tutorial, you will have a publicly accessible
|
135
|
-
interactive webpage to share with others!
|
136
|
-
|
137
|
-
The pages assumes familiarity with running terminal commands and using Jupyter
|
138
|
-
notebooks. The simplest way to follow this tutorial is to use the *Binder*
|
139
|
-
service to start a notebook server. On the next page, we'll guide you through
|
140
|
-
the steps to configure Binder so that the necessary packages are available for
|
141
|
-
use in notebooks.
|
142
|
-
|
143
|
-
=== Local installation
|
144
|
-
|
145
|
-
If you prefer to work with Jupyter Notebook on your local machine, you need
|
146
|
-
to install the `nbinteract` package on your PC. To install the package, run
|
147
|
-
the following commands in your terminal:
|
148
|
-
|
149
|
-
[source, sh]
|
150
|
-
----
|
151
|
-
pip install nbinteract
|
152
|
-
|
153
|
-
# The next two commands can be skipped for notebook version 5.3 and above
|
154
|
-
jupyter nbextension enable --py --sys-prefix bqplot
|
155
|
-
jupyter nbextension enable --py --sys-prefix widgetsnbextension
|
156
|
-
----
|
157
|
-
|
158
|
-
WARNING: To work locally, a full setup of a Python *language* versions
|
159
|
-
is required.
|
160
|
-
|
161
|
-
=== Setup steps
|
162
|
-
|
163
|
-
Enable interactive notebooks on webpages using `nbinteract` relies on the
|
164
|
-
*free* Binder service. To configure Binder to run your webpages, we will
|
165
|
-
create a GitHub repository that will allow you to host your converted webpages
|
166
|
-
publicly.
|
167
|
-
|
168
|
-
==== Creating a public repo at Github
|
169
|
-
|
170
|
-
To begin, visit https://github.com[Github, {browser-window--new}] and create
|
171
|
-
an account. If you already have an account, you should log in.
|
172
|
-
|
173
|
-
Then, create a new repo. You may do this using the GitHub UI or by visiting
|
174
|
-
https://github.com/new[create new repo at Github, {browser-window--new}]. Name
|
175
|
-
the repo *nbinteract-tutorial*. If you'd like a different name, feel free to
|
176
|
-
name it something else; keep in mind that we will use this repo name later in
|
177
|
-
the tutorial.
|
178
|
-
|
179
|
-
Make sure your repo is *public*, and click the checkbox to initialize your
|
180
|
-
repo with a README. Your page should look like this:
|
181
|
-
|
182
|
-
// image gh-repo-setup
|
183
|
-
|
184
|
-
Now, click on the Settings link for the repo near the top of the page, scroll
|
185
|
-
down to the GitHub Pages section, and select the main branch as the GitHub
|
186
|
-
pages source. Click the Save button to save your changes.
|
187
|
-
|
188
|
-
// image gh-pages-setup
|
189
|
-
|
190
|
-
Any file you upload to this repo will have a public URL. For example, the
|
191
|
-
README.md file in the repo has the following URL:
|
192
|
-
|
193
|
-
{username}.github.io/nbinteract-tutorial/README.md
|
194
|
-
|
195
|
-
Where `{username}` is replaced with your GitHub username. For example, if
|
196
|
-
my username is SamLau95, my URL is:
|
197
|
-
|
198
|
-
SamLau95.github.io/nbinteract-tutorial/README.md
|
199
|
-
|
200
|
-
If you can visit that URL and the page contains text (and not a 404 error),
|
201
|
-
you've set up your GitHub repo correctly.
|
202
|
-
|
203
|
-
==== Cloning your repo
|
204
|
-
|
205
|
-
Now, visit http://mybinder.org/[Binder] and paste the URL to your repo. It
|
206
|
-
should look like this:
|
207
|
-
|
208
|
-
https://github.com/{username}/nbinteract-tutorial
|
209
|
-
|
210
|
-
Where {username} is replaced with your GitHub username.
|
211
|
-
|
212
|
-
Launch the Binder server to open Jupyter. If you are working locally, you
|
213
|
-
should instead run the following commands in your terminal:
|
214
|
-
|
215
|
-
[source, sh]
|
216
|
-
----
|
217
|
-
# Clone the repo
|
218
|
-
git clone https://github.com/{username}/nbinteract-tutorial
|
219
|
-
|
220
|
-
# Move into the repo directory
|
221
|
-
cd nbinteract-tutorial
|
222
|
-
|
223
|
-
# Start Jupyter
|
224
|
-
jupyter notebook
|
225
|
-
----
|
226
|
-
|
227
|
-
=== Initializing nbinteract
|
228
|
-
|
229
|
-
Via the notebook interface, click on `New -> Terminal`. On clicking, this
|
230
|
-
should open a terminal prompt. Run the following commands:
|
231
|
-
|
232
|
-
[source, sh]
|
233
|
-
----
|
234
|
-
# Installs nbinteract
|
235
|
-
pip install nbinteract
|
236
|
-
|
237
|
-
# Initializes nbinteract. When prompted, create a requirements.txt file. Since we aren't
|
238
|
-
# adding additional packages in this tutorial, re-run the command to finish initialization.
|
239
|
-
nbinteract init
|
240
|
-
|
241
|
-
git add -A
|
242
|
-
git commit -m "Setup nbinteract"
|
243
|
-
git push origin main
|
244
|
-
----
|
245
|
-
|
246
|
-
The commands initialize the `nbinteract` package and push the configuration
|
247
|
-
files to GitHub. If you are working locally, skip the pip install command
|
248
|
-
above and run the remaining commands in your terminal.
|
249
|
-
|
250
|
-
textbook::nbi_docs_tutorial_interact[]
|
251
|
-
|
252
|
-
=== Publishing a Webpage
|
253
|
-
|
254
|
-
To convert a notebook into an HTML file, start a terminal and run the following command.
|
255
|
-
|
256
|
-
[source, sh]
|
257
|
-
----
|
258
|
-
nbinteract tutorial.ipynb
|
259
|
-
----
|
260
|
-
|
261
|
-
The command generates a HTML file `tutorial.html` with the notebook's contents
|
262
|
-
created in the previous section. Now, push your files to GitHub by running:
|
263
|
-
|
264
|
-
[source, sh]
|
265
|
-
----
|
266
|
-
git add -A
|
267
|
-
git commit -m "Publish nb"
|
268
|
-
git push origin main
|
269
|
-
----
|
270
|
-
|
271
|
-
After pushing, you now have a URL you can view and share:
|
272
|
-
|
273
|
-
{username}.github.io/nbinteract-tutorial/tutorial.html
|
274
|
-
|
275
|
-
Where `{username}` is replaced with your GitHub username. For example, if
|
276
|
-
my username is SamLau95, my URL is:
|
277
|
-
|
278
|
-
SamLau95.github.io/nbinteract-tutorial/tutorial.html
|
279
|
-
|
280
|
-
==== Publishing to a different URL
|
281
|
-
|
282
|
-
To change the URL of the page you publish, you can rename your notebook
|
283
|
-
before you convert it. For example, if you rename `tutorial.ipynb` to
|
284
|
-
`hello.ipynb` and convert the notebook, the resulting URL becomes:
|
285
|
-
|
286
|
-
{username}.github.io/nbinteract-tutorial/hello.html
|
287
|
-
|
288
|
-
To change the path segment before the filename (nbinteract-tutorial), you
|
289
|
-
can create a new GitHub repo with the subpath name you want. Then, you may
|
290
|
-
create and convert notebooks in this repo. For example, if you create a new
|
291
|
-
repo called blog-posts and convert a notebook called tutorial.ipynb, the
|
292
|
-
resulting URL becomes:
|
293
|
-
|
294
|
-
{username}.github.io/blog-posts/tutorial.html
|
295
|
-
|
296
|
-
==== Workflow
|
297
|
-
|
298
|
-
You have learned a simple workflow to create interactive webpages:
|
299
|
-
|
300
|
-
. write a Jupyter notebook containing Python functions
|
301
|
-
. use interact to create UI elements to interact with the functions.
|
302
|
-
. zun nbinteract {notebook} in a terminal to generate an interactive
|
303
|
-
webpage using your notebook code.
|
304
|
-
. publish your webpage to GitHub pages to make it publicly accessible.
|
305
|
-
|
306
|
-
In the next section, you will create an interactive simulation of the
|
307
|
-
Monty Hall Problem. Onward!
|
308
|
-
|
309
|
-
textbook::nbi_docs_tutorial_monty_hall[]
|
310
|
-
|
311
|
-
== Recipes
|
312
|
-
|
313
|
-
The Recipes section shows in simple steps how to use `nbinteract`. In addition
|
314
|
-
to the classic widgets provided by Juypter Notebook, `nbinteract` offers
|
315
|
-
additional interactive elements.
|
316
|
-
|
317
|
-
=== Exporting with `nbinteract`
|
318
|
-
|
319
|
-
Installing the `nbinteract` package installs a command-line tool for
|
320
|
-
converting notebooks into HTML pages. For example, to convert a notebook
|
321
|
-
called `Hello.ipynb` using the Binder spec `calebs11/nbinteract-image/main`:
|
322
|
-
|
323
|
-
[source, sh]
|
324
|
-
----
|
325
|
-
# `main` is optional since it is the default
|
326
|
-
nbinteract Hello.ipynb -s calebs11/nbinteract-image
|
327
|
-
----
|
328
|
-
|
329
|
-
After running nbinteract init, you may omit the -s flag and simply write:
|
330
|
-
|
331
|
-
[source, sh]
|
332
|
-
----
|
333
|
-
nbinteract Hello.ipynb
|
334
|
-
----
|
335
|
-
|
336
|
-
One advantage of the command line tool is that it can convert notebooks in
|
337
|
-
folders as well as individual notebooks:
|
338
|
-
|
339
|
-
[source, sh]
|
340
|
-
----
|
341
|
-
# Using the -r flag tells nbinteract to recursively search for .ipynb files
|
342
|
-
# in nb_folder
|
343
|
-
nbinteract -r nb_folder/
|
344
|
-
----
|
345
|
-
|
346
|
-
For the complete set of options, run nbinteract --help.
|
347
|
-
|
348
|
-
[source, sh]
|
349
|
-
----
|
350
|
-
$ nbinteract --help
|
351
|
-
----
|
352
|
-
|
353
|
-
....
|
354
|
-
`nbinteract NOTEBOOKS ...` converts notebooks into HTML pages. Note that
|
355
|
-
running this command outside a GitHub project initialized with `nbinteract
|
356
|
-
init` requires you to specify the --spec SPEC option.
|
357
|
-
|
358
|
-
Arguments:
|
359
|
-
NOTEBOOKS List of notebooks or folders to convert. If folders are passed in,
|
360
|
-
all the notebooks in each folder are converted. The resulting HTML
|
361
|
-
files are created adjacent to their originating notebooks and will
|
362
|
-
clobber existing files of the same name.
|
363
|
-
|
364
|
-
By default, notebooks in subfolders will not be converted; use the
|
365
|
-
--recursive flag to recursively convert notebooks in subfolders.
|
366
|
-
|
367
|
-
Options:
|
368
|
-
-h --help Show this screen
|
369
|
-
-s SPEC --spec SPEC BinderHub spec for Jupyter image. Must be in the
|
370
|
-
format: `{username}/{repo}/{branch}`. For example:
|
371
|
-
'SamLau95/nbinteract-image/master'. This flag is
|
372
|
-
**required** unless a .nbinteract.json file exists
|
373
|
-
in the project root with the "spec" key. If branch
|
374
|
-
is not specified, default to `main`.
|
375
|
-
-t TYPE --template TYPE Specifies the type of HTML page to generate. Valid
|
376
|
-
types: full (standalone page), partial (embeddable
|
377
|
-
page with library), or plain (embeddable page
|
378
|
-
without JS).
|
379
|
-
[default: full]
|
380
|
-
-B --no-top-button If set, doesn't generate button at top of page.
|
381
|
-
-r --recursive Recursively convert notebooks in subdirectories.
|
382
|
-
-o FOLDER --output=FOLDER Outputs HTML files into FOLDER instead of
|
383
|
-
outputting files adjacent to their originating
|
384
|
-
notebooks. All files will be direct descendants of
|
385
|
-
the folder even if --recursive is set.
|
386
|
-
-i FOLDER --images=FOLDER Extracts images from HTML and writes into FOLDER
|
387
|
-
instead of encoding images in base64 in the HTML.
|
388
|
-
Requires -o option to be set as well.
|
389
|
-
-e --execute Executes the notebook before converting to HTML,
|
390
|
-
functioning like the equivalent flag for
|
391
|
-
nbconvert. Configure NbiExecutePreprocessor to
|
392
|
-
change conversion instead of the base
|
393
|
-
ExecutePreprocessor.
|
394
|
-
....
|
395
|
-
|
396
|
-
=== The method `nbi.publish()`
|
397
|
-
|
398
|
-
The `nbi.publish()` method can be run *inside* a Jupyter notebook cell.
|
399
|
-
It has the following signature:
|
400
|
-
|
401
|
-
[source, python]
|
402
|
-
----
|
403
|
-
import nbinteract as nbi
|
404
|
-
|
405
|
-
nbi.publish(spec, nb_name, template='full', save_first=True)
|
406
|
-
----
|
407
|
-
|
408
|
-
....
|
409
|
-
Converts nb_name to an HTML file. Preserves widget functionality.
|
410
|
-
|
411
|
-
Outputs a link to download HTML file after conversion if called in a
|
412
|
-
notebook environment.
|
413
|
-
|
414
|
-
Equivalent to running `nbinteract ${spec} ${nb_name}` on the command line.
|
415
|
-
|
416
|
-
Args:
|
417
|
-
spec (str): BinderHub spec for Jupyter image. Must be in the format:
|
418
|
-
`${username}/${repo}/${branch}`.
|
419
|
-
|
420
|
-
nb_name (str): Complete name of the notebook file to convert. Can be a
|
421
|
-
relative path (eg. './foo/test.ipynb').
|
422
|
-
|
423
|
-
template (str): Template to use for conversion. Valid templates:
|
424
|
-
|
425
|
-
- 'full': Outputs a complete standalone HTML page with default
|
426
|
-
styling. Automatically loads the nbinteract JS library.
|
427
|
-
- 'partial': Outputs an HTML partial that can be embedded in
|
428
|
-
another page. Automatically loads the nbinteract JS library.
|
429
|
-
- 'gitbook': Outputs an HTML partial used to embed in a Gitbook or
|
430
|
-
other environments where the nbinteract JS library is already
|
431
|
-
loaded.
|
432
|
-
|
433
|
-
save_first (bool): If True, saves the currently opened notebook before
|
434
|
-
converting nb_name. Used to ensure notebook is written to
|
435
|
-
filesystem before starting conversion. Does nothing if not in a
|
436
|
-
notebook environment.
|
437
|
-
|
438
|
-
|
439
|
-
Returns:
|
440
|
-
None
|
441
|
-
....
|
442
|
-
|
443
|
-
For example, to convert a notebook called Hello.ipynb using the Binder spec
|
444
|
-
`calebs11/nbinteract-image/main`:
|
445
|
-
|
446
|
-
[source, sh]
|
447
|
-
----
|
448
|
-
nbi.publish('calebs11/nbinteract-image/main', 'Hello.ipynb')
|
449
|
-
----
|
450
|
-
|
451
|
-
textbook::nbi_docs_recipes_graphing[]
|
452
|
-
|
453
|
-
textbook::nbi_docs_recipes_layout[]
|
454
|
-
|
455
|
-
textbook::nbi_docs_recipes_interactive_questions[]
|
456
|
-
|
457
|
-
== Examples
|
458
|
-
|
459
|
-
For more examples of interactive notebooks, see this section. The examples
|
460
|
-
show a selection of specific learning content at colleges and universities
|
461
|
-
on statistical issues.
|
462
|
-
|
463
|
-
textbook::nbi_docs_empirical_distributions[]
|
464
|
-
|
465
|
-
textbook::nbi_docs_examples_sampling_from_a_population[]
|
466
|
-
|
467
|
-
textbook::nbi_docs_examples_variability_of_the_sample_mean[]
|
468
|
-
|
469
|
-
textbook::nbi_docs_examples_correlation[]
|
470
|
-
|
471
|
-
textbook::nbi_docs_examples_linear_regression[]
|
472
|
-
|
473
|
-
textbook::nbi_docs_central_limit_theorem[]
|
@@ -1,94 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Testing Plotly
|
3
|
-
tagline: interactive evaluation
|
4
|
-
date: 2022-03-28 00:00:00
|
5
|
-
description: >
|
6
|
-
The package nbinteract aims to enable authors and educators to create and
|
7
|
-
share interactive web pages easily. Interactive explanations of concepts are
|
8
|
-
useful for communicating and explaining tricky concepts.
|
9
|
-
keywords: >
|
10
|
-
opensource, free, load, download, start, starter, example,
|
11
|
-
high, easy, use, secure, encrypt, standard, popular,
|
12
|
-
generate, create, learn, distribute, publish, deploy,
|
13
|
-
beginner, advanced, expert, student, learner, writer, reader, visitor
|
14
|
-
framework, toolkit, integration, extension, module, api,
|
15
|
-
dynamic, static, generator, client, server, internet, local, localhost
|
16
|
-
page, web, website, webdesign, material, design, responsive,
|
17
|
-
javascript, nodejs, ruby, windows, linux, osx, mac, os,
|
18
|
-
http, https, html, html5, css, scss, style,
|
19
|
-
browser, firefox, chrome, edge, opera, safari,
|
20
|
-
configuration, generator, navigation, menu, dropdown, fab, action, button
|
21
|
-
application, interface, provider, api, repository,
|
22
|
-
cookie, language, translation, gdpr, dsgvo, privacy,
|
23
|
-
asciidoc, aciidoctor, bootstrap, jekyll, liquid,
|
24
|
-
hyvor, disqus, git, github, netlify, heroku, apple, microsoft,
|
25
|
-
provider, service, internet, support,
|
26
|
-
google, analytics, advertising, search, console, silverlight, score,
|
27
|
-
j1, template, jekyllone, comment,
|
28
|
-
python, jupyter, notebook, textbook, api, app, nbinteract,
|
29
|
-
nbi, integration, binder, binderhub, jupyterhub
|
30
|
-
|
31
|
-
categories: [ Software, Python ]
|
32
|
-
tags: [ Binder, Jupyter, Notebooks ]
|
33
|
-
|
34
|
-
scrollbar: false
|
35
|
-
fab_menu_id: open_toc_reload
|
36
|
-
personalization: true
|
37
|
-
|
38
|
-
permalink: /pages/public/jupyter/textbooks/j1-testing-plotly/
|
39
|
-
regenerate: true
|
40
|
-
|
41
|
-
resources: [ nbinteract, require, rouge ]
|
42
|
-
resource_options:
|
43
|
-
- attic:
|
44
|
-
padding_top: 400
|
45
|
-
padding_bottom: 50
|
46
|
-
opacity: 0.5
|
47
|
-
slides:
|
48
|
-
- url: /assets/images/modules/attics/runner-1920x1200.jpg
|
49
|
-
---
|
50
|
-
|
51
|
-
// Page Initializer
|
52
|
-
// =============================================================================
|
53
|
-
// Enable the Liquid Preprocessor
|
54
|
-
:page-liquid:
|
55
|
-
|
56
|
-
// Set (local) page attributes here
|
57
|
-
// -----------------------------------------------------------------------------
|
58
|
-
// :page--attr: <attr-value>
|
59
|
-
:binder-badges-enabled: true
|
60
|
-
:binder-app-launch--tree: https://mybinder.org/v2/gh/jekyll-one/j1-binder-repo/main?urlpath=/tree
|
61
|
-
:binder-app-launch--notebook: https://mybinder.org/v2/gh/jekyll-one/j1-binder-repo/main?filepath=notebooks/j1/j1_odes_in_python.ipynb
|
62
|
-
|
63
|
-
// Load Liquid procedures
|
64
|
-
// -----------------------------------------------------------------------------
|
65
|
-
{% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
|
66
|
-
|
67
|
-
// Load page attributes
|
68
|
-
// -----------------------------------------------------------------------------
|
69
|
-
{% include {{load_attributes}} scope="global" %}
|
70
|
-
|
71
|
-
|
72
|
-
// Page content
|
73
|
-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
74
|
-
// image:/assets/images/badges/myBinder.png[Binder, link="https://mybinder.org/", {browser-window--new}]
|
75
|
-
// image:/assets/images/badges/docsBinder.png[Binder, link="https://mybinder.readthedocs.io/en/latest/", {browser-window--new}]
|
76
|
-
// See: https://towardsdatascience.com/ordinal-differential-equation-ode-in-python-8dc1de21323b
|
77
|
-
|
78
|
-
ifeval::[{binder-badges-enabled} == true]
|
79
|
-
image:/assets/images/badges/notebookBinder.png[Binder, link="{binder-app-launch--notebook}", {browser-window--new}]
|
80
|
-
image:https://mybinder.org/badge_logo.svg[Binder, link="{binder-app-launch--tree}", {browser-window--new}]
|
81
|
-
endif::[]
|
82
|
-
|
83
|
-
CAUTION: Each interactive element presented on this page uses *time-consuming*
|
84
|
-
operations that take a while to finish. The elements are built through a
|
85
|
-
backend in the cloud. Please be patient to see the results.
|
86
|
-
|
87
|
-
== Plotly
|
88
|
-
|
89
|
-
lorem:sentences[5]
|
90
|
-
|
91
|
-
lorem:sentences[3]
|
92
|
-
|
93
|
-
|
94
|
-
textbook::j1_testing_plotly[]
|