jupytext ignores lines starting with %
See original GitHub issueI am using jupytext --to ipynb *.Rmd
or jupytext --to Rmd *.ipynb
to keep the pairs of Rmd and ipynb files in sync. This works nicely if I add code in either document and use the jupytext calls to copy these to the other file type.
However, it does not work if that line of code starts with either %
or # %
, as in %autosave 0
or # %autosave 0
. Such lines of code are simply not transferred between the formats. As a result, since we only edit the ipynb file and make code review of the .Rmd file, such code edits go unnoticed.
Could you please make jupytext stop ignoring such code changes?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Frequently Asked Questions - Jupytext documentation
Yes! When you're done, reload the notebook in Jupyter. There, you will see the updated input cells combined with the matching output cells...
Read more >Python Ignore lines in file that start with - Stack Overflow
Within my python script I open a file for reading, and want to process certain lines. I want to ignore lines that start...
Read more >jupytext - PyPI
On the command line. jupytext converts Jupyter notebooks to their text representation, and back. ... We start with a Jupyter notebook.
Read more >Jupyter notebooks as Markdown documents or Python scripts
ipynb file) itself. Why would you want to use Jupytext? There are several good reasons to consider using Jupytext. First, you may be...
Read more >Creating an open-source book with Jupyter Book and Jupytext
Links:https://github.com/giswqs/cookiecutter-jupyter-bookhttps://geemap.org/workshops/GeoPython_2021/https://book.geemap.org/https://giswqs.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @tordbb , thanks for asking.
It is expected that Jupytext comments out magic commands (by default, because they don’t make sense in a
.Rmd
document), but it should not remove any line when changing from one format to the other. If you have a reproducible example I would like very much to have a look.Now, you can change that behavior with the
comment_magics
option (jupytext --opt comment_magics=False
).You can also change that for a single line with e.g.
I found the source of the error, so I managed to fix it 😃 Thanks for your help!