Skip to content
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

Global pairing configuration is not effective in versions v0.7.* #95

Closed
matthew-brett opened this issue Oct 9, 2018 · 6 comments
Closed

Comments

@matthew-brett
Copy link
Contributor

First - thanks very much for writing this - it's very very useful - it really changes the usability of Notebooks for writing anything more substantial than a quick demo.

Having said that, I'm running into almost constant trouble with pairing.

I have put this into ~/.jupyter/jupyter_notebook_config.py:

c.NotebookApp.contents_manager_class = "jupytext.TextFileContentsManager"
c.ContentsManager.default_jupytext_formats = "ipynb,Rmd"

With that setting, I am expecting that, whenever I save a Notebook from Jupyter, I will get a paired .Rmd file, and whenever I open and save an .Rmd file from Jupyter, I will get the matching .ipynb file. Is that expectation correct? Because, more often than not, I get neither effect, and I have to run jupytext --to manually to get the conversion.

Am I doing something wrong? What could I do, to debug?

@mwouts
Copy link
Owner

mwouts commented Oct 9, 2018

Hello @matthew-brett , thanks, I'm glad to know that the tool is helpful. Thanks also for reporting. Your expectation is completely correct: you should get the two forms of the notebook whenever you open a 'ipynb' or a 'Rmd' document in Jupyter, and save.

We will troubleshoot this. To start with, may I ask if you see any 'jupytext_formats' metadata in the notebook? (that one has a higher priority than the content's manager one)

@matthew-brett
Copy link
Contributor Author

Aha - yes - in one of the notebooks I'm working on, this appeared, somehow:

 "jupytext_formats": "Rmd:rmarkdown",

@mwouts
Copy link
Owner

mwouts commented Oct 9, 2018

That's a good start! From the explicit format name I guess you are using a very recent version of jupytext. With the introduction of the multiple script formats (light and percent) I had to include them explicitly in that field, but I see now that this has the effect of creating a jupytext_formats entry in your notebook when there is none, and that causes the issue you experience.

I will add a new unit test to make sure this does not happen in the next release. Meanwhile, as the c.ContentsManager.default_jupytext_formats is not effective, I suggest that you change the "jupytext_formats": "Rmd:rmarkdown", entry to "jupytext_formats": "ipynb,Rmd" for every notebook.

@matthew-brett
Copy link
Contributor Author

Thanks - that's a relief to know that I wasn't suffering from the effects of an unpredictable gap in space-time ...

@mwouts mwouts changed the title Pairing seems very fragile Global pairing configuration is not effective in versions v0.7.* Oct 9, 2018
mwouts added a commit that referenced this issue Oct 9, 2018
Format is not appended to 'formats' when extension is not present there #93  #95
Format name and extension in 'text_representation' section
mwouts added a commit that referenced this issue Oct 9, 2018
mwouts added a commit that referenced this issue Oct 10, 2018
@mwouts mwouts mentioned this issue Oct 10, 2018
mwouts added a commit that referenced this issue Oct 10, 2018
Format is not appended to 'formats' when extension is not present there #93  #95
Format name and extension in 'text_representation' section
mwouts added a commit that referenced this issue Oct 10, 2018
mwouts added a commit that referenced this issue Oct 10, 2018
@mwouts
Copy link
Owner

mwouts commented Oct 10, 2018

@matthew-brett , I expect that the new release (v0.8.0) will fix this. Please reopen if this is not the case! Also, I saw your nb2plots project, you must be familiar with the sphinx gallery format, aren't you? Please let me know if you want to recommend improvements on jupytext's implementation of that format.

@mwouts mwouts closed this as completed Oct 10, 2018
@matthew-brett
Copy link
Contributor Author

Actually, the nb2plots thing is a competitor to sphinx-gallery if anything. It does a one-way write of a notebook into ReST, putting code cells into sphinx directives, so the stuff is easier to edit, and then rebuilds the notebooks for download, at page build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants