tslab icon indicating copy to clipboard operation
tslab copied to clipboard

Support Deepnote env

Open jakubzitny opened this issue 3 years ago • 2 comments

Hi @yunabe, we're trying to get this kernel up and running in Deepnote. The basics seem to be working well, but we have two remaining problems:

  1. Same as #48, tslab can't seem to be able to find installed dependencies (locally, globally, or via NODE_PATH). We falled back to require with absolute paths for now.
  2. Some installed dependencies are not importable if they use exports.
/work/node_modules/@amcharts/amcharts4/core.js:8
export { System, system } from "./.internal/core/System";
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:355:18)
    at wrapSafe (node:internal/modules/cjs/loader:1022:15)
    at Module._compile (node:internal/modules/cjs/loader:1056:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.apply (/opt/nvm/versions/node/v15.14.0/lib/node_modules/tslab/dist/executor.js:63:24)
    at evalmachine.<anonymous>:22:30

Feel free to check out or clone my project. If we make this work, using Deepnote, instead of binder for README and examples could be a bit faster.

jakubzitny avatar Apr 16 '21 12:04 jakubzitny

  1. Same as #48, tslab can't seem to be able to find installed dependencies

Did you install tslab locally? I basically recommend you to install tslab globally (Reference) though I think it should work even if it's installed locally.

Could you share commands you used to install tslab? Also, it's great if you can share the result of jupyter kernelspec list and kernel.json in the directories listed by kernelspec.

  1. Some installed dependencies are not importable if they use exports.

Do you mean the library is importable in the normal TypeScript project but tslab failed to import it? Probably, tslab's TypeScript configuration (source] does not work well with the library.

Could you share the library and the tsconfig.json which works with the library?

yunabe avatar Apr 19 '21 14:04 yunabe

Hey @yunabe,

In the deepnote project tslab is globally installed via the local docker file. As jakub mentioned, tslab works well, so could be compatibility between tslab and AmCharts4? This is their tsconfig.js.

Here is some additional info you requested:

jupyter kernelspec list

  python3    /shared-libs/python3.9/py-core/share/jupyter/kernels/python3
  jslab      /usr/local/share/jupyter/kernels/jslab
  tslab      /usr/local/share/jupyter/kernels/tslab

kernel.json

{"argv": ["tslab", "kernel", "--config-path", "{connection_file}"], "display_name": "TypeScript", "language": "typescript"}

Checkout sample project on deepnote here. Feel free to duplicate if you get the chance to have a look.

danielstpaul avatar Apr 23 '21 18:04 danielstpaul