-
Notifications
You must be signed in to change notification settings - Fork 394
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
jupytext --sync comments out a line of my code #339
Comments
Hello @aarchiba , thank you for reporting this! That's very interesting. What happens here is that Jupytext classifies that line as a The regular expression used for this is here: Lines 21 to 25 in 3d8c5e8
In the future I will make sure to provide a fix for your example. Meanwhile, what do you think of using another name for your variable? |
I think this code was written by someone else and so I really can't guarantee people won't choose variable names like Bash code won't work in my notebook anyway. Why treat it specially? Surely if someone has administered the hack that lets them use bash code without the ! it's their job to make sure that's visible to jupytext? |
Sure. I think we will be able to fix the regexp to make sure that If you are confident that your users don't use magic commands, or if you don't need to run the
|
Also: the |
Well, I routinely use Since what we actually need is just a format that won't lead to endless git merge conflicts, and I intend users to interact with the notebooks purely through jupyter-lab, it sounds like (R?) markdown would be a good answer. This behaviour is still an unpleasant surprise! I'm also puzzled why it doesn't fail the --test-strict, or even happen there, even though using --sync it plainly does not round-trip correctly - leaving the python code entirely aside, the Jupyter notebook has a code cell converted to a markdown cell. It seems like this would be a problem even (especially!) if I were using the secretly-a-bash-command magic? |
Well, the text would be unchanged. That can be a problem if you require your
Markdown is probably a good answer. In R Markdown, the python code is meant to be executed with
Sure, that deserves a separate investigation, I will have a look. |
Code cell was transformed to a markdown cell in py format #339
Code cell was transformed to a markdown cell in py format #339
Rather than on its notebook representation (#339)
Rather than on its notebook representation (#339)
@aarchiba , thank you again for raising that subject. Here is what I found:
Now I have prepared a release candidate with all the corresponding fixes. Can you give it a try and let me know if it solves the issue you reported? It's available on pypi:
|
Well, when I try to run it with --test-strict both ways I get unhelpful tracebacks:
and
But if I use |
Oh, I see... the |
I have a notebook that I want to sync between ipynb and py:percent formats. Every time I do --sync, one of the cells gets turned from code into markdown.
When I do explicit conversions forward and back with --test-strict, both pass, and the cell does not get converted. But when I do --sync, I get:
and the line is commented out. I have deleted the ipynb file and used --to and --test-strict to recreate it, so there should be nothing in there that is not in the .py file. This also occurs with py:light.
Example of parameter usage.zip
The text was updated successfully, but these errors were encountered: