-
Notifications
You must be signed in to change notification settings - Fork 386
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
Optional arguments in R magic are lost in translation #111
Comments
Hello @capelastegui , thanks for reporting! It's nice to know that people do actually mix languages within a single notebook - I like this. Sure, I agree with your report, the arguments for language magics are (currently) lost in the round trip conversion. We will fix this. May I ask you if you could share a simple and short notebook with an example? You could either
|
@capelastegui , I have integrated your sample notebook ! Now conversion of magic
I have not tested the conversion to R scripts (your notebook is classified among the python notebooks, due to its python kernel...). Please let me know if there is an issue there. The new release candidate should not create any more the
|
Just installed the latest RC and tried it with an old notebook with the My use cases just deal with notebook conversion to python, so I can't speak about any errors that might come up when converting to the R format. I may try that in the near future, though - I'll let you know how that goes. Many thanks for the quick fix, and for this great tool - it's making my work on jupyter so much easier. |
Thanks @capelastegui for the feedback! |
I'm having this exact issue with jupytext 0.8.6. It seems to be specific to the |
Hello @stefanuddenberg , thanks for letting us know. Do you think you could provide a minimal reproducible example, i.e. a short notebook with just one cell, that shows the problem? I would be interested in seeing both the notebook, and the problematic text representation. You can either email me the two files, or prepare a pull request on branch 1.0.0 with the notebook added into the folder |
Or even simpler: just quote here the content of one cell showing the issue, plus its text representation... Thanks. |
Setup:
Original problematic cell in .ipynb (arguments get stripped here on reloading notebook):
Cell as output in the
Cell as output to library("ggplot2")
ggplot(data = df) + geom_point(aes(x = X, y = Y, color = Letter, size = Z)) |
Thanks @stefanuddenberg, you have provided all I need to reproduce this. Just out of curiosity: are you exporting to both the percent and md formats at the same time? Also, have you tried the |
@stefanuddenberg , I have added your notebook to the test suite at 75f9011. The test pass as expected for the So my understanding is that you issue is caused by using |
Starting from version 1.1.0, metadata are also accepted in the markdown representation of notebooks. This should solve this issue. |
When using cell magics in my jupyter notebook, I have noticed that optional arguments sometimes are lost when translating to .py files. This happens with the R magic, and may also be an issue with other language-related magics.
Normal magics with arguments work fine:
This gets converted to
However, the %%R magic is handled differently, and the parameter is lost:
This gets converted to
Note the missing parameter.
I have run a quick test on jupytext.magics, and that seems to be working as intended - the problem appears because the %%R magic is handled elsewhere:
I'm using jupytext 0.8.3, jupyter 1.0.0, python 2.7.11
The text was updated successfully, but these errors were encountered: