Send the output from a startup script to any new notebook in Jupyter Lab

Viewed 63

I have a startup file that looks like this

if os.getenv("ENV") == "prod" or os.getenv("MASTER_DB_HOST") == "db.domain.com":
    from colorama import Fore, Style
    print(f"{Fore.RED}WARNING!!!") 
    print(f"{Style.DIM}It seems you are running in a PROD like environment (or against the PROD database)")
from my_app.models import Foo, Bar

So when I run IPython this warning message is shown if needed

ipython show startup output

When I use jupyter lab this script is also executed (because the imported objects are available ) but I would like to get the output in the first cell of any notebook. Is this possible?

Alternatively, could I define a default notebook to start with and run it automatically?

0 Answers
Related