Skip to content

Commit 85dc797

Browse files
authored
Report filesystem availability in the log console (#196)
* Report filesystem availability in the log console * improve message
1 parent 229dbb5 commit 85dc797

File tree

1 file changed

+27
-7
lines changed
  • packages/pyodide-kernel-extension/src

1 file changed

+27
-7
lines changed

packages/pyodide-kernel-extension/src/index.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,7 @@ const kernel: JupyterFrontEndPlugin<void> = {
105105

106106
const mountDrive = !!(serviceWorkerManager?.enabled || crossOriginIsolated);
107107

108-
if (mountDrive) {
109-
console.info('Pyodide contents will be synced with Jupyter Contents');
110-
} else {
111-
console.warn('Pyodide contents will NOT be synced with Jupyter Contents');
112-
}
113-
114-
return new PyodideKernel({
108+
const kernel = new PyodideKernel({
115109
...options,
116110
pyodideUrl,
117111
pipliteWheelUrl,
@@ -123,6 +117,32 @@ const kernel: JupyterFrontEndPlugin<void> = {
123117
browsingContextId: serviceWorkerManager?.browsingContextId,
124118
logger,
125119
});
120+
121+
if (mountDrive) {
122+
console.info('Pyodide contents will be synced with Jupyter Contents');
123+
} else {
124+
const warningMessage =
125+
'Pyodide contents will NOT be synced with Jupyter Contents. ' +
126+
'For full functionality, try using a regular browser tab instead of private/incognito mode, ' +
127+
'especially in Firefox where this is a known limitation.';
128+
console.warn(warningMessage);
129+
130+
// Wait for kernel to be ready before logging the warning
131+
kernel.ready.then(() => {
132+
if (loggerRegistry) {
133+
void logger({
134+
payload: {
135+
type: 'text',
136+
data: warningMessage,
137+
level: 'warning',
138+
},
139+
kernelId: options.id,
140+
});
141+
}
142+
});
143+
}
144+
145+
return kernel;
126146
},
127147
});
128148
},

0 commit comments

Comments
 (0)