@fails-components/jupyter-launcher 0.0.1-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Marten Richter
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # fails_components_jupyter_launcher
2
+
3
+ [![Github Actions Status](https://github.com/fails-components/jupyterfails/workflows/Build/badge.svg)](https://github.com/fails-components/jupyterfails/actions/workflows/build.yml)
4
+
5
+ This is an extension, where jupyter can be steering inside an iframe.
6
+ You can load, launch and save different notebooks and applets (created with applet-view extension).
7
+
8
+ ## Requirements
9
+
10
+ - JupyterLab >= 4.0.0
11
+
12
+ ## Install
13
+
14
+ To install the extension, execute:
15
+
16
+ ```bash
17
+ pip install fails_components_jupyter_launcher
18
+ ```
19
+
20
+ ## Uninstall
21
+
22
+ To remove the extension, execute:
23
+
24
+ ```bash
25
+ pip uninstall fails_components_jupyter_launcher
26
+ ```
27
+
28
+ ## Contributing
29
+
30
+ ### Development install
31
+
32
+ Note: You will need NodeJS to build the extension package.
33
+
34
+ The `jlpm` command is JupyterLab's pinned version of
35
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
36
+ `yarn` or `npm` in lieu of `jlpm` below.
37
+
38
+ ```bash
39
+ # Clone the repo to your local environment
40
+ # Change directory to the fails_components_jupyter_launcher directory
41
+ jlpm build
42
+ # Install package in development mode
43
+ pip install -e "."
44
+ # Link your development version of the extension with JupyterLab
45
+ jupyter labextension develop . --overwrite
46
+ # Rebuild extension Typescript source after making changes
47
+ jlpm build
48
+ ```
49
+
50
+ You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
51
+
52
+ ```bash
53
+ # Watch the source directory in one terminal, automatically rebuilding when needed
54
+ jlpm watch
55
+ # Run JupyterLab in another terminal
56
+ jupyter lab
57
+ ```
58
+
59
+ With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
60
+
61
+ By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
62
+
63
+ ```bash
64
+ jupyter lab build --minimize=False
65
+ ```
66
+
67
+ ### Development uninstall
68
+
69
+ ```bash
70
+ pip uninstall fails_components_jupyter_launcher
71
+ ```
72
+
73
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
74
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
75
+ folder is located. Then you can remove the symlink named `@fails-components/jupyter-applet-view` within that folder.
76
+
77
+ ### Testing the extension
78
+
79
+ #### Frontend tests
80
+
81
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
82
+
83
+ To execute them, execute:
84
+
85
+ ```sh
86
+ jlpm
87
+ jlpm test
88
+ ```
89
+
90
+ <!--
91
+ #### Integration tests
92
+
93
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
94
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
95
+
96
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
97
+
98
+ ### Packaging the extension
99
+
100
+ See [RELEASE](RELEASE.md)
101
+ -->
package/lib/index.d.ts ADDED
@@ -0,0 +1,139 @@
1
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+ import { JSONObject, PartialJSONObject, Token } from '@lumino/coreutils';
3
+ import { ISignal } from '@lumino/signaling';
4
+ export interface IScreenShotOpts {
5
+ dpi: number;
6
+ }
7
+ export interface IAppletScreenshottaker {
8
+ takeAppScreenshot: (opts: IScreenShotOpts) => Promise<Blob | undefined>;
9
+ }
10
+ interface IContentEvent {
11
+ task: string;
12
+ }
13
+ export interface ILoadJupyterContentEvent extends IContentEvent {
14
+ task: 'loadFile';
15
+ fileData: object | undefined;
16
+ fileName: string;
17
+ }
18
+ export interface ISavedJupyterContentEvent extends IContentEvent {
19
+ task: 'savedFile';
20
+ fileName: string;
21
+ }
22
+ export type IContentEventType = ILoadJupyterContentEvent | ISavedJupyterContentEvent;
23
+ export interface IFailsCallbacks {
24
+ callContents?: (event: IContentEventType) => Promise<any>;
25
+ postMessageToFails?: (message: any, transfer?: Transferable[]) => void;
26
+ }
27
+ export declare const IFailsLauncherInfo: Token<IFailsLauncherInfo>;
28
+ export interface IFailsLauncherInit {
29
+ inLecture: boolean;
30
+ selectedAppid: string | undefined;
31
+ reportMetadata?: (metadata: PartialJSONObject) => void;
32
+ }
33
+ export interface IFailsAppletSize {
34
+ appid: string;
35
+ width: number;
36
+ height: number;
37
+ }
38
+ export interface IAppletWidgetRegistry {
39
+ }
40
+ export interface IFailsInterceptorUpdateMessage {
41
+ path: string;
42
+ mime: string;
43
+ state: JSONObject;
44
+ }
45
+ export interface IFailsLauncherInfo extends IFailsLauncherInit {
46
+ inLectureChanged: ISignal<IFailsLauncherInfo, boolean>;
47
+ selectedAppidChanged: ISignal<this, string | undefined>;
48
+ appletSizes: {
49
+ [key: string]: IFailsAppletSize;
50
+ };
51
+ appletSizesChanged: ISignal<this, {
52
+ [key: string]: IFailsAppletSize;
53
+ }>;
54
+ updateMessageArrived?: ISignal<IAppletWidgetRegistry, IFailsInterceptorUpdateMessage>;
55
+ remoteUpdateMessageArrived: ISignal<IFailsLauncherInfo, IFailsInterceptorUpdateMessage>;
56
+ }
57
+ export interface IReplyJupyter {
58
+ requestId?: number;
59
+ }
60
+ export interface IGDPRProxyInfo {
61
+ allowedSites?: string[] | undefined;
62
+ proxySites?: string[] | undefined;
63
+ proxyURL: string;
64
+ }
65
+ export interface ILoadJupyterInfo {
66
+ type: 'loadJupyter';
67
+ inLecture: boolean;
68
+ rerunAtStartup: boolean;
69
+ installScreenShotPatches: boolean;
70
+ installGDPRProxy?: IGDPRProxyInfo;
71
+ appid?: string;
72
+ fileName: string;
73
+ fileData: object | undefined;
74
+ kernelName: 'python' | 'xpython' | undefined;
75
+ }
76
+ export interface ISaveJupyter {
77
+ type: 'saveJupyter';
78
+ fileName: string;
79
+ }
80
+ export interface IActivateApp {
81
+ type: 'activateApp';
82
+ inLecture: boolean;
83
+ appid?: string;
84
+ }
85
+ export interface IScreenshotApp extends IScreenShotOpts {
86
+ type: 'screenshotApp';
87
+ }
88
+ export interface IActivateInterceptor {
89
+ type: 'activateInterceptor';
90
+ activate: boolean;
91
+ }
92
+ export interface IGetLicenses {
93
+ type: 'getLicenses';
94
+ }
95
+ export interface IRestartKernelAndRerunCells {
96
+ type: 'restartKernelAndRerunCells';
97
+ }
98
+ export interface IInterceptorUpdate {
99
+ path: string;
100
+ mime: string;
101
+ state: JSONObject;
102
+ }
103
+ export interface IReceiveInterceptorUpdate extends IInterceptorUpdate {
104
+ type: 'receiveInterceptorUpdate';
105
+ }
106
+ export type IFailsToJupyterMessage = IActivateApp | IActivateInterceptor | IGetLicenses | IReceiveInterceptorUpdate | IRestartKernelAndRerunCells | ILoadJupyterInfo | IScreenshotApp | ISaveJupyter;
107
+ export interface IAppLoaded {
108
+ task: 'appLoaded';
109
+ }
110
+ export interface IDocDirty {
111
+ task: 'docDirty';
112
+ dirty: boolean;
113
+ }
114
+ export interface IReportMetadata {
115
+ task: 'reportMetadata';
116
+ metadata: {
117
+ failsApp?: JSONObject;
118
+ kernelspec?: JSONObject;
119
+ };
120
+ }
121
+ export interface IReportFailsAppletSizes {
122
+ task: 'reportFailsAppletSizes';
123
+ appletSizes: {
124
+ [key: string]: IFailsAppletSize;
125
+ };
126
+ }
127
+ export interface IReportKernelStatus {
128
+ task: 'reportKernelStatus';
129
+ status: string;
130
+ }
131
+ export interface ISendInterceptorUpdate extends IInterceptorUpdate {
132
+ task: 'sendInterceptorUpdate';
133
+ }
134
+ export type IJupyterToFailsMessage = IReportMetadata | IReportFailsAppletSizes | ISendInterceptorUpdate | IReportKernelStatus | IAppLoaded | IDocDirty;
135
+ /**
136
+ * Initialization data for the @fails-components/jupyter-launcher extension.
137
+ */
138
+ declare const plugins: JupyterFrontEndPlugin<any>[];
139
+ export default plugins;