|
1 | 1 | from __future__ import annotations |
2 | 2 | from asyncio import get_event_loop_policy |
3 | 3 | from jupyter_server.extension.application import ExtensionApp |
| 4 | +from jupyter_server.serverapp import ServerApp |
4 | 5 | import os |
5 | 6 | from tornado.web import StaticFileHandler |
6 | 7 | from traitlets import List, Unicode, Dict |
| 8 | +from traitlets.config import Config |
7 | 9 | from typing import TYPE_CHECKING |
8 | 10 |
|
9 | 11 | from .config import ConfigManager, ConfigRestAPI |
@@ -205,3 +207,26 @@ def initialize_settings(self): |
205 | 207 |
|
206 | 208 | # Initialize SecretsManager and bind it to global settings dictionary |
207 | 209 | self.settings["jupyternaut.secrets_manager"] = EnvSecretsManager(parent=self) |
| 210 | + |
| 211 | + |
| 212 | + def _link_jupyter_server_extension(self, server_app: ServerApp): |
| 213 | + """Setup custom config needed by this extension.""" |
| 214 | + c = Config() |
| 215 | + c.ContentsManager.allow_hidden = True |
| 216 | + c.ContentsManager.hide_globs = [ |
| 217 | + "__pycache__", # Python bytecode cache directories |
| 218 | + "*.pyc", # Compiled Python files |
| 219 | + "*.pyo", # Optimized Python files |
| 220 | + ".DS_Store", # macOS system files |
| 221 | + "*~", # Editor backup files |
| 222 | + ".ipynb_checkpoints", # Jupyter notebook checkpoint files |
| 223 | + ".git", # Git version control directory |
| 224 | + ".venv", # Python virtual environment directory |
| 225 | + "venv", # Python virtual environment directory |
| 226 | + "node_modules", # Node.js dependencies directory |
| 227 | + ".pytest_cache", # PyTest cache directory |
| 228 | + ".mypy_cache", # MyPy type checker cache directory |
| 229 | + "*.egg-info", # Python package metadata directories |
| 230 | + ] |
| 231 | + server_app.update_config(c) |
| 232 | + super()._link_jupyter_server_extension(server_app) |
0 commit comments