'''
  This script initializes Jupyter's configuration such as passwords and other
  things. It is run by IPython hence why it can use functions like get_config().
'''
from jupyter_server.auth import passwd
import pathlib
import jupyterlab
import os

c = get_config()

c.ServerApp.password = passwd("{{ password }}")
c.LabApp.app_dir = str(pathlib.Path(jupyterlab.__file__).parent.parent / 'share' / 'jupyter' / 'lab')

try:
  os.environ['PATH'] = "{{ gcc_location }}/bin" + os.pathsep + os.environ['PATH']
except KeyError:
  os.environ['PATH'] = "{{ gcc_location }}/bin"

try:
  os.environ['PYTHONPATH'] = "{{ cythonplus_repository }}" + os.pathsep + os.environ['PYTHONPATH']
except KeyError:
  os.environ['PYTHONPATH'] = "{{ cythonplus_repository }}"
