How to set iPython startup script for all users

We have a set of precompiled modules that we would normally (as in, Python on a local machine) advise users to load with a startup script pointed to by PYTHONSTARTUP in their shell profile. We would like to do something similar under TLJH, but as far as I can tell, /etc/bash.bashrc and ~/.bashrc are not modifying the environment into which the iPython instances are launched. I understand that we can modify the environment for the application launchers with /opt/tljh/config/jupyterhub_config.d/, and that startup scripts can be added to ~/.ipython/profile_default/startup for individual users, but we would like to have a startup script run for all users without having to copy it to each user’s home. Is there a recommended way to go about this? Thanks!

1 Like

After experimenting some more (added PYTHONSTARTUP to c.Spawner.environment) it appears that the process started by the ‘Python 3 (ipykernel)’ launcher does not run the script pointed to by PYTHONSTARTUP as expected anyhow.