kernel-checkpoint 0.1.1__py3-none-any.whl

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.
@@ -0,0 +1,33 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "5bad4908-0685-4f4f-90ba-a6c36dfecade",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": []
10
+ }
11
+ ],
12
+ "metadata": {
13
+ "kernelspec": {
14
+ "display_name": "Python 3 (ipykernel)",
15
+ "language": "python",
16
+ "name": "python3"
17
+ },
18
+ "language_info": {
19
+ "codemirror_mode": {
20
+ "name": "ipython",
21
+ "version": 3
22
+ },
23
+ "file_extension": ".py",
24
+ "mimetype": "text/x-python",
25
+ "name": "python",
26
+ "nbconvert_exporter": "python",
27
+ "pygments_lexer": "ipython3",
28
+ "version": "3.13.9"
29
+ }
30
+ },
31
+ "nbformat": 4,
32
+ "nbformat_minor": 5
33
+ }
@@ -0,0 +1,23 @@
1
+ try:
2
+ from ._version import __version__
3
+ except ImportError:
4
+ import warnings
5
+ warnings.warn("Importing 'kernel_checkpoint' outside a proper installation.")
6
+ __version__ = "dev"
7
+
8
+
9
+ def _jupyter_labextension_paths():
10
+ return [{
11
+ "src": "labextension",
12
+ "dest": "kernel-checkpoint"
13
+ }]
14
+
15
+
16
+ def _jupyter_server_extension_points():
17
+ return [{"module": "kernel_checkpoint"}]
18
+
19
+
20
+ def _load_jupyter_server_extension(server_app):
21
+ from .handlers import setup_handlers
22
+ setup_handlers(server_app.web_app)
23
+ server_app.log.info("kernel_checkpoint server extension loaded")
@@ -0,0 +1,4 @@
1
+ # This file is auto-generated by Hatchling. As such, do not:
2
+ # - modify
3
+ # - track in version control e.g. be sure to add to .gitignore
4
+ __version__ = VERSION = '0.1.1'
@@ -0,0 +1,163 @@
1
+ import os
2
+ import json
3
+
4
+ from tornado import web, httpclient
5
+ from jupyter_server.base.handlers import APIHandler
6
+ from jupyter_server.utils import url_path_join
7
+
8
+
9
+ def _get_api_url():
10
+ return os.environ.get("CHECKPOINT_API_URL", "").rstrip("/")
11
+
12
+
13
+ def _get_namespace():
14
+ ns = os.environ.get("CHECKPOINT_NAMESPACE", "")
15
+ if not ns:
16
+ try:
17
+ with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace") as f:
18
+ ns = f.read().strip()
19
+ except (FileNotFoundError, PermissionError):
20
+ ns = ""
21
+ return ns
22
+
23
+
24
+ class ConfigHandler(APIHandler):
25
+ @web.authenticated
26
+ async def get(self):
27
+ self.finish(json.dumps({
28
+ "checkpointApiUrl": _get_api_url(),
29
+ "namespace": _get_namespace(),
30
+ }))
31
+
32
+
33
+ class CheckpointListCreateHandler(APIHandler):
34
+ """Handles listing and creating checkpoints."""
35
+
36
+ @web.authenticated
37
+ async def get(self):
38
+ namespace = self.get_argument("namespace", _get_namespace())
39
+ api_url = _get_api_url()
40
+ if not api_url:
41
+ raise web.HTTPError(500, "CHECKPOINT_API_URL not configured")
42
+
43
+ client = httpclient.AsyncHTTPClient()
44
+ url = f"{api_url}/api/v1/checkpoints?namespace={namespace}"
45
+ try:
46
+ resp = await client.fetch(url, raise_error=False)
47
+ self.set_status(resp.code)
48
+ self.set_header("Content-Type", "application/json")
49
+ self.finish(resp.body)
50
+ except Exception as e:
51
+ raise web.HTTPError(502, f"Failed to reach checkpoint API: {e}")
52
+
53
+ @web.authenticated
54
+ async def post(self):
55
+ api_url = _get_api_url()
56
+ if not api_url:
57
+ raise web.HTTPError(500, "CHECKPOINT_API_URL not configured")
58
+
59
+ body = self.get_json_body()
60
+ client = httpclient.AsyncHTTPClient()
61
+ url = f"{api_url}/api/v1/checkpoints"
62
+ req = httpclient.HTTPRequest(
63
+ url=url,
64
+ method="POST",
65
+ headers={"Content-Type": "application/json"},
66
+ body=json.dumps(body),
67
+ )
68
+ try:
69
+ resp = await client.fetch(req, raise_error=False)
70
+ self.set_status(resp.code)
71
+ self.set_header("Content-Type", "application/json")
72
+ self.finish(resp.body)
73
+ except Exception as e:
74
+ raise web.HTTPError(502, f"Failed to reach checkpoint API: {e}")
75
+
76
+
77
+ class CheckpointDetailHandler(APIHandler):
78
+ """Handles get / delete / patch for a single checkpoint."""
79
+
80
+ @web.authenticated
81
+ async def get(self, namespace, name):
82
+ api_url = _get_api_url()
83
+ if not api_url:
84
+ raise web.HTTPError(500, "CHECKPOINT_API_URL not configured")
85
+
86
+ client = httpclient.AsyncHTTPClient()
87
+ url = f"{api_url}/api/v1/checkpoints/{namespace}/{name}"
88
+ try:
89
+ resp = await client.fetch(url, raise_error=False)
90
+ self.set_status(resp.code)
91
+ self.set_header("Content-Type", "application/json")
92
+ self.finish(resp.body)
93
+ except Exception as e:
94
+ raise web.HTTPError(502, f"Failed to reach checkpoint API: {e}")
95
+
96
+ @web.authenticated
97
+ async def delete(self, namespace, name):
98
+ api_url = _get_api_url()
99
+ if not api_url:
100
+ raise web.HTTPError(500, "CHECKPOINT_API_URL not configured")
101
+
102
+ client = httpclient.AsyncHTTPClient()
103
+ url = f"{api_url}/api/v1/checkpoints/{namespace}/{name}"
104
+ req = httpclient.HTTPRequest(url=url, method="DELETE")
105
+ try:
106
+ resp = await client.fetch(req, raise_error=False)
107
+ self.set_status(resp.code)
108
+ if resp.body:
109
+ self.finish(resp.body)
110
+ else:
111
+ self.finish("{}")
112
+ except Exception as e:
113
+ raise web.HTTPError(502, f"Failed to reach checkpoint API: {e}")
114
+
115
+ @web.authenticated
116
+ async def patch(self, namespace, name):
117
+ api_url = _get_api_url()
118
+ if not api_url:
119
+ raise web.HTTPError(500, "CHECKPOINT_API_URL not configured")
120
+
121
+ body = self.get_json_body()
122
+ client = httpclient.AsyncHTTPClient()
123
+ url = f"{api_url}/api/v1/checkpoints/{namespace}/{name}"
124
+ req = httpclient.HTTPRequest(
125
+ url=url,
126
+ method="PATCH",
127
+ headers={"Content-Type": "application/json"},
128
+ body=json.dumps(body),
129
+ )
130
+ try:
131
+ resp = await client.fetch(req, raise_error=False)
132
+ self.set_status(resp.code)
133
+ self.set_header("Content-Type", "application/json")
134
+ self.finish(resp.body)
135
+ except Exception as e:
136
+ raise web.HTTPError(502, f"Failed to reach checkpoint API: {e}")
137
+
138
+
139
+ def setup_handlers(web_app):
140
+ host_pattern = ".*$"
141
+ base_url = web_app.settings["base_url"]
142
+
143
+ handlers = [
144
+ (
145
+ url_path_join(base_url, "kernel-checkpoint", "config"),
146
+ ConfigHandler,
147
+ ),
148
+ (
149
+ url_path_join(base_url, "kernel-checkpoint", "checkpoints"),
150
+ CheckpointListCreateHandler,
151
+ ),
152
+ (
153
+ url_path_join(
154
+ base_url,
155
+ "kernel-checkpoint",
156
+ "checkpoints",
157
+ r"([^/]+)",
158
+ r"([^/]+)",
159
+ ),
160
+ CheckpointDetailHandler,
161
+ ),
162
+ ]
163
+ web_app.add_handlers(host_pattern, handlers)
@@ -0,0 +1,7 @@
1
+ {
2
+ "ServerApp": {
3
+ "jpserver_extensions": {
4
+ "kernel_checkpoint": true
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "packageManager": "python",
3
+ "packageName": "kernel_checkpoint",
4
+ "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package kernel_checkpoint"
5
+ }
@@ -0,0 +1,216 @@
1
+ {
2
+ "name": "kernel-checkpoint",
3
+ "version": "0.1.1",
4
+ "description": "An extension for saving and restoring kernel pod state with jupyter enterprise gateway",
5
+ "keywords": [
6
+ "jupyter",
7
+ "jupyterlab",
8
+ "jupyterlab-extension"
9
+ ],
10
+ "homepage": "https://github.com/lehuannhatrang/kernel-checkpoint-extension.git",
11
+ "bugs": {
12
+ "url": "https://github.com/lehuannhatrang/kernel-checkpoint-extension.git/issues"
13
+ },
14
+ "license": "BSD-3-Clause",
15
+ "author": {
16
+ "name": "Leehun",
17
+ "email": "lehuannhatrang98@gmail.com"
18
+ },
19
+ "files": [
20
+ "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
21
+ "style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
22
+ "src/**/*.{ts,tsx}"
23
+ ],
24
+ "main": "lib/index.js",
25
+ "types": "lib/index.d.ts",
26
+ "style": "style/index.css",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/lehuannhatrang/kernel-checkpoint-extension.git.git"
30
+ },
31
+ "scripts": {
32
+ "build": "jlpm build:lib && jlpm build:labextension:dev",
33
+ "build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
34
+ "build:labextension": "jupyter labextension build .",
35
+ "build:labextension:dev": "jupyter labextension build --development True .",
36
+ "build:lib": "tsc --sourceMap",
37
+ "build:lib:prod": "tsc",
38
+ "clean": "jlpm clean:lib",
39
+ "clean:lib": "rimraf lib tsconfig.tsbuildinfo",
40
+ "clean:lintcache": "rimraf .eslintcache .stylelintcache",
41
+ "clean:labextension": "rimraf kernel_checkpoint/labextension kernel_checkpoint/_version.py",
42
+ "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
43
+ "eslint": "jlpm eslint:check --fix",
44
+ "eslint:check": "eslint . --cache --ext .ts,.tsx",
45
+ "install:extension": "jlpm build",
46
+ "lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
47
+ "lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
48
+ "prettier": "jlpm prettier:base --write --list-different",
49
+ "prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
50
+ "prettier:check": "jlpm prettier:base --check",
51
+ "stylelint": "jlpm stylelint:check --fix",
52
+ "stylelint:check": "stylelint --cache \"style/**/*.css\"",
53
+ "test": "jest --coverage",
54
+ "watch": "run-p watch:src watch:labextension",
55
+ "watch:src": "tsc -w --sourceMap",
56
+ "watch:labextension": "jupyter labextension watch ."
57
+ },
58
+ "dependencies": {
59
+ "@jupyterlab/application": "^4.0.0",
60
+ "@jupyterlab/apputils": "^4.0.0",
61
+ "@jupyterlab/coreutils": "^6.0.0",
62
+ "@jupyterlab/notebook": "^4.0.0",
63
+ "@jupyterlab/services": "^7.0.0"
64
+ },
65
+ "devDependencies": {
66
+ "@jupyterlab/builder": "^4.0.0",
67
+ "@jupyterlab/testutils": "^4.0.0",
68
+ "@types/jest": "^29.2.0",
69
+ "@types/json-schema": "^7.0.11",
70
+ "@types/react": "^18.0.26",
71
+ "@types/react-addons-linked-state-mixin": "^0.14.22",
72
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
73
+ "@typescript-eslint/parser": "^6.1.0",
74
+ "css-loader": "^6.7.1",
75
+ "eslint": "^8.36.0",
76
+ "eslint-config-prettier": "^8.8.0",
77
+ "eslint-plugin-prettier": "^5.0.0",
78
+ "jest": "^29.2.0",
79
+ "npm-run-all2": "^7.0.1",
80
+ "prettier": "^3.0.0",
81
+ "rimraf": "^5.0.1",
82
+ "source-map-loader": "^1.0.2",
83
+ "style-loader": "^3.3.1",
84
+ "stylelint": "^15.10.1",
85
+ "stylelint-config-recommended": "^13.0.0",
86
+ "stylelint-config-standard": "^34.0.0",
87
+ "stylelint-csstree-validator": "^3.0.0",
88
+ "stylelint-prettier": "^4.0.0",
89
+ "typescript": "~5.5.4",
90
+ "yjs": "^13.5.0"
91
+ },
92
+ "resolutions": {
93
+ "lib0": "0.2.111"
94
+ },
95
+ "sideEffects": [
96
+ "style/*.css",
97
+ "style/index.js"
98
+ ],
99
+ "styleModule": "style/index.js",
100
+ "publishConfig": {
101
+ "access": "public"
102
+ },
103
+ "jupyterlab": {
104
+ "extension": true,
105
+ "discovery": {
106
+ "server": {
107
+ "managers": [
108
+ "pip"
109
+ ],
110
+ "base": {
111
+ "name": "kernel_checkpoint"
112
+ }
113
+ }
114
+ },
115
+ "outputDir": "kernel_checkpoint/labextension",
116
+ "_build": {
117
+ "load": "static/remoteEntry.d4b802a14146b6757b67.js",
118
+ "extension": "./extension",
119
+ "style": "./style"
120
+ }
121
+ },
122
+ "eslintIgnore": [
123
+ "node_modules",
124
+ "dist",
125
+ "coverage",
126
+ "**/*.d.ts",
127
+ "tests",
128
+ "**/__tests__",
129
+ "ui-tests"
130
+ ],
131
+ "eslintConfig": {
132
+ "extends": [
133
+ "eslint:recommended",
134
+ "plugin:@typescript-eslint/eslint-recommended",
135
+ "plugin:@typescript-eslint/recommended",
136
+ "plugin:prettier/recommended"
137
+ ],
138
+ "parser": "@typescript-eslint/parser",
139
+ "parserOptions": {
140
+ "project": "tsconfig.json",
141
+ "sourceType": "module"
142
+ },
143
+ "plugins": [
144
+ "@typescript-eslint"
145
+ ],
146
+ "rules": {
147
+ "@typescript-eslint/naming-convention": [
148
+ "error",
149
+ {
150
+ "selector": "interface",
151
+ "format": [
152
+ "PascalCase"
153
+ ],
154
+ "custom": {
155
+ "regex": "^I[A-Z]",
156
+ "match": true
157
+ }
158
+ }
159
+ ],
160
+ "@typescript-eslint/no-unused-vars": [
161
+ "warn",
162
+ {
163
+ "args": "none"
164
+ }
165
+ ],
166
+ "@typescript-eslint/no-explicit-any": "off",
167
+ "@typescript-eslint/no-namespace": "off",
168
+ "@typescript-eslint/no-use-before-define": "off",
169
+ "@typescript-eslint/quotes": [
170
+ "error",
171
+ "single",
172
+ {
173
+ "avoidEscape": true,
174
+ "allowTemplateLiterals": false
175
+ }
176
+ ],
177
+ "curly": [
178
+ "error",
179
+ "all"
180
+ ],
181
+ "eqeqeq": "error",
182
+ "prefer-arrow-callback": "error"
183
+ }
184
+ },
185
+ "prettier": {
186
+ "singleQuote": true,
187
+ "trailingComma": "none",
188
+ "arrowParens": "avoid",
189
+ "endOfLine": "auto",
190
+ "overrides": [
191
+ {
192
+ "files": "package.json",
193
+ "options": {
194
+ "tabWidth": 4
195
+ }
196
+ }
197
+ ]
198
+ },
199
+ "stylelint": {
200
+ "extends": [
201
+ "stylelint-config-recommended",
202
+ "stylelint-config-standard",
203
+ "stylelint-prettier/recommended"
204
+ ],
205
+ "plugins": [
206
+ "stylelint-csstree-validator"
207
+ ],
208
+ "rules": {
209
+ "csstree/validator": true,
210
+ "property-no-vendor-prefix": null,
211
+ "selector-class-pattern": "^([a-z][A-z\\d]*)(-[A-z\\d]+)*$",
212
+ "selector-no-vendor-prefix": null,
213
+ "value-no-vendor-prefix": null
214
+ }
215
+ }
216
+ }
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkkernel_checkpoint=self.webpackChunkkernel_checkpoint||[]).push([[397],{397(e,t,n){n.r(t),n.d(t,{default:()=>g});var a,c=n(208),l=n(778),s=n(41),o=n(498),i=n(345),r=n.n(i);function m(e,t={}){const n=o.ServerConnection.makeSettings(),a=s.URLExt.join(n.baseUrl,"kernel-checkpoint",e);return o.ServerConnection.makeRequest(a,t,n)}function k(e,t){return{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}}async function u(e){if(!e.ok){let t=e.statusText;try{const n=await e.json();t=n.message||n.error||JSON.stringify(n)}catch(e){}throw new Error(t)}return e.json()}function d({phase:e}){const t=e.toLowerCase().replace(/\s+/g,"-");return r().createElement("span",{className:`kc-phase kc-phase-${t}`},e)}function p(e){return new Date(e).toLocaleString()}function h(e){const{namespace:t,kernelId:n,onRestore:c}=e,[l,s]=(0,i.useState)([]),[o,m]=(0,i.useState)(!0),[k,u]=(0,i.useState)(null),[h,E]=(0,i.useState)(!1),[b,g]=(0,i.useState)(""),[N,C]=(0,i.useState)(!1),[y,v]=(0,i.useState)(null),[f,w]=(0,i.useState)(null),[S,x]=(0,i.useState)(null),[R,I]=(0,i.useState)(null),[F,T]=(0,i.useState)(""),[D,K]=(0,i.useState)(null),[P,$]=(0,i.useState)(null),[O,U]=(0,i.useState)(null),_=(0,i.useCallback)(async()=>{var e,n;m(!0),u(null);try{const n=await a.listCheckpoints(t);s(null!==(e=n.items)&&void 0!==e?e:[])}catch(e){u(null!==(n=e.message)&&void 0!==n?n:"Failed to load checkpoints")}finally{m(!1)}},[t]);(0,i.useEffect)(()=>{_()},[_]),(0,i.useEffect)(()=>{if(!l.some(e=>"Completed"!==e.phase&&"Failed"!==e.phase))return;const e=setInterval(_,5e3);return()=>clearInterval(e)},[l,_]);const j=async()=>{var e;if(b.trim()){C(!0),K(null);try{await a.createCheckpoint({name:b.trim(),namespace:t,kernelId:n,buildImage:!1}),g(""),E(!1),K({type:"success",text:"Checkpoint created successfully."}),await _()}catch(t){K({type:"error",text:null!==(e=t.message)&&void 0!==e?e:"Failed to create checkpoint"})}finally{C(!1)}}},A=async e=>{var n;const c=F.trim();if(c&&c!==e){K(null);try{await a.updateCheckpoint(t,e,{name:c}),I(null),K({type:"success",text:`Checkpoint renamed to "${c}".`}),await _()}catch(e){K({type:"error",text:null!==(n=e.message)&&void 0!==n?n:"Failed to rename checkpoint"})}}else I(null)};return r().createElement("div",{className:"kc-panel"},D&&r().createElement("div",{className:`kc-flash kc-flash-${D.type}`},r().createElement("span",null,D.text),r().createElement("button",{className:"kc-flash-close",onClick:()=>K(null)},"×")),r().createElement("div",{className:"kc-create-section"},h?r().createElement("div",{className:"kc-create-form"},r().createElement("input",{className:"kc-input",type:"text",placeholder:"Enter checkpoint name…",value:b,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j()},autoFocus:!0,disabled:N}),r().createElement("button",{className:"kc-btn kc-btn-primary",disabled:N||!b.trim(),onClick:j},N?"Saving…":"Save"),r().createElement("button",{className:"kc-btn",onClick:()=>{E(!1),g("")}},"Cancel")):r().createElement("button",{className:"kc-btn kc-btn-primary",onClick:()=>E(!0)},"Save Kernel State")),r().createElement("div",{className:"kc-list"},o&&0===l.length?r().createElement("div",{className:"kc-placeholder"},"Loading checkpoints…"):k?r().createElement("div",{className:"kc-placeholder kc-placeholder-error"},k):0===l.length?r().createElement("div",{className:"kc-placeholder"},"No checkpoints found. Click “Save Kernel State” to create one."):l.map(e=>r().createElement("div",{key:e.name,className:"kc-item"},r().createElement("div",{className:"kc-item-header"},r().createElement("div",{className:"kc-item-info"},R===e.name?r().createElement("div",{className:"kc-rename-form"},r().createElement("input",{className:"kc-input kc-input-sm",type:"text",value:F,onChange:e=>T(e.target.value),onKeyDown:t=>{"Enter"===t.key&&A(e.name),"Escape"===t.key&&I(null)},autoFocus:!0}),r().createElement("button",{className:"kc-btn kc-btn-xs",onClick:()=>A(e.name)},"OK"),r().createElement("button",{className:"kc-btn kc-btn-xs",onClick:()=>I(null)},"Cancel")):r().createElement("span",{className:"kc-item-name",title:e.name},e.name),r().createElement("div",{className:"kc-item-meta"},r().createElement(d,{phase:e.phase}),r().createElement("span",{className:"kc-item-date"},p(e.createdAt)))),r().createElement("div",{className:"kc-item-actions"},r().createElement("button",{className:"kc-btn kc-btn-xs",onClick:()=>(async e=>{var n;if(f===e)return w(null),void x(null);try{const n=await a.getCheckpoint(t,e);x(n),w(e)}catch(e){K({type:"error",text:null!==(n=e.message)&&void 0!==n?n:"Failed to get checkpoint details"})}})(e.name)},f===e.name?"Hide":"Details"),r().createElement("button",{className:"kc-btn kc-btn-xs",onClick:()=>{I(e.name),T(e.name)}},"Rename"),P===e.name?r().createElement(r().Fragment,null,r().createElement("span",{className:"kc-confirm-label"},"Delete?"),r().createElement("button",{className:"kc-btn kc-btn-xs kc-btn-danger",onClick:()=>(async e=>{var n;K(null),$(null);try{await a.deleteCheckpoint(t,e),K({type:"success",text:`Checkpoint "${e}" deleted.`}),f===e&&(w(null),x(null)),await _()}catch(e){K({type:"error",text:null!==(n=e.message)&&void 0!==n?n:"Failed to delete checkpoint"})}})(e.name)},"Yes"),r().createElement("button",{className:"kc-btn kc-btn-xs",onClick:()=>$(null)},"No")):r().createElement("button",{className:"kc-btn kc-btn-xs kc-btn-danger",onClick:()=>$(e.name)},"Delete"),O===e.name?r().createElement(r().Fragment,null,r().createElement("span",{className:"kc-confirm-label"},"Restore?"),r().createElement("button",{className:"kc-btn kc-btn-xs kc-btn-restore",onClick:()=>(async e=>{var t;U(null),v(e),K(null);try{await c(e),K({type:"success",text:`Kernel restored from "${e}". The kernel is restarting.`})}catch(e){K({type:"error",text:null!==(t=e.message)&&void 0!==t?t:"Failed to restore checkpoint"})}finally{v(null)}})(e.name)},"Yes"),r().createElement("button",{className:"kc-btn kc-btn-xs",onClick:()=>U(null)},"No")):r().createElement("button",{className:"kc-btn kc-btn-xs kc-btn-restore",disabled:null!==y||"Completed"!==e.phase,title:"Completed"!==e.phase?"Checkpoint must be completed to restore":"Restore from this checkpoint",onClick:()=>U(e.name)},y===e.name?"Restoring…":"Restore"))),f===e.name&&S&&r().createElement("div",{className:"kc-detail"},r().createElement("div",{className:"kc-detail-row"},r().createElement("span",{className:"kc-detail-label"},"Phase"),r().createElement("span",null,S.phase)),r().createElement("div",{className:"kc-detail-row"},r().createElement("span",{className:"kc-detail-label"},"Message"),r().createElement("span",null,S.message)),r().createElement("div",{className:"kc-detail-row"},r().createElement("span",{className:"kc-detail-label"},"Schedule"),r().createElement("span",null,S.schedule)),S.podRef&&r().createElement("div",{className:"kc-detail-row"},r().createElement("span",{className:"kc-detail-label"},"Pod"),r().createElement("span",null,S.podRef.name)),S.checkpointFiles&&S.checkpointFiles.length>0&&r().createElement("div",{className:"kc-detail-section"},r().createElement("span",{className:"kc-detail-label"},"Checkpoint Files"),S.checkpointFiles.map((e,t)=>r().createElement("div",{key:t,className:"kc-detail-file"},r().createElement("span",null,e.containerName),r().createElement("span",{className:"kc-detail-time"},p(e.checkpointTime))))),S.builtImages&&S.builtImages.length>0&&r().createElement("div",{className:"kc-detail-section"},r().createElement("span",{className:"kc-detail-label"},"Built Images"),S.builtImages.map((e,t)=>r().createElement("div",{key:t,className:"kc-detail-file"},r().createElement("span",{className:"kc-detail-image-name"},e.imageName),r().createElement("span",{className:"kc-detail-time"},p(e.buildTime))))))))),r().createElement("div",{className:"kc-footer"},r().createElement("button",{className:"kc-btn",onClick:_,disabled:o},o?"Refreshing…":"Refresh")))}!function(e){e.getConfig=async function(){return u(await m("config"))},e.listCheckpoints=async function(e){return u(await m(`checkpoints?namespace=${encodeURIComponent(e)}`))},e.getCheckpoint=async function(e,t){return u(await m(`checkpoints/${encodeURIComponent(e)}/${encodeURIComponent(t)}`))},e.createCheckpoint=async function(e){return u(await m("checkpoints",k("POST",e)))},e.deleteCheckpoint=async function(e,t){const n=await m(`checkpoints/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){let e=n.statusText;try{const t=await n.json();e=t.message||t.error||JSON.stringify(t)}catch(e){}throw new Error(e)}},e.updateCheckpoint=async function(e,t,n){return u(await m(`checkpoints/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,k("PATCH",n)))}}(a||(a={}));class E extends l.ReactWidget{constructor(e){super(),this._props=e,this.addClass("kc-dialog-body")}render(){return r().createElement(h,this._props)}}const b="kernel-checkpoint:open",g={id:"kernel-checkpoint:plugin",description:"An extension for saving and restoring kernel pod state with jupyter enterprise gateway",autoStart:!0,requires:[c.INotebookTracker],activate:(e,t)=>{console.log("JupyterLab extension kernel-checkpoint is activated!"),e.commands.addCommand(b,{label:"Saving Points",caption:"Manage kernel checkpoints",execute:async()=>{var e;const n=t.currentWidget;if(!n)return;const c=n.sessionContext;let i;await c.ready;try{i=await a.getConfig()}catch(e){return void await(0,l.showDialog)({title:"Configuration Error",body:"Failed to load checkpoint configuration. Ensure CHECKPOINT_API_URL is set.",buttons:[l.Dialog.okButton()]})}if(!i.namespace)return void await(0,l.showDialog)({title:"Configuration Error",body:"Namespace not configured. Set CHECKPOINT_NAMESPACE environment variable or deploy in Kubernetes.",buttons:[l.Dialog.okButton()]});const r=null===(e=c.session)||void 0===e?void 0:e.kernel;if(!r)return void await(0,l.showDialog)({title:"No Kernel",body:"No kernel is connected. Please start a kernel first.",buttons:[l.Dialog.okButton()]});const m=r.id,k=r.name||"python_kubernetes",u=new E({namespace:i.namespace,kernelId:m,kernelSpecName:k,onRestore:async e=>{const t=o.ServerConnection.makeSettings(),n=s.URLExt.join(t.baseUrl,"api","kernels"),a=await o.ServerConnection.makeRequest(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:k,env:{CHECKPOINT_RESTORE_NAME:e}})},t);if(!a.ok){const e=await a.text();throw new Error(`Failed to create restored kernel: ${e}`)}const l=await a.json();await c.changeKernel({id:l.id})}});await(0,l.showDialog)({title:"Kernel Checkpoints",body:u,buttons:[l.Dialog.cancelButton({label:"Close"})]}),u.dispose()}}),t.widgetAdded.connect((t,n)=>{const a=new l.ToolbarButton({label:"Saving Points",tooltip:"Open kernel checkpoint manager",onClick:()=>{e.commands.execute(b)}});n.toolbar.insertItem(10,"kernel-checkpoint",a)})}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkkernel_checkpoint=self.webpackChunkkernel_checkpoint||[]).push([[728],{475(n,r,o){o.d(r,{A:()=>i});var e=o(601),t=o.n(e),a=o(314),c=o.n(a)()(t());c.push([n.id,"/* Kernel Checkpoint Extension styles */\n\n/* ------------------------------------------------------------------ */\n/* Dialog body */\n/* ------------------------------------------------------------------ */\n\n.kc-dialog-body {\n min-width: 650px;\n max-height: 65vh;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n/* ------------------------------------------------------------------ */\n/* Panel */\n/* ------------------------------------------------------------------ */\n\n.kc-panel {\n font-family: var(--jp-ui-font-family);\n font-size: var(--jp-ui-font-size1);\n color: var(--jp-ui-font-color1);\n}\n\n/* ------------------------------------------------------------------ */\n/* Flash messages */\n/* ------------------------------------------------------------------ */\n\n.kc-flash {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n border-radius: 4px;\n margin-bottom: 12px;\n font-size: var(--jp-ui-font-size1);\n}\n\n.kc-flash-success {\n background: var(--jp-success-color3, #d4edda);\n color: var(--jp-success-color1, #155724);\n border: 1px solid var(--jp-success-color2, #c3e6cb);\n}\n\n.kc-flash-error {\n background: var(--jp-error-color3, #f8d7da);\n color: var(--jp-error-color1, #721c24);\n border: 1px solid var(--jp-error-color2, #f5c6cb);\n}\n\n.kc-flash-close {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 18px;\n line-height: 1;\n color: inherit;\n padding: 0 4px;\n}\n\n/* ------------------------------------------------------------------ */\n/* Create section */\n/* ------------------------------------------------------------------ */\n\n.kc-create-section {\n margin-bottom: 14px;\n padding-bottom: 14px;\n border-bottom: 1px solid var(--jp-border-color1);\n}\n\n.kc-create-form {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n\n/* ------------------------------------------------------------------ */\n/* Shared button / input */\n/* ------------------------------------------------------------------ */\n\n.kc-btn {\n display: inline-flex;\n align-items: center;\n border: 1px solid var(--jp-border-color1);\n background: var(--jp-layout-color1);\n color: var(--jp-ui-font-color1);\n padding: 4px 12px;\n border-radius: 3px;\n cursor: pointer;\n font-size: var(--jp-ui-font-size1);\n white-space: nowrap;\n line-height: 1.5;\n}\n\n.kc-btn:hover {\n background: var(--jp-layout-color2);\n}\n\n.kc-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.kc-btn-primary {\n background: var(--jp-brand-color1);\n color: var(--jp-ui-inverse-font-color1, #fff);\n border-color: var(--jp-brand-color1);\n}\n\n.kc-btn-primary:hover {\n background: var(--jp-brand-color2);\n}\n\n.kc-btn-danger {\n color: var(--jp-error-color1);\n border-color: var(--jp-error-color1);\n}\n\n.kc-btn-danger:hover {\n background: var(--jp-error-color1);\n color: var(--jp-ui-inverse-font-color1, #fff);\n}\n\n.kc-btn-restore {\n color: var(--jp-success-color1);\n border-color: var(--jp-success-color1);\n}\n\n.kc-btn-restore:hover {\n background: var(--jp-success-color1);\n color: var(--jp-ui-inverse-font-color1, #fff);\n}\n\n.kc-btn-xs {\n padding: 2px 8px;\n font-size: var(--jp-ui-font-size0);\n}\n\n.kc-input {\n border: 1px solid var(--jp-border-color1);\n background: var(--jp-layout-color0);\n color: var(--jp-ui-font-color1);\n padding: 4px 8px;\n border-radius: 3px;\n font-size: var(--jp-ui-font-size1);\n flex: 1;\n min-width: 0;\n}\n\n.kc-input:focus {\n outline: none;\n border-color: var(--jp-brand-color1);\n box-shadow: 0 0 0 1px var(--jp-brand-color1);\n}\n\n.kc-input-sm {\n padding: 2px 6px;\n font-size: var(--jp-ui-font-size0);\n}\n\n/* ------------------------------------------------------------------ */\n/* Checkpoint list */\n/* ------------------------------------------------------------------ */\n\n.kc-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.kc-placeholder {\n padding: 24px;\n text-align: center;\n color: var(--jp-ui-font-color2);\n}\n\n.kc-placeholder-error {\n color: var(--jp-error-color1);\n}\n\n/* ------------------------------------------------------------------ */\n/* Single checkpoint item */\n/* ------------------------------------------------------------------ */\n\n.kc-item {\n border: 1px solid var(--jp-border-color1);\n border-radius: 4px;\n padding: 10px 12px;\n background: var(--jp-layout-color0);\n}\n\n.kc-item-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n}\n\n.kc-item-info {\n flex: 1;\n min-width: 0;\n}\n\n.kc-item-name {\n font-weight: 600;\n color: var(--jp-ui-font-color0);\n word-break: break-all;\n}\n\n.kc-item-meta {\n display: flex;\n gap: 10px;\n margin-top: 4px;\n align-items: center;\n}\n\n.kc-item-date {\n color: var(--jp-ui-font-color2);\n font-size: var(--jp-ui-font-size0);\n}\n\n.kc-item-actions {\n display: flex;\n gap: 4px;\n flex-shrink: 0;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-end;\n}\n\n.kc-confirm-label {\n font-size: var(--jp-ui-font-size0);\n font-weight: 600;\n color: var(--jp-ui-font-color1);\n}\n\n/* ------------------------------------------------------------------ */\n/* Phase badge */\n/* ------------------------------------------------------------------ */\n\n.kc-phase {\n display: inline-block;\n padding: 1px 8px;\n border-radius: 10px;\n font-size: var(--jp-ui-font-size0);\n font-weight: 500;\n}\n\n.kc-phase-completed {\n background: var(--jp-success-color3, #d4edda);\n color: var(--jp-success-color1, #155724);\n}\n\n.kc-phase-failed {\n background: var(--jp-error-color3, #f8d7da);\n color: var(--jp-error-color1, #721c24);\n}\n\n.kc-phase-in-progress,\n.kc-phase-running,\n.kc-phase-pending {\n background: var(--jp-warn-color3, #fff3cd);\n color: var(--jp-warn-color1, #856404);\n}\n\n/* ------------------------------------------------------------------ */\n/* Rename form */\n/* ------------------------------------------------------------------ */\n\n.kc-rename-form {\n display: flex;\n gap: 4px;\n align-items: center;\n}\n\n/* ------------------------------------------------------------------ */\n/* Detail pane */\n/* ------------------------------------------------------------------ */\n\n.kc-detail {\n margin-top: 10px;\n padding-top: 10px;\n border-top: 1px solid var(--jp-border-color2);\n font-size: var(--jp-ui-font-size0);\n}\n\n.kc-detail-row {\n display: flex;\n gap: 8px;\n margin-bottom: 4px;\n}\n\n.kc-detail-label {\n font-weight: 600;\n color: var(--jp-ui-font-color1);\n min-width: 110px;\n flex-shrink: 0;\n}\n\n.kc-detail-section {\n margin-top: 8px;\n}\n\n.kc-detail-file {\n display: flex;\n justify-content: space-between;\n padding: 3px 0;\n color: var(--jp-ui-font-color2);\n gap: 12px;\n}\n\n.kc-detail-image-name {\n word-break: break-all;\n}\n\n.kc-detail-time {\n flex-shrink: 0;\n color: var(--jp-ui-font-color2);\n}\n\n/* ------------------------------------------------------------------ */\n/* Footer */\n/* ------------------------------------------------------------------ */\n\n.kc-footer {\n margin-top: 12px;\n padding-top: 12px;\n border-top: 1px solid var(--jp-border-color1);\n display: flex;\n justify-content: flex-end;\n}\n",""]);const i=c},314(n){n.exports=function(n){var r=[];return r.toString=function(){return this.map(function(r){var o="",e=void 0!==r[5];return r[4]&&(o+="@supports (".concat(r[4],") {")),r[2]&&(o+="@media ".concat(r[2]," {")),e&&(o+="@layer".concat(r[5].length>0?" ".concat(r[5]):""," {")),o+=n(r),e&&(o+="}"),r[2]&&(o+="}"),r[4]&&(o+="}"),o}).join("")},r.i=function(n,o,e,t,a){"string"==typeof n&&(n=[[null,n,void 0]]);var c={};if(e)for(var i=0;i<this.length;i++){var p=this[i][0];null!=p&&(c[p]=!0)}for(var l=0;l<n.length;l++){var s=[].concat(n[l]);e&&c[s[0]]||(void 0!==a&&(void 0===s[5]||(s[1]="@layer".concat(s[5].length>0?" ".concat(s[5]):""," {").concat(s[1],"}")),s[5]=a),o&&(s[2]?(s[1]="@media ".concat(s[2]," {").concat(s[1],"}"),s[2]=o):s[2]=o),t&&(s[4]?(s[1]="@supports (".concat(s[4],") {").concat(s[1],"}"),s[4]=t):s[4]="".concat(t)),r.push(s))}},r}},601(n){n.exports=function(n){return n[1]}},72(n){var r=[];function o(n){for(var o=-1,e=0;e<r.length;e++)if(r[e].identifier===n){o=e;break}return o}function e(n,e){for(var a={},c=[],i=0;i<n.length;i++){var p=n[i],l=e.base?p[0]+e.base:p[0],s=a[l]||0,d="".concat(l," ").concat(s);a[l]=s+1;var f=o(d),u={css:p[1],media:p[2],sourceMap:p[3],supports:p[4],layer:p[5]};if(-1!==f)r[f].references++,r[f].updater(u);else{var v=t(u,e);e.byIndex=i,r.splice(i,0,{identifier:d,updater:v,references:1})}c.push(d)}return c}function t(n,r){var o=r.domAPI(r);return o.update(n),function(r){if(r){if(r.css===n.css&&r.media===n.media&&r.sourceMap===n.sourceMap&&r.supports===n.supports&&r.layer===n.layer)return;o.update(n=r)}else o.remove()}}n.exports=function(n,t){var a=e(n=n||[],t=t||{});return function(n){n=n||[];for(var c=0;c<a.length;c++){var i=o(a[c]);r[i].references--}for(var p=e(n,t),l=0;l<a.length;l++){var s=o(a[l]);0===r[s].references&&(r[s].updater(),r.splice(s,1))}a=p}}},659(n){var r={};n.exports=function(n,o){var e=function(n){if(void 0===r[n]){var o=document.querySelector(n);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(n){o=null}r[n]=o}return r[n]}(n);if(!e)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");e.appendChild(o)}},540(n){n.exports=function(n){var r=document.createElement("style");return n.setAttributes(r,n.attributes),n.insert(r,n.options),r}},56(n,r,o){n.exports=function(n){var r=o.nc;r&&n.setAttribute("nonce",r)}},825(n){n.exports=function(n){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var r=n.insertStyleElement(n);return{update:function(o){!function(n,r,o){var e="";o.supports&&(e+="@supports (".concat(o.supports,") {")),o.media&&(e+="@media ".concat(o.media," {"));var t=void 0!==o.layer;t&&(e+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),e+=o.css,t&&(e+="}"),o.media&&(e+="}"),o.supports&&(e+="}");var a=o.sourceMap;a&&"undefined"!=typeof btoa&&(e+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),r.styleTagTransform(e,n,r.options)}(r,n,o)},remove:function(){!function(n){if(null===n.parentNode)return!1;n.parentNode.removeChild(n)}(r)}}}},113(n){n.exports=function(n,r){if(r.styleSheet)r.styleSheet.cssText=n;else{for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(document.createTextNode(n))}}},728(n,r,o){var e=o(72),t=o.n(e),a=o(825),c=o.n(a),i=o(659),p=o.n(i),l=o(56),s=o.n(l),d=o(540),f=o.n(d),u=o(113),v=o.n(u),b=o(475),x={};x.styleTagTransform=v(),x.setAttributes=s(),x.insert=p().bind(null,"head"),x.domAPI=c(),x.insertStyleElement=f(),t()(b.A,x),b.A&&b.A.locals&&b.A.locals}}]);
@@ -0,0 +1 @@
1
+ var _JUPYTERLAB;(()=>{"use strict";var e,r,t,n,o,a,i,u,l,c,f,s,p,d,h,v,b,g,m,y={768(e,r,t){var n={"./index":()=>t.e(397).then(()=>()=>t(397)),"./extension":()=>t.e(397).then(()=>()=>t(397)),"./style":()=>t.e(728).then(()=>()=>t(728))},o=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then(()=>{throw new Error('Module "'+e+'" does not exist in container.')}),t.R=void 0,r),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>o,init:()=>a})}},k={};function w(e){var r=k[e];if(void 0!==r)return r.exports;var t=k[e]={id:e,exports:{}};return y[e](t,t.exports,w),t.exports}w.m=y,w.c=k,w.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return w.d(r,{a:r}),r},w.d=(e,r)=>{for(var t in r)w.o(r,t)&&!w.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},w.f={},w.e=e=>Promise.all(Object.keys(w.f).reduce((r,t)=>(w.f[t](e,r),r),[])),w.u=e=>e+"."+{397:"487e741e4ad2ed6339f5",728:"4bf362e015a01b33d460"}[e]+".js?v="+{397:"487e741e4ad2ed6339f5",728:"4bf362e015a01b33d460"}[e],w.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),w.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="kernel-checkpoint:",w.l=(t,n,o,a)=>{if(e[t])e[t].push(n);else{var i,u;if(void 0!==o)for(var l=document.getElementsByTagName("script"),c=0;c<l.length;c++){var f=l[c];if(f.getAttribute("src")==t||f.getAttribute("data-webpack")==r+o){i=f;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",w.nc&&i.setAttribute("nonce",w.nc),i.setAttribute("data-webpack",r+o),i.src=t),e[t]=[n];var s=(r,n)=>{i.onerror=i.onload=null,clearTimeout(p);var o=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),r)return r(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=s.bind(null,i.onerror),i.onload=s.bind(null,i.onload),u&&document.head.appendChild(i)}},w.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{w.S={};var e={},r={};w.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];w.o(w.S,t)||(w.S[t]={});var a=w.S[t],i="kernel-checkpoint",u=[];return"default"===t&&((e,r,t,n)=>{var o=a[e]=a[e]||{},u=o[r];(!u||!u.loaded&&(1!=!u.eager?n:i>u.from))&&(o[r]={get:()=>w.e(397).then(()=>()=>w(397)),from:i,eager:!1})})("kernel-checkpoint","0.1.1"),e[t]=u.length?Promise.all(u).then(()=>e[t]=1):1}}})(),(()=>{var e;w.g.importScripts&&(e=w.g.location+"");var r=w.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),w.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var o=e[n],a=(typeof o)[0];if(n>=r.length)return"u"==a;var i=r[n],u=(typeof i)[0];if(a!=u)return"o"==a&&"n"==u||"s"==u||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}},o=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,a=1;a<e.length;a++)n--,t+="u"==(typeof(u=e[a]))[0]?"-":(n>0?".":"")+(n=2,u);return t}var i=[];for(a=1;a<e.length;a++){var u=e[a];i.push(0===u?"not("+l()+")":1===u?"("+l()+" || "+l()+")":2===u?i.pop()+" "+i.pop():o(u))}return l();function l(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var n=e[0],o=n<0;o&&(n=-n-1);for(var i=0,u=1,l=!0;;u++,i++){var c,f,s=u<e.length?(typeof e[u])[0]:"";if(i>=r.length||"o"==(f=(typeof(c=r[i]))[0]))return!l||("u"==s?u>n&&!o:""==s!=o);if("u"==f){if(!l||"u"!=s)return!1}else if(l)if(s==f)if(u<=n){if(c!=e[u])return!1}else{if(o?c>e[u]:c<e[u])return!1;c!=e[u]&&(l=!1)}else if("s"!=s&&"n"!=s){if(o||u<=n)return!1;l=!1,u--}else{if(u<=n||f<s!=o)return!1;l=!1}else"s"!=s&&"n"!=s&&(l=!1,u--)}}var p=[],d=p.pop.bind(p);for(i=1;i<e.length;i++){var h=e[i];p.push(1==h?d()|d():2==h?d()&d():h?a(h,r):!d())}return!!d()},i=(e,r)=>e&&w.o(e,r),u=e=>(e.loaded=1,e.get()),l=e=>Object.keys(e).reduce((r,t)=>(e[t].eager&&(r[t]=e[t]),r),{}),c=(e,r,t)=>{var o=t?l(e[r]):e[r];return Object.keys(o).reduce((e,r)=>!e||!o[e].loaded&&n(e,r)?r:e,0)},f=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+o(n)+")",s=e=>{throw new Error(e)},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},d=(e,r,t)=>t?t():((e,r)=>s("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),h=(e=>function(r,t,n,o,a){var i=w.I(r);return i&&i.then&&!n?i.then(e.bind(e,r,w.S[r],t,!1,o,a)):e(r,w.S[r],t,n,o,a)})((e,r,t,n,o,l)=>{if(!i(r,t))return d(e,t,l);var s=c(r,t,n);return a(o,s)||p(f(r,t,s,o)),u(r[t][s])}),v={},b={41:()=>h("default","@jupyterlab/coreutils",!1,[1,6,5,6]),208:()=>h("default","@jupyterlab/notebook",!1,[1,4,5,6]),345:()=>h("default","react",!1,[1,18,2,0]),498:()=>h("default","@jupyterlab/services",!1,[1,7,5,6]),778:()=>h("default","@jupyterlab/apputils",!1,[1,4,6,6])},g={397:[41,208,345,498,778]},m={},w.f.consumes=(e,r)=>{w.o(g,e)&&g[e].forEach(e=>{if(w.o(v,e))return r.push(v[e]);if(!m[e]){var t=r=>{v[e]=0,w.m[e]=t=>{delete w.c[e],t.exports=r()}};m[e]=!0;var n=r=>{delete v[e],w.m[e]=t=>{throw delete w.c[e],r}};try{var o=b[e]();o.then?r.push(v[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}})},(()=>{var e={223:0};w.f.j=(r,t)=>{var n=w.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((t,o)=>n=e[r]=[t,o]);t.push(n[2]=o);var a=w.p+w.u(r),i=new Error;w.l(a,t=>{if(w.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,i,u]=t,l=0;if(a.some(r=>0!==e[r])){for(n in i)w.o(i,n)&&(w.m[n]=i[n]);u&&u(w)}for(r&&r(t);l<a.length;l++)o=a[l],w.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=self.webpackChunkkernel_checkpoint=self.webpackChunkkernel_checkpoint||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),w.nc=void 0;var S=w(768);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["kernel-checkpoint"]=S})();
@@ -0,0 +1,4 @@
1
+ /* This is a generated file of CSS imports */
2
+ /* It was generated by @jupyterlab/builder in Build.ensureAssets() */
3
+
4
+ import 'kernel-checkpoint/style/index.js';
@@ -0,0 +1,16 @@
1
+ {
2
+ "packages": [
3
+ {
4
+ "name": "css-loader",
5
+ "versionInfo": "6.11.0",
6
+ "licenseId": "MIT",
7
+ "extractedText": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
8
+ },
9
+ {
10
+ "name": "style-loader",
11
+ "versionInfo": "3.3.4",
12
+ "licenseId": "MIT",
13
+ "extractedText": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: kernel_checkpoint
3
+ Version: 0.1.1
4
+ Summary: An extension for saving and restoring kernel pod state with jupyter enterprise gateway
5
+ Project-URL: Homepage, https://github.com/lehuannhatrang/kernel-checkpoint-extension.git
6
+ Project-URL: Bug Tracker, https://github.com/lehuannhatrang/kernel-checkpoint-extension.git/issues
7
+ Project-URL: Repository, https://github.com/lehuannhatrang/kernel-checkpoint-extension.git.git
8
+ Author-email: Leehun <lehuannhatrang98@gmail.com>
9
+ License: BSD 3-Clause License
10
+
11
+ Copyright (c) 2026, Leehun
12
+ All rights reserved.
13
+
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted provided that the following conditions are met:
16
+
17
+ 1. Redistributions of source code must retain the above copyright notice, this
18
+ list of conditions and the following disclaimer.
19
+
20
+ 2. Redistributions in binary form must reproduce the above copyright notice,
21
+ this list of conditions and the following disclaimer in the documentation
22
+ and/or other materials provided with the distribution.
23
+
24
+ 3. Neither the name of the copyright holder nor the names of its
25
+ contributors may be used to endorse or promote products derived from
26
+ this software without specific prior written permission.
27
+
28
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
32
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
34
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ License-File: LICENSE
39
+ Keywords: jupyter,jupyterlab,jupyterlab-extension
40
+ Classifier: Framework :: Jupyter
41
+ Classifier: Framework :: Jupyter :: JupyterLab
42
+ Classifier: Framework :: Jupyter :: JupyterLab :: 4
43
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
44
+ Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
45
+ Classifier: License :: OSI Approved :: BSD License
46
+ Classifier: Programming Language :: Python
47
+ Classifier: Programming Language :: Python :: 3
48
+ Classifier: Programming Language :: Python :: 3.10
49
+ Classifier: Programming Language :: Python :: 3.11
50
+ Classifier: Programming Language :: Python :: 3.12
51
+ Classifier: Programming Language :: Python :: 3.13
52
+ Classifier: Programming Language :: Python :: 3.14
53
+ Requires-Python: >=3.10
54
+ Requires-Dist: jupyter-server>=2.0.0
55
+ Description-Content-Type: text/markdown
56
+
57
+ # kernel_checkpoint
58
+
59
+ [![Github Actions Status](https://github.com/lehuannhatrang/kernel-checkpoint-extension.git/workflows/Build/badge.svg)](https://github.com/lehuannhatrang/kernel-checkpoint-extension.git/actions/workflows/build.yml)
60
+
61
+ An extension for saving and restoring kernel pod state with jupyter enterprise gateway
62
+
63
+ ## Requirements
64
+
65
+ - JupyterLab >= 4.0.0
66
+
67
+ ## Install
68
+
69
+ To install the extension, execute:
70
+
71
+ ```bash
72
+ pip install kernel_checkpoint
73
+ ```
74
+
75
+ ## Uninstall
76
+
77
+ To remove the extension, execute:
78
+
79
+ ```bash
80
+ pip uninstall kernel_checkpoint
81
+ ```
82
+
83
+ ## Contributing
84
+
85
+ ### Development install
86
+
87
+ Note: You will need NodeJS to build the extension package.
88
+
89
+ The `jlpm` command is JupyterLab's pinned version of
90
+ [yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
91
+ `yarn` or `npm` in lieu of `jlpm` below.
92
+
93
+ ```bash
94
+ # Clone the repo to your local environment
95
+ # Change directory to the kernel_checkpoint directory
96
+
97
+ # Set up a virtual environment and install package in development mode
98
+ python -m venv .venv
99
+ source .venv/bin/activate
100
+ pip install --editable "."
101
+
102
+ # Link your development version of the extension with JupyterLab
103
+ jupyter labextension develop . --overwrite
104
+
105
+ # Rebuild extension Typescript source after making changes
106
+ # IMPORTANT: Unlike the steps above which are performed only once, do this step
107
+ # every time you make a change.
108
+ jlpm build
109
+ ```
110
+
111
+ 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.
112
+
113
+ ```bash
114
+ # Watch the source directory in one terminal, automatically rebuilding when needed
115
+ jlpm watch
116
+ # Run JupyterLab in another terminal
117
+ jupyter lab
118
+ ```
119
+
120
+ 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).
121
+
122
+ 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:
123
+
124
+ ```bash
125
+ jupyter lab build --minimize=False
126
+ ```
127
+
128
+ ### Development uninstall
129
+
130
+ ```bash
131
+ pip uninstall kernel_checkpoint
132
+ ```
133
+
134
+ In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
135
+ command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
136
+ folder is located. Then you can remove the symlink named `kernel-checkpoint` within that folder.
137
+
138
+ ### Testing the extension
139
+
140
+ #### Frontend tests
141
+
142
+ This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
143
+
144
+ To execute them, execute:
145
+
146
+ ```sh
147
+ jlpm
148
+ jlpm test
149
+ ```
150
+
151
+ #### Integration tests
152
+
153
+ This extension uses [Playwright](https://playwright.dev/docs/intro) for the integration tests (aka user level tests).
154
+ More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
155
+
156
+ More information are provided within the [ui-tests](./ui-tests/README.md) README.
157
+
158
+ ### Packaging the extension
159
+
160
+ See [RELEASE](RELEASE.md)
@@ -0,0 +1,16 @@
1
+ kernel_checkpoint/Untitled.ipynb,sha256=dyiIPf_ax2wciCKODDYsYXstNSpCn-VWd9MIpNt6Ys0,617
2
+ kernel_checkpoint/__init__.py,sha256=J4elJAC27312W5xSIhMExkVZftnyK0ZCCLbGbFEo8Zg,600
3
+ kernel_checkpoint/_version.py,sha256=lFB9nR4WN0iXcp5UpfmTfw1Z2jWBDmClLEWF046NHmc,171
4
+ kernel_checkpoint/handlers.py,sha256=j120bvS5JcSYfuyO06l5ft1ABBMkyekqCJ3OONvoScc,5370
5
+ kernel_checkpoint-0.1.1.data/data/etc/jupyter/jupyter_server_config.d/kernel_checkpoint.json,sha256=sUoy8lfXmTRO7VZTsqof2sCI5pXsr6L99LIrIfCBsSA,110
6
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/package.json,sha256=PB0RAWpseCgdgQbJQ6o_HBkP0XJQArLVuiYnjpk7LXw,6234
7
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/static/397.487e741e4ad2ed6339f5.js,sha256=SH50HkrS7WM59ZlRFWID8JpnYPaj2SX7QRI6sCcJIZs,10828
8
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/static/728.4bf362e015a01b33d460.js,sha256=S_Ni4BWgGzPUYIeBZry7nTl7XR3Kl-PA-Uvj9PijFVE,11783
9
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/static/remoteEntry.d4b802a14146b6757b67.js,sha256=1LgCoUFGtnV7Z_QAdmhePcCVR52IrDc80alWpQIoOMA,6811
10
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/static/style.js,sha256=_in-t47zXwXWp7zD9MdBrbsVMuWMlqOAqVHHV_unb_Y,160
11
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/static/third-party-licenses.json,sha256=W6N2sSD7tQihMqQk64F9xMd1Flfr2KO97esAiHUOYdM,2453
12
+ kernel_checkpoint-0.1.1.data/data/share/jupyter/labextensions/kernel-checkpoint/install.json,sha256=WO7IqUANt2duIcWExsWyC8rdDkNwTj-JHhFshfTasBI,195
13
+ kernel_checkpoint-0.1.1.dist-info/METADATA,sha256=mwhUmcGsDHBDsXAYPEVm1BIKp3lzKh3sKqcjzvcLMNg,6336
14
+ kernel_checkpoint-0.1.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
+ kernel_checkpoint-0.1.1.dist-info/licenses/LICENSE,sha256=lv8-3CCKBjd29YGkBAgVA_wVtbgZrFO0ynKnTPzePfQ,1514
16
+ kernel_checkpoint-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Leehun
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.