Open nthiery opened 2 weeks ago
Hi @nthiery!
On thebe-lite
it it listed as a "peer" dependency, which means thebe-core
is essentially declaring which version it is expecting / compatible with but will expect that to be installed by a peer package / independently. This is used to stop multiple version of a package being added by related packages.
Bringing in the requirejs types npm install --save @types/requirejs
may resolve the immediate error but using thebe-core
inside a jupyter lab process wasn't something it was set up for, you might run into additional issues after this. let's see :)
I'm curious about your end objective @nthiery - what will your extension do?
Thanks @stevejpurves for the quick feecback!
No luck alas (unless it was wrong to use jlpm instead of npm):
> jlpm add @types/requirejs ... > jlpm build node_modules/@types/node/globals.d.ts:96:9 - error TS2403: Subsequent variable declarations must have the same type. Variable 'require' must be of type 'Require', but here has type 'NodeRequire'. 96 var require: NodeRequire; ~~~~~~~ node_modules/@types/requirejs/index.d.ts:395:13 395 declare var require: Require; ~~~~~~~ 'require' was also declared here. node_modules/@types/node/module.d.ts:296:14 - error TS2300: Duplicate identifier 'Module'. 296 export = Module; ~~~~~~ node_modules/@types/requirejs/index.d.ts:33:14 33 export = mod; ~~~ 'Module' was also declared here. node_modules/@types/node/vm.d.ts:40:14 - error TS2305: Module '"node:module"' has no exported member 'ImportAttributes'. 40 import { ImportAttributes } from "node:module"; ~~~~~~~~~~~~~~~~ node_modules/@types/requirejs/index.d.ts:33:14 - error TS2300: Duplicate identifier 'Module'. 33 export = mod; ~~~ node_modules/@types/node/module.d.ts:296:14 296 export = Module; ~~~~~~ 'Module' was also declared here. Found 4 errors in 4 files. Errors Files 1 node_modules/@types/node/globals.d.ts:96 1 node_modules/@types/node/module.d.ts:296 1 node_modules/@types/node/vm.d.ts:40 1 node_modules/@types/requirejs/index.d.ts:33
We are building a jupyterlab widget that renders notebooks with a bespoke execution / rendering model, to be used in an application for repetitive exercises with randomization. To implement that, we want to have fine control on how cell inputs and outputs are rendered and interact with the kernel.
thebe-core and in particular things like PassiveCellRenderer
seem like a very good starting point to not reimplement things from lower level JupyterLab tools.
In case you'd have time for debugging together, I am available all day (French time) for a visio).
@nthiery I realize that you are looking for a place to start without re-inventing the wheel 👍🏼 but trying to pull in thebe-core
might be counter productive and introduce an awkward cross dependency (e.g. your jupyterlab extension is built for jlab 4.E while thebe is on 4.1.2) that could make maintenance harder.
The PassiveCellRenderer
is a great example to follow but I would be tempted not to use it directly but just to create instances of the RenderMime
, OutputArea
and OutputModel
in
the same way as it does and work from there. https://github.com/jupyter-book/thebe/blob/6d825e46c7c4ef68c2baf470ba7d3962190e4372/packages/core/src/passive.ts#L12
That means you'll be using and dependent upon the right versions of the jupyter apis without thebe
's packaging getting in the way.
Hi @stevejpurves,
Thanks a lot for the insight!
I am trying to use thebe-core in a JupyterLab extension. To this end, I used:
However, in subsequent builds of my extension, I get these errors:
Any suggestions?
The thebe-lite error was easy to fix by forcing
jlpm add thebe-lite
, though I would have expected this to be automatic with the dependency on thebe-lite written in thebe-core/.../package.json.For information: I tried installing from a local clone of the development version of thebe by doing
jlpm add /opt/thebe/packages/core
; but I probably did that wrong since I get:I have tried various things like cleaning up the cache, redoing a fresh install, ... However I am beginner in Javascript development and may well have screwed stupid things ... sorry :-)
Help appreciated!