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

Pair ipynb with files in subfolders one level down #1144

Closed
hectormz opened this issue Oct 19, 2023 · 4 comments · Fixed by #1238
Closed

Pair ipynb with files in subfolders one level down #1144

hectormz opened this issue Oct 19, 2023 · 4 comments · Fixed by #1238

Comments

@hectormz
Copy link
Contributor

I would like to pair .ipynb files with .py files according to this structure:

.
├── jupytext.toml
├── Alpha/
│   ├── notebooks_py/
│   │   └── notebook.py
│   └── notebook.ipynb
├── Beta/
│   ├── notebooks_py/
│   │   └── notebook.py
│   └── notebook.ipynb
└── Gamma/
    ├── notebooks_py/
    │   └── notebook.py
    └── notebook.ipynb

I haven't been able to figure this out. I am able to get it to work if I switch the locations of the .ipynb and .py files and use this in in my config:

[formats]
"notebooks_ipynb/" = "ipynb"
"./" = "py:percent"

I am open to manually pairing each .py and .ipynb pair or putting jupytext.toml config files in each project directory if that will help (Alpha, Beta, Gamma)

@hectormz
Copy link
Contributor Author

I seem to be able to achieve what I want (from some other, old issues) using:

formats = "ipynb,_notebooks_py//py:percent,notebooks_md//md"

although I'm not sure what the equivalent is for the other style (for completeness)

[formats]
...
...
...
``
Maybe @mwouts has an idea. It would be good to expand the config section to cover this type of organization/pairing

@VRConservation
Copy link

Hi,
I'm having the same issue when I use

jupytext --sync *.ipynb

It only syncs the notebooks in the folder that I cd into. So, If I have paired notebooks in separate folders, I have to cd into each folder and issue the command. Is there any way to sync across an entire folder and all subfolders?

@mwouts
Copy link
Owner

mwouts commented Jun 2, 2024

Hi @VRConservation , can you use the globstar operator for this?

shopt -s globstar
jupytext --sync **/*.ipynb
jupytext --sync {dir_a,dir_b,dir_c}/**/*.ipynb

@hectormz sorry that I missed this issue, indeed in the dict-like representation you can't have an empty prefix at the moment, I will fix that in a future version.

@VRConservation
Copy link

VRConservation commented Jun 3, 2024 via email

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