Configuring Jupyter notebooks to be shared across multiple servers

Working in an environment with multiple servers, I want to streamline my .jupyter configuration across all servers without the hassle of manual synchronization. Fortunately, this can be easily accomplished by setting the JUPYTER_CONFIG_DIR environment variable to a shared location.

My goal is to have distinct CSS style sheets for each server to clearly differentiate between them. For instance, I envision having a red background on the first server:

#notebook { background: red; }

and a blue background on the second server.

#notebook { background: blue; }

I initially considered adding different paths to the extra_static_paths based on the hostname of the Jupyter server. However, the notebook's HTML specifically searches for custom/custom.css while files referenced by extra_static_paths are from static/..., making it impossible to replace the custom css file using this method.

Is there a more effective approach to achieve this customization?

Answer №1

Using profiles may achieve this, but there is a lack of documentation on the topic.

UPDATE: After further research from this source, it appears that profiles have been removed since jupyter 4.x. Unless you are willing to manage shared directories and files through bash scripting, the only solution seems to be using an alternative method.

One possible workaround is to utilize the Stylish browser extension. Personally, I find it convenient for quickly switching between the default white theme and a darker one in the notebook.

Functionality of Stylish

Essentially, Stylish injects custom CSS into pages based on specified rules within a theme. You can create your own CSS themes or download them from their platform. For example, I am currently employing this particular theme for jupyter notebooks which matches specific rules:

url-prefix("http://localhost:8888/"), 
url-prefix("http://127.0.0.1:8888/"),
url-prefix("http://localhost:8889/"),
url-prefix("http://localhost:8890/")

You can duplicate this theme and assign each one to match a single port, corresponding to the desired server where it should be applied. By starting your servers with the --port=xxxx option, you can easily implement different themes for each.


1 -- Although changing the notebook's theme by placing a custom CSS file in the jupyter's config directory is achievable, doing so requires manual file replacements every time you want to switch. With Stylish, this change is just 1 click away.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trouble with CSS display in Internet Explorer 8

My website located at this link is working perfectly in IE 10 and IE 11, however, any version lower than that is causing the content to be displayed on the far left of the screen instead of centering it. I have tried tweaking the CSS but can't seem to ...

Adjusting image dimensions dynamically using JavaScript based on screen size

My bootstrap setup seems to be causing issues when using the @media (min-height: 1000px) rule as the image class does not respond as expected. I am looking to implement a JavaScript solution that will automatically resize images once the screen height exc ...

Experience choppy scrolling in Internet Explorer

Check out my click and drag scrolling Image Viewer here. While it functions perfectly in Firefox and Chrome, Internet Explorer is giving me some trouble. The movement seems jerky, especially when scrolling diagonally. It's like the scroll is sluggish ...

Generate a responsive list with a pop-up feature under each item (using Vue.js)

Currently, I believe that Vue may not be necessary since most tasks can be done using JavaScript and CSS. I am attempting to design a list layout as follows: [A] [B] [C] [D] When an item is clicked, the information about that specific item should ...

Issue with displaying fonts from @font-face on 000webhost

I recently set up my own website. Originally, I was using webs.com as my hosting provider, but they started adding an ad bar to their html-only hosting which I didn't like. So, I switched over to 000webhost. However, after moving everything to 000webh ...

Show Zeroes in Front of Input Numbers

I am working with two input fields that represent hours and minutes separately. <input type="number" min="0" max="24" step="1" value="00" class="hours"> <input type="number" min="0" max="0.60" step="0.01" value="00" class="minutes"> This se ...

obtain the image number by extracting a portion of the text

How can I extract the image number from a string using the sub-string function? I have applied the sub-string function to the property below. It returns 3 at the end in Chrome, but it does not work properly in Mozilla. Issue : After "-->", when I chec ...

EVO PDF: Compare Tables and Headers that Stay in View

I am currently using the EVO PDF, Html to PDF generator, and I have encountered a puzzling scenario that seems unsolvable. I'm not certain if there is a built-in solution within the software itself. In my project, I have two metric data tables positi ...

Avoiding leaps through the use of dynamic pictures?

Currently, I am implementing the picture element along with srcset to download the same image but in varying resolutions depending on the screen size of the device. The image has a style of max-width: 100%, causing it to shift the content below when downl ...

Learn how to achieve a sleek animation similar to the famous "Ken Burns effect" by utilizing the CSS property "transform" instead of "object-position". Check out the demo to see it in action!

I am currently exploring how to create an animation similar to the "Ken Burns" effect using CSS transform properties. While I have been using object-position to animate, I am facing challenges with the fluidity of the movement. I am seeking help to achiev ...

Tips for achieving a static background image while allowing scrolling on a webpage in asp.net

I am struggling to implement this on my website. The background image needs to be fixed while the content of the webpage should scroll in asp.net <head runat="server"> <title></title> <style type="text/css"> body { backgr ...

What is the best way to move between websites or pages without having to reload the current page using a selector?

Have you ever wondered how to create a webpage where users can navigate to other websites or pages without seeing their address, simply by selecting from a drop-down menu? Take a look at this example. Another similar example can be found here. When visit ...

Adding an image in HTML from a different drive - step-by-step guide!

Currently, I am immersing myself in HTML, CSS, and JavaScript as I gear up for my upcoming school project centered around frontend development. Here's the issue I encountered. While attempting to insert an image into one of my HTML files, I ran into ...

How can I extract the page's output using JQuery?

Being a rookie in this area, I am eager to learn how to extract specific content from a page using AJAX in JQuery. Currently, I have been able to fetch the data of a page and display it as text: $.ajax({ type: "POST", url: "myfile.html", su ...

How can I line up two divs horizontally within a container div?

Apologies if my terminology is off, I am relatively new to this. My goal is to align two divs horizontally, one containing an image and the other the message content. I have created a messaging user interface. Everything was functioning correctly until I ...

Issue with CSS not appearing in Google Chrome's coverage tab

As I delve into analyzing the extent of unused CSS on my webpage, I encounter a challenge. The webpage is crafted in Angular 7, with CSS incorporated through the angular.json build configuration. The css appears to be added to the head of the html file, e ...

Get the maximum width in pixels through JavaScript when it is specified in different units within the CSS

I'm looking to retrieve the max-width value in px from CSS for use in a JavaScript code. The challenge is that this value might be specified in different units in the CSS file. Any suggestions on how to achieve this using JavaScript? const element = ...

Tips for altering symbol hues in Angular 4 pipelines

Can the color of the Angular 4 pipes symbol be customized? I am looking to change the dollar symbol to a lighter color, for instance. Link to Image The price shown is formatted using the currency pipe: currency:'USD':'symbol-narrow': ...

How can I stack images on top of each other within a div

Currently, I am in the process of creating a blackjack game and encountering an issue with overlapping cards. Despite implementing the code below, all I see is a column of cards displayed. I have looked at similar questions for guidance, but I'm unab ...

Is there a way to create a smooth opacity animation for a background image?

https://i.sstatic.net/PuxYm.jpg I am attempting to create a simple animation on my header using pink red lines that I want to make disappear and reappear on a keyframe. However, when I apply my styles, the entire container is animated instead of just the ...