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 ?
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 ?
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')
© 2022 - 2024 — McMap. All rights reserved.