gennaker-tools 0.1.5__tar.gz → 0.1.6__tar.gz
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.
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/CHANGELOG.md +20 -2
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/PKG-INFO +2 -1
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/_version.py +1 -1
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/package.json +2 -2
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/schemas/gennaker-tools/package.json.orig +1 -1
- gennaker_tools-0.1.5/gennaker_tools/labextension/static/remoteEntry.7cf8ef915feb12b1787a.js → gennaker_tools-0.1.6/gennaker_tools/labextension/static/remoteEntry.04166b7a8076ac5dc693.js +1 -1
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/settings_sync_extension.py +82 -30
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/package.json +1 -1
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/pyproject.toml +2 -1
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/.copier-answers.yml +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/.gitignore +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/.prettierignore +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/.yarnrc.yml +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/LICENSE +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/README.md +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/RELEASE.md +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/flake.lock +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/flake.nix +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/__init__.py +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/schemas/gennaker-tools/stateless-run.json +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/static/509.4ba7e0c1be6d39a3ec07.js +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/static/728.c3ac4b62173ea8b3c44b.js +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/static/747.28975bdde163d0eaf6e0.js +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/static/style.js +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/gennaker_tools/labextension/static/third-party-licenses.json +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/install.json +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/jupyter-config/jupyter_server_config.d/gennaker_tools.json +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/renovate.json5 +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/schema/stateless-run.json +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/setup.py +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/src/index.ts +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/style/base.css +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/style/index.css +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/style/index.js +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/tsconfig.json +0 -0
- {gennaker_tools-0.1.5 → gennaker_tools-0.1.6}/yarn.lock +0 -0
|
@@ -2,12 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- <START NEW CHANGELOG ENTRY> -->
|
|
4
4
|
|
|
5
|
-
## 0.1.
|
|
5
|
+
## 0.1.6
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
([Full Changelog](https://github.com/agoose77/gennaker-tools/compare/v0.1.5...0403a7b883afedf5634d7446c88a8bc1b3a9d842))
|
|
8
|
+
|
|
9
|
+
### Bugs fixed
|
|
10
|
+
|
|
11
|
+
- fix: handle round-trip and null [#17](https://github.com/agoose77/gennaker-tools/pull/17) ([@agoose77](https://github.com/agoose77))
|
|
12
|
+
|
|
13
|
+
### Other merged PRs
|
|
14
|
+
|
|
15
|
+
- Fix: perform initial reconciliation [#16](https://github.com/agoose77/gennaker-tools/pull/16) ([@agoose77](https://github.com/agoose77))
|
|
16
|
+
|
|
17
|
+
### Contributors to this release
|
|
18
|
+
|
|
19
|
+
([GitHub contributors page for this release](https://github.com/agoose77/gennaker-tools/graphs/contributors?from=2026-01-11&to=2026-01-11&type=c))
|
|
20
|
+
|
|
21
|
+
[@agoose77](https://github.com/search?q=repo%3Aagoose77%2Fgennaker-tools+involves%3Aagoose77+updated%3A2026-01-11..2026-01-11&type=Issues)
|
|
8
22
|
|
|
9
23
|
<!-- <END NEW CHANGELOG ENTRY> -->
|
|
10
24
|
|
|
25
|
+
## 0.1.5
|
|
26
|
+
|
|
27
|
+
No merged PRs
|
|
28
|
+
|
|
11
29
|
## 0.1.4
|
|
12
30
|
|
|
13
31
|
([Full Changelog](https://github.com/agoose77/gennaker-tools/compare/v0.1.3...795450402276c565914c01971d096d93afac9662))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gennaker-tools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.6
|
|
4
4
|
Summary: A JupyterLab extension to provide a restart-and-run-to-selected command variant that clears non-executed cell outputs.
|
|
5
5
|
Project-URL: Homepage, https://github.com/agoose77/gennaker-tools
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/agoose77/gennaker-tools/issues
|
|
@@ -52,6 +52,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
52
52
|
Classifier: Programming Language :: Python :: 3.13
|
|
53
53
|
Requires-Python: >=3.9
|
|
54
54
|
Requires-Dist: aiofiles
|
|
55
|
+
Requires-Dist: json5
|
|
55
56
|
Requires-Dist: tomli
|
|
56
57
|
Requires-Dist: tomli-w
|
|
57
58
|
Requires-Dist: watchfiles
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gennaker-tools",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A JupyterLab extension to provide a restart-and-run-to-selected command variant that clears non-executed cell outputs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"outputDir": "gennaker_tools/labextension",
|
|
100
100
|
"schemaDir": "schema",
|
|
101
101
|
"_build": {
|
|
102
|
-
"load": "static/remoteEntry.
|
|
102
|
+
"load": "static/remoteEntry.04166b7a8076ac5dc693.js",
|
|
103
103
|
"extension": "./extension",
|
|
104
104
|
"style": "./style"
|
|
105
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _JUPYTERLAB;(()=>{"use strict";var e,r,t,o,n,a,i,u,l,s,f,d,c,p,h,v,g,b,m,y,w,k,S,j={842:(e,r,t)=>{var o={"./index":()=>t.e(509).then(()=>()=>t(509)),"./extension":()=>t.e(509).then(()=>()=>t(509)),"./style":()=>t.e(728).then(()=>()=>t(728))},n=(e,r)=>(t.R=r,r=t.o(o,e)?o[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 o="default",n=t.S[o];if(n&&n!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[o]=e,t.I(o,r)}};t.d(r,{get:()=>n,init:()=>a})}},E={};function P(e){var r=E[e];if(void 0!==r)return r.exports;var t=E[e]={id:e,exports:{}};return j[e](t,t.exports,P),t.exports}P.m=j,P.c=E,P.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return P.d(r,{a:r}),r},P.d=(e,r)=>{for(var t in r)P.o(r,t)&&!P.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},P.f={},P.e=e=>Promise.all(Object.keys(P.f).reduce((r,t)=>(P.f[t](e,r),r),[])),P.u=e=>e+"."+{509:"4ba7e0c1be6d39a3ec07",728:"c3ac4b62173ea8b3c44b",747:"28975bdde163d0eaf6e0"}[e]+".js?v="+{509:"4ba7e0c1be6d39a3ec07",728:"c3ac4b62173ea8b3c44b",747:"28975bdde163d0eaf6e0"}[e],P.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),P.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="gennaker-tools:",P.l=(t,o,n,a)=>{if(e[t])e[t].push(o);else{var i,u;if(void 0!==n)for(var l=document.getElementsByTagName("script"),s=0;s<l.length;s++){var f=l[s];if(f.getAttribute("src")==t||f.getAttribute("data-webpack")==r+n){i=f;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",P.nc&&i.setAttribute("nonce",P.nc),i.setAttribute("data-webpack",r+n),i.src=t),e[t]=[o];var d=(r,o)=>{i.onerror=i.onload=null,clearTimeout(c);var n=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(e=>e(o)),r)return r(o)},c=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},P.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{P.S={};var e={},r={};P.I=(t,o)=>{o||(o=[]);var n=r[t];if(n||(n=r[t]={}),!(o.indexOf(n)>=0)){if(o.push(n),e[t])return e[t];P.o(P.S,t)||(P.S[t]={});var a=P.S[t],i="gennaker-tools",u=(e,r,t,o)=>{var n=a[e]=a[e]||{},u=n[r];(!u||!u.loaded&&(!o!=!u.eager?o:i>u.from))&&(n[r]={get:t,from:i,eager:!!o})},l=[];return"default"===t&&(u("@codemirror/autocomplete","6.19.1",()=>Promise.all([P.e(747),P.e(949)]).then(()=>()=>P(747))),u("gennaker-tools","0.1.
|
|
1
|
+
var _JUPYTERLAB;(()=>{"use strict";var e,r,t,o,n,a,i,u,l,s,f,d,c,p,h,v,g,b,m,y,w,k,S,j={842:(e,r,t)=>{var o={"./index":()=>t.e(509).then(()=>()=>t(509)),"./extension":()=>t.e(509).then(()=>()=>t(509)),"./style":()=>t.e(728).then(()=>()=>t(728))},n=(e,r)=>(t.R=r,r=t.o(o,e)?o[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 o="default",n=t.S[o];if(n&&n!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[o]=e,t.I(o,r)}};t.d(r,{get:()=>n,init:()=>a})}},E={};function P(e){var r=E[e];if(void 0!==r)return r.exports;var t=E[e]={id:e,exports:{}};return j[e](t,t.exports,P),t.exports}P.m=j,P.c=E,P.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return P.d(r,{a:r}),r},P.d=(e,r)=>{for(var t in r)P.o(r,t)&&!P.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},P.f={},P.e=e=>Promise.all(Object.keys(P.f).reduce((r,t)=>(P.f[t](e,r),r),[])),P.u=e=>e+"."+{509:"4ba7e0c1be6d39a3ec07",728:"c3ac4b62173ea8b3c44b",747:"28975bdde163d0eaf6e0"}[e]+".js?v="+{509:"4ba7e0c1be6d39a3ec07",728:"c3ac4b62173ea8b3c44b",747:"28975bdde163d0eaf6e0"}[e],P.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),P.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="gennaker-tools:",P.l=(t,o,n,a)=>{if(e[t])e[t].push(o);else{var i,u;if(void 0!==n)for(var l=document.getElementsByTagName("script"),s=0;s<l.length;s++){var f=l[s];if(f.getAttribute("src")==t||f.getAttribute("data-webpack")==r+n){i=f;break}}i||(u=!0,(i=document.createElement("script")).charset="utf-8",P.nc&&i.setAttribute("nonce",P.nc),i.setAttribute("data-webpack",r+n),i.src=t),e[t]=[o];var d=(r,o)=>{i.onerror=i.onload=null,clearTimeout(c);var n=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),n&&n.forEach(e=>e(o)),r)return r(o)},c=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),u&&document.head.appendChild(i)}},P.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{P.S={};var e={},r={};P.I=(t,o)=>{o||(o=[]);var n=r[t];if(n||(n=r[t]={}),!(o.indexOf(n)>=0)){if(o.push(n),e[t])return e[t];P.o(P.S,t)||(P.S[t]={});var a=P.S[t],i="gennaker-tools",u=(e,r,t,o)=>{var n=a[e]=a[e]||{},u=n[r];(!u||!u.loaded&&(!o!=!u.eager?o:i>u.from))&&(n[r]={get:t,from:i,eager:!!o})},l=[];return"default"===t&&(u("@codemirror/autocomplete","6.19.1",()=>Promise.all([P.e(747),P.e(949)]).then(()=>()=>P(747))),u("gennaker-tools","0.1.6",()=>P.e(509).then(()=>()=>P(509)))),e[t]=l.length?Promise.all(l).then(()=>e[t]=1):1}}})(),(()=>{var e;P.g.importScripts&&(e=P.g.location+"");var r=P.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 o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),P.p=e})(),t=e=>{var r=e=>e.split(".").map(e=>+e==e?+e:e),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),o=t[1]?r(t[1]):[];return t[2]&&(o.length++,o.push.apply(o,r(t[2]))),t[3]&&(o.push([]),o.push.apply(o,r(t[3]))),o},o=(e,r)=>{e=t(e),r=t(r);for(var o=0;;){if(o>=e.length)return o<r.length&&"u"!=(typeof r[o])[0];var n=e[o],a=(typeof n)[0];if(o>=r.length)return"u"==a;var i=r[o],u=(typeof i)[0];if(a!=u)return"o"==a&&"n"==u||"s"==u||"u"==a;if("o"!=a&&"u"!=a&&n!=i)return n<i;o++}},n=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 o=1,a=1;a<e.length;a++)o--,t+="u"==(typeof(u=e[a]))[0]?"-":(o>0?".":"")+(o=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():n(u))}return l();function l(){return i.pop().replace(/^\((.+)\)$/,"$1")}},a=(e,r)=>{if(0 in e){r=t(r);var o=e[0],n=o<0;n&&(o=-o-1);for(var i=0,u=1,l=!0;;u++,i++){var s,f,d=u<e.length?(typeof e[u])[0]:"";if(i>=r.length||"o"==(f=(typeof(s=r[i]))[0]))return!l||("u"==d?u>o&&!n:""==d!=n);if("u"==f){if(!l||"u"!=d)return!1}else if(l)if(d==f)if(u<=o){if(s!=e[u])return!1}else{if(n?s>e[u]:s<e[u])return!1;s!=e[u]&&(l=!1)}else if("s"!=d&&"n"!=d){if(n||u<=o)return!1;l=!1,u--}else{if(u<=o||f<d!=n)return!1;l=!1}else"s"!=d&&"n"!=d&&(l=!1,u--)}}var c=[],p=c.pop.bind(c);for(i=1;i<e.length;i++){var h=e[i];c.push(1==h?p()|p():2==h?p()&p():h?a(h,r):!p())}return!!p()},i=(e,r)=>e&&P.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),{}),s=(e,r,t,n)=>{var i=n?l(e[r]):e[r];return(r=Object.keys(i).reduce((e,r)=>!a(t,r)||e&&!o(e,r)?e:r,0))&&i[r]},f=(e,r,t)=>{var n=t?l(e[r]):e[r];return Object.keys(n).reduce((e,r)=>!e||!n[e].loaded&&o(e,r)?r:e,0)},d=(e,r,t,o)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+n(o)+")",c=(e,r,t,o,a)=>{var i=e[t];return"No satisfying version ("+n(o)+")"+(a?" for eager consumption":"")+" of shared module "+t+" found in shared scope "+r+".\nAvailable versions: "+Object.keys(i).map(e=>e+" from "+i[e].from).join(", ")},p=e=>{throw new Error(e)},h=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},g=(e,r,t)=>t?t():((e,r)=>p("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),b=(v=e=>function(r,t,o,n,a){var i=P.I(r);return i&&i.then&&!o?i.then(e.bind(e,r,P.S[r],t,!1,n,a)):e(r,P.S[r],t,o,n,a)})((e,r,t,o,n,a)=>{if(!i(r,t))return g(e,t,a);var l=s(r,t,n,o);return l?u(l):a?a():void p(c(r,e,t,n,o))}),m=v((e,r,t,o,n,l)=>{if(!i(r,t))return g(e,t,l);var s=f(r,t,o);return a(n,s)||h(d(r,t,s,n)),u(r[t][s])}),y={},w={389:()=>m("default","@jupyterlab/notebook",!1,[1,4,5,1]),460:()=>m("default","@jupyterlab/codemirror",!1,[1,4,5,1]),505:()=>b("default","@codemirror/autocomplete",!1,[1,6,0,1],()=>Promise.all([P.e(747),P.e(949)]).then(()=>()=>P(747))),591:()=>m("default","@jupyterlab/translation",!1,[1,4,5,1]),827:()=>m("default","@jupyterlab/apputils",!1,[1,4,6,1]),24:()=>m("default","@codemirror/view",!1,[1,6,9,6]),84:()=>m("default","@codemirror/language",!1,[1,6,0,0]),195:()=>m("default","@codemirror/state",!1,[1,6,2,0])},k={509:[389,460,505,591,827],949:[24,84,195]},S={},P.f.consumes=(e,r)=>{P.o(k,e)&&k[e].forEach(e=>{if(P.o(y,e))return r.push(y[e]);if(!S[e]){var t=r=>{y[e]=0,P.m[e]=t=>{delete P.c[e],t.exports=r()}};S[e]=!0;var o=r=>{delete y[e],P.m[e]=t=>{throw delete P.c[e],r}};try{var n=w[e]();n.then?r.push(y[e]=n.then(t).catch(o)):t(n)}catch(e){o(e)}}})},(()=>{var e={204:0};P.f.j=(r,t)=>{var o=P.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else if(949!=r){var n=new Promise((t,n)=>o=e[r]=[t,n]);t.push(o[2]=n);var a=P.p+P.u(r),i=new Error;P.l(a,t=>{if(P.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var n=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+n+": "+a+")",i.name="ChunkLoadError",i.type=n,i.request=a,o[1](i)}},"chunk-"+r,r)}else e[r]=0};var r=(r,t)=>{var o,n,[a,i,u]=t,l=0;if(a.some(r=>0!==e[r])){for(o in i)P.o(i,o)&&(P.m[o]=i[o]);u&&u(P)}for(r&&r(t);l<a.length;l++)n=a[l],P.o(e,n)&&e[n]&&e[n][0](),e[n]=0},t=self.webpackChunkgennaker_tools=self.webpackChunkgennaker_tools||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),P.nc=void 0;var T=P(842);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["gennaker-tools"]=T})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
from jupyter_server.extension.application import ExtensionApp
|
|
2
2
|
import jupyterlab.commands
|
|
3
3
|
|
|
4
|
-
from traitlets import Instance, default, validate, TraitError
|
|
4
|
+
from traitlets import Instance, default, validate, TraitError, Unicode
|
|
5
5
|
import pathlib
|
|
6
6
|
import watchfiles
|
|
7
7
|
import jupyter_server.serverapp
|
|
8
8
|
import asyncio
|
|
9
|
+
import aiofiles.os
|
|
9
10
|
import tomli
|
|
10
|
-
import
|
|
11
|
+
import json5
|
|
11
12
|
import tomli_w
|
|
12
|
-
import re
|
|
13
13
|
import os
|
|
14
14
|
|
|
15
15
|
|
|
@@ -18,6 +18,7 @@ class SettingsSyncApp(ExtensionApp):
|
|
|
18
18
|
name = "settings-sync"
|
|
19
19
|
load_other_extensions = True
|
|
20
20
|
settings_path = Instance(pathlib.Path)
|
|
21
|
+
null_sentinel = Unicode("__NULL__")
|
|
21
22
|
|
|
22
23
|
_task = Instance(asyncio.Task, allow_none=True)
|
|
23
24
|
_event = Instance(asyncio.Event, allow_none=True)
|
|
@@ -34,6 +35,26 @@ class SettingsSyncApp(ExtensionApp):
|
|
|
34
35
|
raise TraitError("settings_path should be a valid pathlike value")
|
|
35
36
|
return _path
|
|
36
37
|
|
|
38
|
+
def _json_mapping_to_toml(self, mapping):
|
|
39
|
+
return {
|
|
40
|
+
key: self._json_mapping_to_toml(value)
|
|
41
|
+
if isinstance(value, dict)
|
|
42
|
+
else self.null_sentinel
|
|
43
|
+
if value is None
|
|
44
|
+
else value
|
|
45
|
+
for key, value in mapping.items()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
def _toml_mapping_to_json(self, mapping):
|
|
49
|
+
return {
|
|
50
|
+
key: self._toml_mapping_to_json(value)
|
|
51
|
+
if isinstance(value, dict)
|
|
52
|
+
else None
|
|
53
|
+
if value == self.null_sentinel
|
|
54
|
+
else value
|
|
55
|
+
for key, value in mapping.items()
|
|
56
|
+
}
|
|
57
|
+
|
|
37
58
|
def _toml_to_settings_path(self, path: pathlib.Path) -> pathlib.Path:
|
|
38
59
|
return path.with_name(path.stem)
|
|
39
60
|
|
|
@@ -46,48 +67,78 @@ class SettingsSyncApp(ExtensionApp):
|
|
|
46
67
|
def _is_toml_path(self, path: pathlib.Path) -> bool:
|
|
47
68
|
return path.suffix == ".toml"
|
|
48
69
|
|
|
49
|
-
def _strip_comments(self, source: str) -> str:
|
|
50
|
-
without_single_line_comments = re.sub(r"//.*$", "", source, flags=re.MULTILINE)
|
|
51
|
-
|
|
52
|
-
return re.sub(
|
|
53
|
-
r"/\*[\s\S]*?\*/", "", without_single_line_comments, flags=re.MULTILINE
|
|
54
|
-
)
|
|
55
|
-
|
|
56
70
|
async def _watched_files_need_sync(
|
|
57
71
|
self, path: pathlib.Path, other_path: pathlib.Path
|
|
58
72
|
) -> bool:
|
|
59
|
-
return
|
|
73
|
+
return not (
|
|
74
|
+
path.exists()
|
|
75
|
+
and other_path.exists()
|
|
76
|
+
and path.stat().st_mtime == other_path.stat().st_mtime
|
|
77
|
+
)
|
|
60
78
|
|
|
61
79
|
async def _sync_watched_files(self, path: pathlib.Path, other_path: pathlib.Path):
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
try:
|
|
81
|
+
if self._is_settings_path(path):
|
|
82
|
+
self.log.debug(f"Synchronising JSON to TOML for {path}")
|
|
83
|
+
settings = self._json_mapping_to_toml(json5.loads(path.read_text()))
|
|
84
|
+
with open(other_path, "wb") as f:
|
|
85
|
+
tomli_w.dump(settings, f)
|
|
86
|
+
|
|
87
|
+
else:
|
|
88
|
+
self.log.debug(f"Synchronising TOML to JSON for {path}")
|
|
89
|
+
with open(path, "rb") as f:
|
|
90
|
+
settings = self._toml_mapping_to_json(tomli.load(f))
|
|
91
|
+
with open(other_path, "w") as sf:
|
|
92
|
+
json5.dump(settings, sf, indent=2)
|
|
93
|
+
|
|
94
|
+
# Sync mtimes
|
|
95
|
+
stat = path.stat()
|
|
96
|
+
os.utime(other_path, (stat.st_atime, stat.st_mtime))
|
|
97
|
+
|
|
98
|
+
except Exception as exc:
|
|
99
|
+
self.log.error(f"Error reconciling {path} with {other_path} {exc}")
|
|
77
100
|
|
|
78
101
|
async def _unsync_watched_files(self, path: pathlib.Path, other_path: pathlib.Path):
|
|
79
102
|
if self._is_settings_path(path) and other_path.exists():
|
|
80
103
|
other_path.unlink()
|
|
81
104
|
|
|
105
|
+
async def _reconcile_initial(self, root_path):
|
|
106
|
+
"""
|
|
107
|
+
Reconcile existing files. No files will be deleted.
|
|
108
|
+
"""
|
|
109
|
+
tasks = []
|
|
110
|
+
|
|
111
|
+
async def reconcile(path):
|
|
112
|
+
for entry in await aiofiles.os.scandir(path):
|
|
113
|
+
entry_path = pathlib.Path(entry.path)
|
|
114
|
+
|
|
115
|
+
if entry.is_dir():
|
|
116
|
+
await reconcile(entry_path)
|
|
117
|
+
elif (
|
|
118
|
+
is_settings_path := self._is_settings_path(entry_path)
|
|
119
|
+
) or self._is_toml_path(entry_path):
|
|
120
|
+
other_path = (
|
|
121
|
+
self._settings_to_toml_path(entry_path)
|
|
122
|
+
if is_settings_path
|
|
123
|
+
else self._toml_to_settings_path(entry_path)
|
|
124
|
+
)
|
|
125
|
+
# Reconcile onto the "other" file if it doesn't exist, or it's older than us
|
|
126
|
+
if (
|
|
127
|
+
not other_path.exists()
|
|
128
|
+
or other_path.stat().st_mtime <= entry.stat().st_mtime
|
|
129
|
+
):
|
|
130
|
+
tasks.append(self._sync_watched_files(entry_path, other_path))
|
|
131
|
+
|
|
132
|
+
await reconcile(root_path)
|
|
133
|
+
await asyncio.gather(*tasks)
|
|
134
|
+
|
|
82
135
|
async def _event_loop(self):
|
|
136
|
+
await self._reconcile_initial(self.settings_path)
|
|
83
137
|
async for changes in watchfiles.awatch(
|
|
84
138
|
self.settings_path, stop_event=self._event
|
|
85
139
|
):
|
|
86
140
|
for change, _path in changes:
|
|
87
|
-
|
|
88
|
-
await self._reconcile_change(change, pathlib.Path(_path))
|
|
89
|
-
except Exception as exc:
|
|
90
|
-
self.log.error(exc)
|
|
141
|
+
await self._reconcile_change(change, pathlib.Path(_path))
|
|
91
142
|
|
|
92
143
|
async def _reconcile_change(self, change, path):
|
|
93
144
|
# Ignore .~ files
|
|
@@ -106,6 +157,7 @@ class SettingsSyncApp(ExtensionApp):
|
|
|
106
157
|
else self._settings_to_toml_path(path)
|
|
107
158
|
)
|
|
108
159
|
|
|
160
|
+
self.log.info(f"Detected change {change} in {path} file, synchronising")
|
|
109
161
|
# Now we have either TOML or JSON setting files
|
|
110
162
|
# File needs deleting
|
|
111
163
|
if change == watchfiles.Change.deleted:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|