vscode-pyolite icon indicating copy to clipboard operation
vscode-pyolite copied to clipboard

Reusing upstream packages?

Open jtpio opened this issue 4 years ago • 2 comments

At the moment it looks like some types and interfaces are vendored in the repo:

https://github.com/joyceerhl/vscode-pyolite/tree/main/src/web/kernel

This is just a quick heads up that @jupyterlite packages are now published to npm. For example: https://www.npmjs.com/package/@jupyterlite/kernel

These are still alpha and things can change quickly. But they might already make it easier to reuse the types and interfaces without having to vendor them.

Also there are plans to extract the pyolite kernel from the main repo in https://github.com/jupyterlite/jupyterlite/issues/386. So maybe this would also help reuse pyolite outside of the default JupyterLite interfaces (lab / retro) more easily!

jtpio avatar Oct 18 '21 17:10 jtpio

Thanks for filing this @jtpio! I was very excited to see that @jupyterlite/pyolite-kernel was published a couple weeks ago, but found that because VS Code web extensions run in a web worker, I wasn't able to use the pyolite-kernel npm module OOB. I'd love to help move the pyolite kernel into a separate repo and also add support for loading it in a worker context, if that is something of interest to you and the JupyterLite team?

joyceerhl avatar Oct 19 '21 04:10 joyceerhl

Right ideally @jupyterlite/pyolite-kernel could be reused as-is. It is also running in a Web Worker in JupyterLite:

https://github.com/jupyterlite/jupyterlite/blob/52944e9cd21785291d0975a63f6723038efa9525/packages/pyolite-kernel/src/kernel.ts#L60

But maybe there needs to be a couple more changes so that it can more easily used in VS Code? And that vscode.Uri.joinPath(context.extensionUri, 'pyodide.js') can be passed in the initialization options like here?

https://github.com/joyceerhl/vscode-pyolite/blob/b2d0a7e5035770cfeea2b8faf940a4abc9a80eca/src/web/kernel/pyoliteKernel.ts#L26

Probably the main benefit of moving the kernel outside of the main jupyterlite repo would be that it can distributed as a Python package with its own assets. Which might make it easier to use elsewhere, especially with the shims: https://github.com/jupyterlite/jupyterlite/tree/main/packages/pyolite-kernel/py

jtpio avatar Oct 19 '21 08:10 jtpio