any equivalent for Julia?
ArcticSnow opened this issue · 11 comments
Hi,
I was wondering if you'd know an equivalent extension to write .jl (julia) file directly from the Jupyterlab editor? If not, is there a possibility to add support for Julia file from this extension?
Thanks
Not that I know of.
But it should be possible to create a similar extension to this one to create Julia files. Or a more generic one to create any type of files.
Hi @jtpio !
So I forked your project and made an attempt to adapt the code to create .jl files instead of .py. I get an error message during the npm run build. Would you have a look at my modification and edits if needed? This is my first time messing with code for a Jupyterlab extension.
https://github.com/ArcticSnow/jupyterlab-julia-file
Thanks
That's awesome @ArcticSnow !
The code looks good. Would you mind posting the error you get from npm run build?
Usually it's good practice to create a new conda environment locally for development:
conda create -n jupyterlab-python-file -c conda-forge jupyterlab nodejs
conda activate jupyterlab-python-file
npm install
npm run build
jupyter labextension install .
Ok, I tried as you indicated creating a conda VE and run npm, though npm still returns the following error.
~/github/jupyterlab-julia-file$ npm install
> jupyterlab-julia-file@0.3.0 prepare /home/arcticsnow/github/jupyterlab-julia-file
> npm run clean && npm run build
> jupyterlab-julia-file@0.3.0 clean /home/arcticsnow/github/jupyterlab-julia-file
> rimraf lib
> jupyterlab-julia-file@0.3.0 build /home/arcticsnow/github/jupyterlab-julia-file
> tsc
node_modules/@jupyterlab/ui-components/lib/icon/iconregistry.d.ts:1:8 - error TS1259: Module '"/home/arcticsnow/github/jupyterlab-julia-file/node_modules/@types/react/index"' can only be default-imported using the 'esModuleInterop' flag
1 import React from 'react';
~~~~~
node_modules/@types/react/index.d.ts:55:1
55 export = React;
~~~~~~~~~~~~~~~
This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
node_modules/@jupyterlab/ui-components/lib/icon/interfaces.d.ts:3:8 - error TS1259: Module '"/home/arcticsnow/github/jupyterlab-julia-file/node_modules/@types/react/index"' can only be default-imported using the 'esModuleInterop' flag
3 import React from 'react';
~~~~~
Wow, good catch.
There must have been a new version of the ui-components package that breaks compatibility with the previous tsconfig.
What if you apply the following change to tsconfig.json? (I'll push the same to this repo)
diff --git a/tsconfig.json b/tsconfig.json
index 4946663..3227f68 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"declaration": true,
+ "esModuleInterop": true,
"lib": ["es2015", "dom"],
"module": "commonjs",
"moduleResolution": "node",Wow thanks for the guidance, everything works now!!!
I'll update the readme and media (logos) and then I'll have to figure out how to make the extension available to others :)
Nice!
To make it available to others, the easiest would be to publish it to npm.
There is a section about this in the JupyterLab documentation: https://jupyterlab.readthedocs.io/en/latest/developer/extension_tutorial.html#publish-your-extension-to-npmjs-org
Well it is now published on npm following their tutorial.
To install it:
jupyter labextension install @arcticsnow/jupyterlab-julia-fileI simply miss the Julia icon. But most importantly it works as wanted. :)
many thanks!
Well done!
You might want to have a look at this example to add an icon to the launcher: https://github.com/jtpio/jupyterlab-extension-examples/tree/master/launcher
The same repo contains more examples on various other topics related to JupyterLab extension development, in case you are interested.
Closing as answered.
Would you like to open a PR to add a link to your extension in a new "Related Projects" section in the README file?