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

jupytext --to notebook call from a paired script fails with InconsistentPath #806

Closed
MPKonst opened this issue Jun 18, 2021 · 2 comments · Fixed by #813
Closed

jupytext --to notebook call from a paired script fails with InconsistentPath #806

MPKonst opened this issue Jun 18, 2021 · 2 comments · Fixed by #813
Milestone

Comments

@MPKonst
Copy link

MPKonst commented Jun 18, 2021

First of all, thank you for creating and maintaining jupytext! I have been using it for quite some time and it has been incredibly useful. However, it seems like the changes introduced in 1.11.2 in response to #765 have broken some of my automated jupytexting scripts. The minimal setup to reproduce the problem seems to be the following:

  1. With a directory structure
nb
├── scripts
└── test.ipynb

where scripts is a subdirectory and test.ipynb is some notebook
2. Run jupytext --set-formats "ipynb,scripts//py:percent" test.ipynb to create a paired script test.py in the scripts subdirectory.
3. Delete the notebook test.ipynb to simulate just having pulled test.py.
4. Try to recreate the notebook from the script: jupytext --to notebook --output test.ipynb ./scripts/test.py
Result: the notebook is correctly created but the call still fails with:

[jupytext] Reading ./scripts/test.py in format py
[jupytext] Writing test.ipynb
Traceback (most recent call last):
  File "/usr/local/bin/jupytext", line 8, in <module>
    sys.exit(jupytext())
  File "/usr/local/lib/python3.7/site-packages/jupytext/cli.py", line 427, in jupytext
    exit_code += jupytext_single_file(nb_file, args, log)
  File "/usr/local/lib/python3.7/site-packages/jupytext/cli.py", line 826, in jupytext_single_file
    for alt_path, _ in paired_paths(nb_file, fmt, formats)
  File "/usr/local/lib/python3.7/site-packages/jupytext/paired_paths.py", line 248, in paired_paths
    short_form_multiple_formats(formats),
jupytext.paired_paths.InconsistentPath: Paired paths './scripts/test.ipynb','./scripts/scripts/test.py' do not include the current notebook path './scripts/test.py'. Current format is 'py:percent', and paired formats are 'ipynb,scripts//py:percent'.
@MPKonst MPKonst changed the title juptext --to notebook call from a paired script fails with InconsistentPath jupytext --to notebook call from a paired script fails with InconsistentPath Jun 18, 2021
@mwouts
Copy link
Owner

mwouts commented Jun 20, 2021

Thank you @MPKonst for reporting this!
Sorry for the regression - I'll size the opportunity to add one more test and make sure we get our use case covered.

@mwouts mwouts added this to the 1.11.4 milestone Jun 20, 2021
@DancingQuanta
Copy link

I have the same issue. I have started using 1.11.3 from 1.9.1 when I wanted to use --use-source-timestamp in my project.
I tried this following command with --output and this still fails.

jupytext --output notebooks/02-00-probe-temperature.ipynb markdown/02-00-probe-temperature.md
[jupytext] Reading markdown/02-00-probe-temperature.md in format md
[jupytext] Writing notebooks/02-00-probe-temperature.ipynb (destination file replaced [use --update to preserve cell outputs and ids])
Traceback (most recent call last):
  File "C:\tools\Anaconda3\envs\sthm\Scripts\jupytext-script.py", line 9, in <module>
    sys.exit(jupytext())
  File "C:\tools\Anaconda3\envs\sthm\lib\site-packages\jupytext\cli.py", line 434, in jupytext
    exit_code += jupytext_single_file(nb_file, args, log)
  File "C:\tools\Anaconda3\envs\sthm\lib\site-packages\jupytext\cli.py", line 846, in jupytext_single_file
    for alt_path, _ in paired_paths(nb_file, fmt, formats)
  File "C:\tools\Anaconda3\envs\sthm\lib\site-packages\jupytext\paired_paths.py", line 248, in paired_paths
    short_form_multiple_formats(formats),
jupytext.paired_paths.InconsistentPath: Paired paths 'markdown/markdown/02-00-probe-temperature.md','markdown/notebooks/02-00-probe-temperature.ipynb','markdown/scripts/02-00-probe-temperature.py' do not include the current notebook path 'markdown/02-00-probe-temperature.md'. Current format is 'md', and paired formats are 'markdown//md,notebooks//ipynb,scripts//py:percent'.

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

Successfully merging a pull request may close this issue.

3 participants