From bc09121677a2b5ab3379af0e2dfd6d8c8e8d244c Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Tue, 13 Jun 2023 21:57:17 -0400 Subject: [PATCH 1/5] Add `JupyterLab` setting overrides docs --- docs/howto/index.md | 1 + docs/howto/user-env/override-lab-settings.md | 114 +++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 docs/howto/user-env/override-lab-settings.md diff --git a/docs/howto/index.md b/docs/howto/index.md index 208f14e..ea4135d 100644 --- a/docs/howto/index.md +++ b/docs/howto/index.md @@ -22,6 +22,7 @@ content/share-data user-env/user-environment user-env/notebook-interfaces user-env/server-resources +user-env/override-lab-settings ``` ## Authentication diff --git a/docs/howto/user-env/override-lab-settings.md b/docs/howto/user-env/override-lab-settings.md new file mode 100644 index 0000000..40fbb83 --- /dev/null +++ b/docs/howto/user-env/override-lab-settings.md @@ -0,0 +1,114 @@ +(topic-override-lab-settings)= + +# Overriding Default JupyterLab Settings + +If you or other users of your hub tend to use JupyterLab as your default notebook app, +then you may want to override some of the default settings for the users of your hub. +You can do this by creating a file `/opt/tljh/user/share/jupyter/lab/settings/overrides.json` +with the necessary settings. + +This how-to guide will go through the necessary steps to set new defaults +for all users of your `TLJH` by example: setting the default theme to **JupyterLab Dark**. + +## Step 1: Change your Personal Settings + +The easiest way to set new default settings for all users starts with +configuring your own settings preferences to what you would like everyone else to have. + +1. Make sure you are in the [JupyterLab notebook interface](#howto/user-env/notebook-interfaces), +which will look something like `http(s):///user/ JupyterLab Dark**. + +## Step 2: Determine your Personal Settings Configuration + +To set **JupyterLab Dark** as the default theme for all users, we will need to create +a `json` formatted file with the setting override. Now that you have changed your +personal setting, you can use the **JSON Settings Editor** to get the relevant +setting snippet to add to the `overrides.json` file later. + +1. Go to **Settings -> Advanced Settings Editor** then select **JSON Settings Editor** on the right. + +1. Scroll down and select **Theme**. You should see the `json` formatted configuration: + ```json + { + // Theme + // @jupyterlab/apputils-extension:themes + // Theme manager settings. + // ************************************* + + // Theme CSS Overrides + // Override theme CSS variables by setting key-value pairs here + "overrides": { + "code-font-family": null, + "code-font-size": null, + "content-font-family": null, + "content-font-size1": null, + "ui-font-family": null, + "ui-font-size1": null + }, + + // Selected Theme + // Application-level visual styling theme + "theme": "JupyterLab Dark", + + // Scrollbar Theming + // Enable/disable styling of the application scrollbars + "theme-scrollbars": false + } + ``` + +1. Determine the setting that you want to change. In this example it's the `theme` +setting of `@jupyterlab/apputils-extension:theme` as can be seen above. + +1. Build your `json` snippet. In this case, our snippet should look like this: + ```json + { + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + } + } + ``` + We only want to change the **Selected Theme**, so we don't need to include + the other theme-related settings for CSS and the scrollbar. + + :::{note} + To apply overrides for more than one setting, separate each setting by commas. For example, + if you *also* wanted to change the interval at which the notebook autosaves your content, you can use + ```json + { + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + }, + + "@jupyterlab/docmanager-extension:plugin": { + "autosaveInterval": 30 + } + } + ``` + ::: + +## Step 3: Apply the Overrides to the Hub + +Once you have your setting snippet created, you can add it to the `overrides.json` file +so that it gets applied to all users. + +1. First, create the settings directory if it doesn't already exist: + ```bash + sudo mkdir -p /opt/tljh/user/share/jupyter/lab/settings + ``` + +1. Use `nano` to create and add content to the `overrides.json` file: + ```bash + sudo nano /opt/tljh/user/share/jupyter/lab/settings/overrides.json + ``` + +1. Copy and paste your snippet into the file and save. + +1. Reload your configuration: + ```bash + sudo tljh-config reload + ``` + +The new default settings should now be set for all users in your `TLJH` using the +JupyterLab notebook interface. \ No newline at end of file From 3753a3c775c203430f2a209988dbcfc9a60b6739 Mon Sep 17 00:00:00 2001 From: Jordan Bradford <36420801+jrdnbradford@users.noreply.github.com> Date: Tue, 13 Jun 2023 22:05:55 -0400 Subject: [PATCH 2/5] Update heading 1 --- docs/howto/user-env/override-lab-settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/user-env/override-lab-settings.md b/docs/howto/user-env/override-lab-settings.md index 40fbb83..707ba94 100644 --- a/docs/howto/user-env/override-lab-settings.md +++ b/docs/howto/user-env/override-lab-settings.md @@ -1,6 +1,6 @@ (topic-override-lab-settings)= -# Overriding Default JupyterLab Settings +# Setting New Default JupyterLab Settings If you or other users of your hub tend to use JupyterLab as your default notebook app, then you may want to override some of the default settings for the users of your hub. From 259d2ff11d57d7a01ef3d4d8a69f12a1635f17af Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 02:10:29 +0000 Subject: [PATCH 3/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/howto/user-env/override-lab-settings.md | 107 ++++++++++--------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/docs/howto/user-env/override-lab-settings.md b/docs/howto/user-env/override-lab-settings.md index 707ba94..4f924a5 100644 --- a/docs/howto/user-env/override-lab-settings.md +++ b/docs/howto/user-env/override-lab-settings.md @@ -2,91 +2,94 @@ # Setting New Default JupyterLab Settings -If you or other users of your hub tend to use JupyterLab as your default notebook app, -then you may want to override some of the default settings for the users of your hub. +If you or other users of your hub tend to use JupyterLab as your default notebook app, +then you may want to override some of the default settings for the users of your hub. You can do this by creating a file `/opt/tljh/user/share/jupyter/lab/settings/overrides.json` with the necessary settings. -This how-to guide will go through the necessary steps to set new defaults +This how-to guide will go through the necessary steps to set new defaults for all users of your `TLJH` by example: setting the default theme to **JupyterLab Dark**. ## Step 1: Change your Personal Settings -The easiest way to set new default settings for all users starts with -configuring your own settings preferences to what you would like everyone else to have. +The easiest way to set new default settings for all users starts with +configuring your own settings preferences to what you would like everyone else to have. -1. Make sure you are in the [JupyterLab notebook interface](#howto/user-env/notebook-interfaces), -which will look something like `http(s):///user//user/ JupyterLab Dark**. ## Step 2: Determine your Personal Settings Configuration -To set **JupyterLab Dark** as the default theme for all users, we will need to create -a `json` formatted file with the setting override. Now that you have changed your +To set **JupyterLab Dark** as the default theme for all users, we will need to create +a `json` formatted file with the setting override. Now that you have changed your personal setting, you can use the **JSON Settings Editor** to get the relevant setting snippet to add to the `overrides.json` file later. 1. Go to **Settings -> Advanced Settings Editor** then select **JSON Settings Editor** on the right. 1. Scroll down and select **Theme**. You should see the `json` formatted configuration: + ```json { - // Theme - // @jupyterlab/apputils-extension:themes - // Theme manager settings. - // ************************************* + // Theme + // @jupyterlab/apputils-extension:themes + // Theme manager settings. + // ************************************* - // Theme CSS Overrides - // Override theme CSS variables by setting key-value pairs here - "overrides": { - "code-font-family": null, - "code-font-size": null, - "content-font-family": null, - "content-font-size1": null, - "ui-font-family": null, - "ui-font-size1": null - }, + // Theme CSS Overrides + // Override theme CSS variables by setting key-value pairs here + "overrides": { + "code-font-family": null, + "code-font-size": null, + "content-font-family": null, + "content-font-size1": null, + "ui-font-family": null, + "ui-font-size1": null + }, - // Selected Theme - // Application-level visual styling theme - "theme": "JupyterLab Dark", + // Selected Theme + // Application-level visual styling theme + "theme": "JupyterLab Dark", - // Scrollbar Theming - // Enable/disable styling of the application scrollbars - "theme-scrollbars": false + // Scrollbar Theming + // Enable/disable styling of the application scrollbars + "theme-scrollbars": false } ``` -1. Determine the setting that you want to change. In this example it's the `theme` -setting of `@jupyterlab/apputils-extension:theme` as can be seen above. +1. Determine the setting that you want to change. In this example it's the `theme` + setting of `@jupyterlab/apputils-extension:theme` as can be seen above. 1. Build your `json` snippet. In this case, our snippet should look like this: ```json - { - "@jupyterlab/apputils-extension:themes": { - "theme": "JupyterLab Dark" - } + { + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + } } ``` We only want to change the **Selected Theme**, so we don't need to include the other theme-related settings for CSS and the scrollbar. - :::{note} - To apply overrides for more than one setting, separate each setting by commas. For example, - if you *also* wanted to change the interval at which the notebook autosaves your content, you can use - ```json - { - "@jupyterlab/apputils-extension:themes": { - "theme": "JupyterLab Dark" - }, - - "@jupyterlab/docmanager-extension:plugin": { - "autosaveInterval": 30 - } +:::{note} +To apply overrides for more than one setting, separate each setting by commas. For example, +if you _also_ wanted to change the interval at which the notebook autosaves your content, you can use + +```json +{ + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + }, + + "@jupyterlab/docmanager-extension:plugin": { + "autosaveInterval": 30 } - ``` - ::: +} +``` + +::: ## Step 3: Apply the Overrides to the Hub @@ -94,16 +97,18 @@ Once you have your setting snippet created, you can add it to the `overrides.jso so that it gets applied to all users. 1. First, create the settings directory if it doesn't already exist: + ```bash sudo mkdir -p /opt/tljh/user/share/jupyter/lab/settings ``` 1. Use `nano` to create and add content to the `overrides.json` file: + ```bash sudo nano /opt/tljh/user/share/jupyter/lab/settings/overrides.json ``` -1. Copy and paste your snippet into the file and save. +1. Copy and paste your snippet into the file and save. 1. Reload your configuration: ```bash @@ -111,4 +116,4 @@ so that it gets applied to all users. ``` The new default settings should now be set for all users in your `TLJH` using the -JupyterLab notebook interface. \ No newline at end of file +JupyterLab notebook interface. From 2b1b6787b8a4b139c1984f315f1e797abad8cb27 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 9 Aug 2023 09:28:37 +0200 Subject: [PATCH 4/5] Apply suggestions from code review --- docs/howto/user-env/override-lab-settings.md | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/howto/user-env/override-lab-settings.md b/docs/howto/user-env/override-lab-settings.md index 4f924a5..7bb6dfe 100644 --- a/docs/howto/user-env/override-lab-settings.md +++ b/docs/howto/user-env/override-lab-settings.md @@ -73,23 +73,23 @@ setting snippet to add to the `overrides.json` file later. We only want to change the **Selected Theme**, so we don't need to include the other theme-related settings for CSS and the scrollbar. -:::{note} -To apply overrides for more than one setting, separate each setting by commas. For example, -if you _also_ wanted to change the interval at which the notebook autosaves your content, you can use + :::{note} + To apply overrides for more than one setting, separate each setting by commas. For example, + if you _also_ wanted to change the interval at which the notebook autosaves your content, you can use -```json -{ - "@jupyterlab/apputils-extension:themes": { - "theme": "JupyterLab Dark" - }, + ```json + { + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + }, - "@jupyterlab/docmanager-extension:plugin": { - "autosaveInterval": 30 - } -} -``` + "@jupyterlab/docmanager-extension:plugin": { + "autosaveInterval": 30 + } + } + ``` -::: + ::: ## Step 3: Apply the Overrides to the Hub From e9de9f604248e1562d4606e096de4aee3dc10cc5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 07:28:46 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/howto/user-env/override-lab-settings.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/howto/user-env/override-lab-settings.md b/docs/howto/user-env/override-lab-settings.md index 7bb6dfe..cba3703 100644 --- a/docs/howto/user-env/override-lab-settings.md +++ b/docs/howto/user-env/override-lab-settings.md @@ -63,6 +63,7 @@ setting snippet to add to the `overrides.json` file later. setting of `@jupyterlab/apputils-extension:theme` as can be seen above. 1. Build your `json` snippet. In this case, our snippet should look like this: + ```json { "@jupyterlab/apputils-extension:themes": { @@ -70,6 +71,7 @@ setting snippet to add to the `overrides.json` file later. } } ``` + We only want to change the **Selected Theme**, so we don't need to include the other theme-related settings for CSS and the scrollbar.