using_uv/.jupyter/jupyter_lab_config.py

58 lines
1.6 KiB
Python
Raw Permalink Normal View History

2025-10-20 03:37:17 +00:00
# Configuration file for jupyter-server.
from pathlib import Path
user_home = Path.home().absolute()
project_home = Path(".").absolute()
Files = project_home / "Files"
## upper_limit is the top of the tree that File Browser can reach
## start_dir is where File Browser starts
upper_limit = project_home
start_dir = Files.relative_to(upper_limit)
c = get_config() #noqa
## Allow access to hidden files
c.ContentsManager.allow_hidden = True
## Globs -- always hidden
c.ContentsManager.hide_globs = [
'__pycache__',
'*.pyc',
'*.pyo',
'.DS_Store',
'*.so',
'*.dylib',
'*~',
'.venv',
'.jupyter',
'.ipynb_checkpoints',
]
c.ContentsManager.root_dir = str(upper_limit)
c.ContentsManager.preferred_dir = str(start_dir)
## Shutdown
# Shut down the server after N seconds with no kernels
# running and no activity. This can be used together with
# culling idle kernels (MappingKernelManager.cull_idle_timeout)
# to shutdown the Jupyter server when its not in use.
# This is not precisely timed: it may shut down up to a minute later.
# 0 (the default) disables this automatic shutdown.
# Default = 0
c.ServerApp.shutdown_no_activity_timeout = 1
## Time to wait for a kernel to terminate before killing it,
# in seconds. When a shutdown request is initiated, the kernel
# will be immediately sent an interrupt (SIGINT),
# followedby a shutdown_request message, after 1/2 of shutdown_wait_time
# it will be sent a terminate (SIGTERM) request, and finally at the end
# of shutdown_wait_time will be killed (SIGKILL).
# terminate and kill may be equivalent on windows.
# Default: 5.0
c.KernelManager.shutdown_wait_time = 1.0