-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A Jupyter kernel for SoS #136
Comments
Try this
Type
magic
etc should also be usable. Finally, download the file as It should work, but standard output from |
I cannot find "new sos" on the jupyter page though. I selected new python3 and load_ext sos_magic, but none of it from the "Interactive SoS" tutorial worked on the jupyter notebook (they do work on ipython). There must be some settings I messed up. I purged earlier today my ipython and reinstalled it along with jupyter ... will have to see what's going on. But yes I'm starting to use ipython for debugging which is pretty handy indeed. Can we make the IPython / Jupyter related features available only via a switch in |
I have fixed the issue with ipython installation. Basically the sos kernel will be installed only if ipython is available. ipython and sos kernel are two different, though related things.
|
Thanks for the clarification. So I see one is an extension like some lisp extension to Emacs that interacts with the main program to provide something handy. I take that SoS kernel and Jupyter kernel for SoS means the same here and by deriving ipykernel you are basically building an interactive interpreter for SoS as a language, as of ipython to Python! Looks like I should stick to the Jupyter kernel not the sos_magic for ipython, though. I guess sos_magic was a successful experiment that led to the SoS kernel implementation. This is wonderful! I hope I can get Jupyter interpreting SoS. Somehow it does not work on my office computer for now. Will try again tomorrow. |
The latest version should work. If you run
to verify. Then if you start
you should see a
Right now syntax highlighting does not work and I am not sure why, of course customize output would be a long process. |
I see ... i used your tips to verify and confirmed the failure. I then raised the error message from setup.py:
which is weird because my jupyter is in my conda. I'll google and see if there is a way to fix this because I don't want to mess with system Python. |
I suppose you can simply put your conda path before /usr/local/bin. On Thu, May 5, 2016 at 11:13 PM, gaow notifications@github.com wrote:
|
That's the setup now:
I'm googling. ... |
No idea how to write a codemirrow mode for SoS, and how to install it with jupyter... Here is the ticket jupyter/help#35 (comment) The Jupyter guy was really helpful so I now have a more or less working lexer. A complete lexer is much harder to get and I would wait till we have some javascript expert before we tackle it. |
Documented at https://github.com/BoPeng/SOS/wiki/Interactive-SoS , we should perhaps separate it into two documents later. |
I was just reading this blog post: http://www.r-bloggers.com/why-i-dont-like-jupyter-fka-ipython-notebook/ A lot of them were also the reason I did not use jupyter for real. I think several points he mentioned there can be addressed by repeatedly exporting to sos format and reloading it. This procedure keeps the notebook neat. So far I do have one comment though: do you think it is good idea to re-number the cell block ID during export. In exploratory analysis the block ID can go discontinuous due to changes to codes. In the converted SoS I think it looks better if we can sort then re-assign the ID's starting from 1 to N. |
I agree with all the points of the post and this is why I have been switching between several methods. The notebook format is good at saving and previewing results, not for creating coherent flow of analysis. Before we can create our own Rstudio, this is the best platform I can find to achieve these... I suppose we can advertise the notebook feature as the notebook stage of SoS where we run the analysis interactively, preview and save result, before we convert the notebook to real workflows. |
To answer your question, the index is not that useful for interactive use so the current implementation tries to keep the information as much as possible so that the exported |
I agree. It was just a bit bothering when I tried to export to sos and push to git repo for version control purposes. The change log is always longer due to these nuisance comment numbering. |
Well I still think we should reorder and rename those code block names. Here is a minimal example why this is necessary. This is a script I get from
Notice that cell code 6 precedes cell code 5 because I went back to edit cell 4 which uses variable from cell 5 and it worked; only that the cell is renamed to 6. This is one of the bad things about Jupyter that blog post discussed. Now, if I use So the point here is that Jupyter does not even care about cell numbering when it reruns. That perhaps suggests we should not care either and we should thus re-order and re-number in the exported SoS script so that it will convert to usable SoS notebook |
Are you suggesting that we reorder the cells according to execution number, namely saving your code as
Do you also want to reset the indexes to
if there are no 2 and 3 because of rerun? This might not be what users want though because I might have a sequence of steps in the order of workflow but execute some of the steps back and forth. Anyway, there is also a possibility to do a more thorough conversion, that removes |
Yes I think ordering is at least necessary; otherwise the notebook will not be usable when converted back. Resetting index to continuous numbers will not do any harm but will make the output neater, so we may as well do that.
Right ... I can imaging for example one wants to make a plot and later wants to adjust the coloring etc. By doing that he'll reset the cell number from python notebook, and if we reset it for him in the exported SoS, then the script will still work except the plot will not show in the original position. There does not seem to exist a happy solution unless we use a complicated way to manage. I guess we should just ask users to behave. SoS makes Jupyter a lot better to the extend that I'm willing to use it now over emacs + ess (I do not use RStudio). But this is only because the notebook allows mixture of language (I'd still prefer ESS over R notebook). Hopefully Jupyter will keep improving. I'll yet have to explore and exploit more |
Suggest some syntax then, perhaps
There can also be
which is a shortcut to convert generated |
Good idea! We'll then have more controls over the outcome. I think it is very helpful to properly convert between sos and ipynb. That eliminates a lot of shortcomings pointed out in that post. |
It is easy to implement. I will submit a scratch patch and leave the rest On Wed, May 25, 2016 at 7:35 PM, gaow notifications@github.com wrote:
|
Great! Would be happy to take over if you could submit a draft patch. I'd like to use these features so I'll do it later this evening after you submit it. Good luck with your deadline! I too have some but I'm stuck ... hopefully these exploratory analysis with sos notebook will shed some lights to it :) |
Just submitted, the patch should be easy to follow with possible bugs/typos. You of course do not have to implement all the options, just the ones that you need now. The |
Encouraged by the success of sos_magic ipython extension, I think we can go further and implement a Jypyter kernel for SoS. This will allow much easier writing of SoS scripts because the notebook can be ru in place and saved in .sos format.
The Jupyter webpage has all the needed information and plenty of examples.
The text was updated successfully, but these errors were encountered: