ines / juniper

🍇 Edit and execute code snippets in the browser using Jupyter kernels
https://ines.github.io/juniper/
MIT License
224 stars 38 forks source link

specify kernel name when starting new kernel #4

Closed amn41 closed 5 years ago

amn41 commented 5 years ago

Closes #3 (at least insofar as I experienced this issue).

Steps to reproduce:

Create a juniper object:

   <pre data-executable>echo "hello"</pre>
   <script src="juniper.min.js"></script>
   <script>
     new Juniper({ repo: 'amn41/bash_plus_kernel/', branch: 'master', kernelType: 'bash', language: 'shell' })
   </script>

Attempting to run this will result in a SytaxError because the kernel is python3 by virtue of the default kernel name. Applying this patch fixes the issue & the command executes correctly.

I re-used the this.kernelType option rather than introducing a new 'name' option because as far as I can tell they are equivalent. Though there could be edge cases where these differ I'm just not aware of them.

ines commented 5 years ago

@amn41 Thanks, looks good! 👍 And yes, I think I just didn't realise the kernel type had to be passed into startNew as well (because it just quietly defaulted to Python).

I'll merge this and try to get another release up on npm and not procrastinate on this. (No idea what it is, but I really hate JS/Node/npm packaging and publishing 😫 I tried to get a package juniper-react building but it just wouldn't work, so I gave up.)