pprzetacznik / IElixir

Jupyter's kernel for Elixir programming language
Apache License 2.0
357 stars 44 forks source link

Add Elixir syntax highlight support #37

Closed cprieto closed 6 years ago

cprieto commented 6 years ago
coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 61.486% when pulling 03ebb8be4163b6a286ad09603bd62c5f2a8134b6 on cprieto:master into 31d33645e59fa3c6073440b7650261f8878665f6 on pprzetacznik:master.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.3%) to 61.149% when pulling fe62c92f733853a1db251d222754ad08a4019e2f on cprieto:master into 31d33645e59fa3c6073440b7650261f8878665f6 on pprzetacznik:master.

coveralls commented 6 years ago

Coverage Status

Coverage decreased (-0.3%) to 61.149% when pulling fe62c92f733853a1db251d222754ad08a4019e2f on cprieto:master into 31d33645e59fa3c6073440b7650261f8878665f6 on pprzetacznik:master.

pprzetacznik commented 6 years ago

@cprieto Thanks a lot for your input. I've used your idea and modified slightly what you did by putting this inside separated function. I believe this is the code available here: https://github.com/ianwalter/codemirror-mode-elixir/blob/master/index.js. I've also preserved the notification about authors and copyrights of this project and added the link to the github project.

Let me know if you did some changes in that code.

For the record, I need to look at how to create nbextensions for jupyter lab because nbextensions probably let creating more modular plugins where separation of modules is preserved.

cprieto commented 6 years ago

First, thanks for taking a look at my code, I had been using the code for a while now in my Docker image for learning Elixir, super!

Now, I did modifications to the code, mostly because there were no support for some keywords and the indent of end looks to be broken in the original code, I cleaned it a little as well and I see you compacted the code, thanks!

I thought about using nbextensions, in fact, I did some experiments with it, but I had been following the idea of custom highlighting in Jupyter for a while (I helped with the OCaml kernel for jupyter as well with the syntax highlighting) and it looks like the best way to ship a custom codemirror (or modify an existing codemirror style, as the guys from Haskell, Julia and FSharp do, AFAIK) is in the kernel.js (there are a few reasons for it, drop me a message if you want to discuss more).

Again, thanks!

BTW, the Docker image generated by that dockerfile is extremely huge, as comparisson mine is just 408MB, I can share if you want to.

pprzetacznik commented 6 years ago

Thanks once again for your commitment.

That would be great if you could share your dockerfile. I'm sorry that images I've created are so huge (around 1,5GB). This is mainly caused because this is not based on alpine. My docker image is based on custom jupyter docker images (base on debian) and elixir images. If you have some custom requirements the image can be much smaller but you'll lose some packages or you can lose support from Jupyter team if you won't use their configs so your image can easily get out of date.

That would be great if you can show us your approach. That can be useful for everyone who would like to create such image in the future.

cprieto commented 6 years ago

Sure, I use Alpine, the official Docker image from Jupyter is really huge mostly because they add support for a lot of packages you don't need most of the time, and in that case, it is easier to create a custom image just for that, for example, I have a custom image for doing data analysis, another for image analysis, etc... After all, it is Docker, the idea is having small images doing their job, it is easier to spin up a container than having to install everything in one just in case you need it later.

If you use Openblas or FFI or massive calculations, you can add the required packages and it will take just a few more megabytes, never gigabytes, I think the bigger Docker image I have (you can check in docker hub under cprieto) is maybe 980MB and it is my multipurpose Python 3 image.

Feel free to share, I understand the Jupyter support but maybe somebody else needs a smaller image somewhere (like me, for learning Elixir, for example).

https://github.com/cprieto/jupyter-images/blob/master/elixir/Dockerfile

pprzetacznik commented 6 years ago

This is one pretty decent dockerfile. I'll link to your code in README.md for others.

cprieto commented 6 years ago

Oh thanks! I try my best.

I updated the dockerfile so it uses IElixir (not my fork), there are still a few other issues with the codemirror syntax highlighting, I will take a look as soon as I have some time this week.

Cheers!