jupytext icon indicating copy to clipboard operation
jupytext copied to clipboard

Pairing in subfolders at different levels

Open mjkanji opened this issue 11 months ago • 0 comments

I'd like to achieve a file structure as shown below, where the script is at the root of a folder and the notebook is one directory below:

.
├── hello.py
└── notebooks
    └── hello.ipynb

I'm setting the following in my pyproject.toml:

[tool.jupytext]
formats = {"notebooks/" = "ipynb", "./" = "py:percent"}

However, while jupytext --sync notebooks/hello.ipynb works as expected, jupytext --sync hello.py returns the following error:

[jupytext] Reading hello.py in format py
[jupytext] Warning: hello.py is not a paired notebook

Changing the config such that

[tool.jupytext]
formats = {"notebooks/" = "ipynb", "scripts/" = "py:percent"}

allows me to use jupytext --sync scripts/hello.py without any issue, so I'm assuming that running --sync on the script, instead of the notebook, is a valid workflow (correct me if I'm wrong here).

I assume this indicates some bug in how the paths are parsed/created using the config.

mjkanji avatar Aug 16 '23 01:08 mjkanji