A CoreOptions object is used to create a Config
object, where any options supplied will be automatically patched with default values.
This makes it easy to start using thebe-core
with minimal knowledge of the various options available, while also overriding specific defaults as needed.
An instance of a Config
object is then used to construct the different runtime objects like ThebeServer
and ThebeNotebook
. Config
by default will also create instance of the ThebeEvents
object, allowing you to scope event based messaging in your app.
Connect via a BinderHub¶
We can configure thebe-core
to connect to the public mybinder.org
service by setting a single option.
const config = makeConfiguration({
useBinder: true,
});
Override specific settings for binder by setting any of the following fields (defaults are shown):
const config = makeConfiguration({
useBinder: true,
binderOptions: {
repo: 'binder-examples/requirements',
ref: 'master',
binderUrl: 'https://mybinder.org',
repoProvider: RepoProvider.github,
},
});
Connect directly to a Jupyter server¶
If you already have a Jupyter server available, connect directly by simply:
const config = makeConfiguration({});
This will use default settings to connect to a local Jupyter server. To start local server for development purposes only, use the following command:
jupyter lab --NotebookApp.token=test-secret --NotebookApp.allow_origin='*'
To connect to a different server update the server settings:
const config = makeConfiguration({
useBinder: false, // or omit
useJupyterLite: false, // or omit
serverSettings: {
baseUrl: 'http://localhost:8888',
token: 'test-secret',
appendToken: true,
...settings,
},
});
Next Steps¶
- Head back to the browser guide
- Head back to the typescript guide
- Explore the full set of default options