You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can pair a notebook to as many text representations as you want (see our _World population_ notebook in the demo folder). Format specifications are of the form
-`ext` is one of `ipynb`, `md`, `Rmd`, `jl`, `py`, `R`, `sh`, `cpp`, `q`. Use the `auto` extension to have the script extension chosen according to the Jupyter kernel.
-`format_name` (optional) is either `light` (default for scripts), `nomarker`, `percent`, `hydrogen`, `sphinx` (Python only), `spin` (R only) — see the [format specifications](formats.md).
-`root_folder`, `path`, `prefix` and `suffix` allow to save the text representation to files with different names, or in different folders (see the [configuration files examples](config.md#Configuring-paired-notebooks-globally)).
and later shows how to specify filtering on specific subdirectories
or alternatively, using a dict to map the prefix path to the format name:
```
# Pair notebooks in subfolders of 'notebooks' to scripts in subfolders of 'scripts'
[formats]
"notebooks/" = "ipynb"
"scripts/" = "py:percent"
```
Note that if you are using a `pyproject.toml` file with this dict format, you should make sure the table header is instead `[tool.jupytext.formats]`.
The `root_prefix` is matched with the top-most parent folder of the matching name, not above the Jupytext configuration file.
This means that if I wanted to have a pyproject.toml config that would only pair notebooks to py:percent files in a directory named examples/ that I could write it as such:
[tool.jupytext]
# Always pair ipynb notebooks in examples/ directory to py:percent filesformats = ["examples///ipynb", "examples///py:percent"]
Is it currently possible to specify in the config file a root_prefix option that would allow for keeping a more (in my very subjective view) readable format like the following (which is invalid)
# THIS IS INVALID
[tool.jupytext]
root_prefix = "examples/"# Always pair ipynb notebooks in examples/ directory to py:percent filesformats = ["ipynb", "py:percent"]
If so, can you tell me how to write it correctly?
The text was updated successfully, but these errors were encountered:
Hello @matthewfeickert , thanks for your question! Unfortunately at the moment there is no such root_prefix option in the [tool:jupytext] section of pyproject.toml files.
Does the example you gave above works? Alternatively you might use a jupytext.toml file in the examples directory (with content formats="ipynb,py:percent") to achieve the pairing just in that directory.
Thanks for the reply, @mwouts! This is helpful — I just wanted to make sure I wasn't missing something.
Does the example you gave above works? Alternatively you might use a jupytext.toml file in the examples directory (with content formats="ipynb,py:percent") to achieve the pairing just in that directory.
Yup the working examples are viable, and I like the idea about using per directory config files. Thanks!
I'm going to close this Issue as I don't think there are any changes that are planned that might affect this in the near future.
Hi. 👋 Thanks for making
jupytext
. In the docs it notes that format spec takes the form ofjupytext/docs/config.md
Lines 9 to 16 in b7a8dac
and later shows how to specify filtering on specific subdirectories
jupytext/docs/config.md
Lines 83 to 97 in b7a8dac
This means that if I wanted to have a
pyproject.toml
config that would only pair notebooks topy:percent
files in a directory namedexamples/
that I could write it as such:Is it currently possible to specify in the config file a
root_prefix
option that would allow for keeping a more (in my very subjective view) readable format like the following (which is invalid)If so, can you tell me how to write it correctly?
The text was updated successfully, but these errors were encountered: