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

❇️ Read configuration for execution from myst.yml #1229

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .changeset/long-jobs-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-cli": minor
---

Read execution config from myst.yml
2 changes: 1 addition & 1 deletion docs/integrating-jupyter.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Add the specific list options for custom wheel paths, etc.
In addition to how you might normally start a JupyterLab session, it's necessary to provide two additional command line options, as follows.

```{code} bash
jupyter lab --NotebookApp.token=<your-secret-token> --NotebookApp.allow_origin='http://localhost:3000'
jupyter lab --IdentityProvider.token=<your-secret-token> --ServerApp.allow_origin='http://localhost:3000'
```

The command above is fine for local development. The `token` used should align with that provided in the `project.thebe.token` key and `allow_origin` should allow connections from your myst site preview, usually running on `http://localhost:3000`.
Expand Down
10 changes: 8 additions & 2 deletions packages/myst-cli/src/session/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,16 @@ export class Session implements ISession {
}

private async createJupyterSessionManager(): Promise<SessionManager | undefined> {
const projectConfig = selectors.selectCurrentProjectConfig(this.store.getState());
try {
let partialServerSettings: JupyterServerSettings | undefined;
// Load from environment
if (process.env.JUPYTER_BASE_URL !== undefined) {
const configServer = projectConfig?.thebe?.server;
if (configServer !== undefined) {
partialServerSettings = {
baseUrl: configServer.url,
token: configServer.token,
};
} else if (process.env.JUPYTER_BASE_URL !== undefined) {
partialServerSettings = {
baseUrl: process.env.JUPYTER_BASE_URL,
token: process.env.JUPYTER_TOKEN,
Expand Down
Loading