Skip to content

Commit c8cbb2c

Browse files
Carreauvidartf
authored andcommitted
Inject session identifier into environment variable.
There are many use case where users want to know the current notebook name/path. This help by adding a session identifier (to not really say this is the current notebook name), and by default make it the full path to the notebook document that created the session. This will of course not work if the notebook get renamed, but we can tackle this later. See also jupyter/jupyter_client#656, jupyter/notebook#6180. It will need to be ported to jupyter_server as well. This is the mirror commit of jupyter/notebook#6279 on main notebook.
1 parent f25fd33 commit c8cbb2c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jupyter_server/services/sessions/sessionmanager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ async def start_kernel_for_session(self, session_id, path, name, type, kernel_na
272272
# allow contents manager to specify kernels cwd
273273
kernel_path = self.contents_manager.get_kernel_path(path=path)
274274
kernel_id = await self.kernel_manager.start_kernel(
275-
path=kernel_path, kernel_name=kernel_name
275+
path=kernel_path,
276+
kernel_name=kernel_name,
277+
env={"JPY_SESSION_NAME": path},
276278
)
277279
return kernel_id
278280

0 commit comments

Comments
 (0)