2

I'm using the xarray_leaflet library that has has a different behavior if the notebook is launch with voila, jupyter or jupyterLab.

Is there a way to detect it programmatically ?

Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47

1 Answers1

2

In versions of voila > .2, there are a bunch of environmental variables on the running environment (e.g. 'QUERY_STRING', 'SERVER_SOFTWARE', 'SERVER_PROTOCOL', 'SERVER_PORT', 'PATH_INFO', 'SERVER_NAME', 'SCRIPT_NAME'), so detecting if you are running in voila is as simple as checking if any of those exist, or even better:

import os
running_in_voila = os.environ.get('SERVER_SOFTWARE','jupyter').startswith('voila')
ntg
  • 12,950
  • 7
  • 74
  • 95