diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc33d4e..597cba11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Jupytext ChangeLog ================== +1.16.2-dev (2024-03-??) +------------------- + +**Changed** +- Temporary text notebooks for the `--pipe` or `--check` commands are now created in the notebook directory ([#1206](https://github.com/mwouts/jupytext/issues/1206)) + + 1.16.1 (2024-01-13) ------------------- diff --git a/environment.yml b/environment.yml index 3e4df517..234707e2 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - defaults - conda-forge dependencies: - - python>=3.8 + - python>=3.8,<3.12 - jupyterlab>=4.0.0 - nbformat>=5.1.2 - pre-commit diff --git a/src/jupytext/cli.py b/src/jupytext/cli.py index 6ce98a03..e8e253d1 100644 --- a/src/jupytext/cli.py +++ b/src/jupytext/cli.py @@ -659,10 +659,20 @@ def jupytext_single_file(nb_file, args, log): # II. ### Apply commands onto the notebook ### # Pipe the notebook into the desired commands - prefix = None if nb_file == "-" else os.path.splitext(os.path.basename(nb_file))[0] + if nb_file == "-": + prefix = None + directory = None + else: + prefix = os.path.splitext(os.path.basename(nb_file))[0] + directory = os.path.dirname(nb_file) for cmd in args.pipe or []: notebook = pipe_notebook( - notebook, cmd, args.pipe_fmt, prefix=prefix, warn_only=args.warn_only + notebook, + cmd, + args.pipe_fmt, + prefix=prefix, + directory=directory, + warn_only=args.warn_only, ) # and/or test the desired commands onto the notebook @@ -673,6 +683,7 @@ def jupytext_single_file(nb_file, args, log): args.pipe_fmt, update=False, prefix=prefix, + directory=directory, warn_only=args.warn_only, ) @@ -1143,7 +1154,13 @@ def exec_command(command, input=None, capture=False, warn_only=False): def pipe_notebook( - notebook, command, fmt="py:percent", update=True, prefix=None, warn_only=False + notebook, + command, + fmt="py:percent", + update=True, + prefix=None, + directory=None, + warn_only=False, ): """Pipe the notebook, in the desired representation, to the given command. Update the notebook with the returned content if desired.""" @@ -1167,6 +1184,7 @@ def pipe_notebook( encoding="utf8", prefix=prefix, suffix=fmt["extension"], + dir=directory, delete=False, ) try: diff --git a/src/jupytext/version.py b/src/jupytext/version.py index 872dd07e..980dc858 100644 --- a/src/jupytext/version.py +++ b/src/jupytext/version.py @@ -1,3 +1,3 @@ """Jupytext's version number""" -__version__ = "1.16.1" +__version__ = "1.16.2-dev"