The one thing my PYTHONSTARTUP does that I would recommend to other is add a function to read from/write to the clipboard. It’s very useful for manipulating whatever I run into.
I read it, but still didn’t find the answer where do I set this variable for jupyterlab/jupyterhub? I assume it has to be set before the interpreter is invoked, so I can’t do it in my notebook. Jupyterlab invokes a kernel, which in my case resides in a conda environment. So probably I could use one of those new conda env commands to set it, but I was wondering if there is a different, conda agnostic, way.
The one thing my PYTHONSTARTUP does that I would recommend to other is add a function to read from/write to the clipboard. It’s very useful for manipulating whatever I run into.
I’d recommend using
inspect
fromrich
. It allows you to introspect into python objects. For example, try running this in your repl:How do you set up this env var in jupyterlab/jupyterhub?
I wrote a tutorial on setting env vars just before this one because I assumed this question would come up. You can read it here: https://bitecode.substack.com/p/environment-variables-for-beginners
I read it, but still didn’t find the answer where do I set this variable for jupyterlab/jupyterhub? I assume it has to be set before the interpreter is invoked, so I can’t do it in my notebook. Jupyterlab invokes a kernel, which in my case resides in a conda environment. So probably I could use one of those new
conda env
commands to set it, but I was wondering if there is a different, conda agnostic, way.Setting an env variable must be done in the program that starts the program, or above.How you do this therefore depends on:
your operating system
how you start jupyterlab
Depending of these factors, the answer will differ.