Skip to content

Commit ac6ffcf

Browse files
authored
📚 DOCS: update instructions for using w/ jupyterhub and binder (jupyter-book#1097)
1 parent 8db38be commit ac6ffcf

File tree

2 files changed

+55
-14
lines changed

2 files changed

+55
-14
lines changed

docs/interactive/launchbuttons.ipynb

+38-14
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,21 @@
1919
" url : https://github.com/yourusername/yourbookrepo # Online location of your book\n",
2020
" path_to_book : path/to/book # Optional path to your book, relative to the repository root\n",
2121
" branch : master # Which branch of the repository should be used when creating links (optional)\n",
22-
"```"
22+
"```\n",
23+
"\n",
24+
"The `repository:` configuration line uses `url`, `path_to_book`, and `branch` to find your notebook\n",
25+
"files. \n",
26+
"\n",
27+
"- The `url` should be a GitHub repository that includes your source files used to build the\n",
28+
" Jupyter Book. Your repository should include:\n",
29+
" - `_config.yml`\n",
30+
" - `_toc.yml`\n",
31+
" - `requirements.txt`: packages for binder or general reproducibility\n",
32+
" - _the source files in *.ipynb and *.md_\n",
33+
"- The `path_to_book` should used if your book is in a sub-folder of your repository (e.g. `docs/` or\n",
34+
" `book/`)\n",
35+
"- The `branch` should be the branch where your book's source files are stored. It _should not be_\n",
36+
" the [`gh-pages` branch](https://jupyterbook.org/publish/gh-pages.html). \n"
2337
]
2438
},
2539
{
@@ -37,7 +51,8 @@
3751
"```\n",
3852
"\n",
3953
"One thing to take into account when choosing the interface is that notebooks written in the [MyST Markdown](../file-types/myst-notebooks.md) text-based format will not be opened as notebooks out-of-the-box.\n",
40-
"If you wish for these files to be opened as notebooks then firstly you must ensure that [`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats.html#myst-markdown) is installed in the Binder/JupyterHub environment for your book (no support for this feature exists in Google Colab). You then have two options:\n",
54+
" If you wish for these files to be opened as notebooks then firstly you must ensure that [`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats.html#myst-markdown) is installed in the Binder/JupyterHub environment for your book (no support for this feature exists in Google Colab).\n",
55+
"You then have two options:\n",
4156
"\n",
4257
"- Use the \"classic\" interface, which will then immediately open these files as notebooks.\n",
4358
"- The \"jupyterlab\" interface (at the time of writing) has not yet implemented this behaviour, and so you will need to instruct readers to right-click the Markdown file and click \"Open in notebook editor\"."
@@ -65,7 +80,8 @@
6580
"```\n",
6681
"\n",
6782
"By adding this configuration, along with the repository url configuration above, Jupyter Book\n",
68-
"will insert Binder links to any pages that were built from notebook content."
83+
"will insert Binder links to any pages that were built from notebook content.\n",
84+
"\n"
6985
]
7086
},
7187
{
@@ -74,22 +90,29 @@
7490
"source": [
7591
"## JupyterHub buttons for your pages\n",
7692
"\n",
77-
"JupyterHub lets you host an online service that gives users their own Jupyter servers\n",
78-
"with an environment that you specify for them. It allows you to give users access to\n",
79-
"resources and hardware that you provision in the cloud, and allows you to authenticate users\n",
80-
"in order to control who has access to your hardware.\n",
93+
"JupyterHub lets you host an online service that gives users their own Jupyter servers with an environment that you specify for them.\n",
94+
"It allows you to give users access to resources and hardware that you provision in the cloud, and allows you to authenticate users in order to control who has access to your hardware.\n",
8195
"\n",
82-
"Similar to Binder link buttons, you can also automatically include interact links that send\n",
83-
"your readers to a JupyterHub that is running a live, interactive version of your page. This\n",
84-
"is accomplished using the [nbgitpuller](https://github.com/jupyterhub/nbgitpuller) server\n",
85-
"extension.\n",
96+
"Similar to Binder link buttons, you can also automatically include interact links that send your readers to a JupyterHub that is running a live, interactive version of your page.\n",
97+
"This is accomplished using the [nbgitpuller](https://github.com/jupyterhub/nbgitpuller) server extension.\n",
8698
"\n",
87-
"You can configure the location of the JupyterHub (which you may set up on your own using a guide\n",
88-
"such as [zero to jupyterhub for kubernetes](https://z2jh.jupyter.org) or [the littlest jupyterhub](https://tljh.jupyter.org)) with the following configuration:\n",
99+
"You can configure the location of the JupyterHub (which you may set up on your own using a guide such as [zero to jupyterhub for kubernetes](https://z2jh.jupyter.org) or [the littlest jupyterhub](https://tljh.jupyter.org)) with the following configuration:\n",
89100
"\n",
90101
"```yaml\n",
91102
"launch_buttons:\n",
92103
" jupyterhub_url: \"your-hub-url\" # The URL for your JupyterHub. (e.g., https://datahub.berkeley.edu)\n",
104+
"```\n",
105+
"\n",
106+
"On your JupyterHub server, you need two dependencies installed:\n",
107+
"1. To clone the notebook with the launch link, the server needs\n",
108+
"[`nbgitpuller`](https://jupyterhub.github.io/nbgitpuller/). \n",
109+
"\n",
110+
"2. To open myst-markdown as notebooks, the server needs\n",
111+
"[`jupytext>=0.16`](https://jupytext.readthedocs.io/en/latest/formats.html#myst-markdown). \n",
112+
"\n",
113+
"You can add the following line to your `DockerFile`:\n",
114+
"```\n",
115+
"RUN pip install jupytext nbgitpuller\n",
93116
"```"
94117
]
95118
},
@@ -99,7 +122,8 @@
99122
"source": [
100123
"## {term}`Google Colab` buttons for your pages\n",
101124
"\n",
102-
"If your Jupyter Book is hosted online on GitHub, you can automatically insert buttons that link to the Jupyter Notebook running on [Google Colab](https://colab.research.google.com/). When a user clicks the button, they'll be taken to a live version of the page.\n",
125+
"If your Jupyter Book is hosted online on GitHub, you can automatically insert buttons that link to the Jupyter Notebook running on [Google Colab](https://colab.research.google.com/).\n",
126+
"When a user clicks the button, they'll be taken to a live version of the page.\n",
103127
"\n",
104128
"Similar to Binder link buttons, you can automatically include Google Colab link buttons with the following configuration in `_config.yml`:\n",
105129
"\n",

docs/start/publish.md

+17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ The best way to do this is with a service that hosts **static websites**
55
(because that's what you have just created with Jupyter Book). There are many options for doing this, and these sections cover some of the
66
more popular ones.
77

8+
## Source vs build files
9+
10+
At this point, you have created a combination of Jupyter notebooks, markdown files, and configuration files, including `_toc.yml` and `_config.yml`.
11+
These files are your __source__ files.
12+
The __source__ files comprise all of the content and configuration that Jupyter Book needs to build your book.
13+
14+
15+
The `_build` folder contains all of your static website __build__ files.
16+
The __build__ files contain all of the output from Jupyter Book's `build` command.
17+
These files are only used to view your content in a browser.
18+
19+
Best practice for publishing your book is to keep two branches in your git project:
20+
21+
- Your book's __source__ files that you create to build the book
22+
- Your book's __build__ files that Jupyter Book created to view the book
23+
24+
825
(publish/online-repo)=
926
## Create an online repository for your book
1027

0 commit comments

Comments
 (0)