Cannot get notebook to load custom.js

I posted this in response to a year-old topic, but as I’ve been learning more, I believe it may not be the same thing, so posting as new topic.

Perhaps I’m just doing something dumb (it happens – no, really). The preceding post has code to replicate what I’m (not) seeing.

More info from testing. 3 files (didn’t see a way to attach):

foo.ipynb:

{
 "cells": [],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 5
}

custom.js:

console.log("custom log message");

test.sh:

#/bin/bash

set -x
rm -rf test
mkdir test; cd test
python3.10 -m venv foo_venv
source foo_venv/bin/activate 2>> /dev/null
pip install pip setuptools --upgrade >> /dev/null
pip install notebook >> /dev/null
ipython kernel install --name foo_venv --prefix=./foo_venv >> .install.log
jupyter kernelspec list | grep -E "^\s*foo_venv(\s.*)?$"
cp ../foo.ipynb .
cat foo.ipynb
export JUPYTER_CONFIG_DIR=$(pwd)/foo_venv/etc/jupyter/
echo $JUPYTER_CONFIG_DIR 
jupyter migrate    # mine says [JupyterMigrate] Found nothing to migrate.
mkdir -p foo_venv/etc/jupyter/custom
cp ../custom.js foo_venv/etc/jupyter/custom/
date
stat foo_venv/etc/jupyter/custom/custom.js
# BTW, *without* editing ```foo.ipynb```, how can I tell it to just launch this kernel without the popup?
jupyter-notebook foo.ipynb --MultiKernelManager.default_kernel_name=foo_venv 2>> /dev/null
stat foo_venv/etc/jupyter/custom/custom.js 
date
cat foo_venv/etc/jupyter/custom/custom.js   # doing after so as not to change the access/creation times
cd ..
deactivate 2>> /dev/null
set +x

To run: chmod +x test.sh; ./test.sh

  • Creates a dir test, goes into it
  • makes and activates venv foo_venv
  • installs notebook
  • installs foo_venv kernel locally (in (./)foo_venv/share/jupyter/kernels/foo_venv)
  • puts custom.js into ${JUPYTER_CONFIG_DIR}=$(pwd)/foo_venv/etc/jupyter in /custom
  • stats custom.js
  • runs minimal notebook foo.ipynb (See comment above about getting notebook to “just launch” the kernel)* (Ctrl-C or File->Shut Down to exit.)
  • stats custom.js again.
++ date
Sun Aug 20 14:44:00 EDT 2023
++ stat foo_venv/etc/jupyter/custom/custom.js
16777220 261616118 -rw-r--r-- 1 me me 0 35 "Aug 20 14:44:00 2023" "Aug 20 14:44:00 2023" "Aug 20 14:44:00 2023" "Aug 20 14:44:00 2023" 4096 8 0 foo_venv/etc/jupyter/custom/custom.js
++ jupyter-notebook foo.ipynb  --MultiKernelManager.default_kernel_name=foo_venv
++ stat foo_venv/etc/jupyter/custom/custom.js
16777220 261616118 -rw-r--r-- 1 me me 0 35 "Aug 20 14:44:05 2023" "Aug 20 14:44:00 2023" "Aug 20 14:44:00 2023" "Aug 20 14:44:00 2023" 4096 8 0 foo_venv/etc/jupyter/custom/custom.js
++ date
Sun Aug 20 14:44:15 EDT 2023

Clearly something jupyter-notebook did accessed custom.js, but I don’t see “custom log message” in the console log.