Skip to content

Quarto render deletes notebook file #6463

Closed as not planned
Closed as not planned

Description

@liquidcarbon

Bug description

I got into a habit of doing quarto convert notebook.ipynb && quarto render notebook.qmd to turn my notebooks into a QMD file, for testing top-to-bottom, and committing as a .qmd file that was verified to work. During quarto render the original notebook is deleted. I can see why this can be useful, but for me it's not useful at all, because I found the hard way that my notebook with 1000+ executed cells got erased. And my IPYNBs are in .gitignore anyway.

A better behavior, in my view, is to keep the existing IPYNB file. Or at least to have a -k, --keep option to quarto render.

Steps to reproduce

No response

Expected behavior

The preserve .ipynb file on quarto render .qmd

Actual behavior

The existing .ipynb file gets overwritten, then deleted

Your environment

No response

Quarto check output

[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.433
Path: ~/quarto/quarto-1.3.433/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
Version: 3.10.10

Activity

  1. added
    bug
    on Aug 8, 2023
  2. mcanouil commented on Aug 8, 2023

    @mcanouil
    Collaborator

    Quarto creates Jupyter notebooks while rendering from a Quarto document.
    This temporary notebook has the same name as the Quarto document.
    So, the suggested fix won't do anything as your notebook will be overwritten by the temporary one.

    Why not render the notebook directly?

    The fix would be to have your source notebooks in a different directory.

  3. liquidcarbon commented on Aug 8, 2023

    @liquidcarbon
    Author

    Thanks for your response. The simplest fix is to do render .ipynb first, then convert.

    I'd imagine it's not uncommon to have both .qmd and .ipynb files present with the same name, and writing over an existing .ipynb without any warning isn't great.

  4. mcanouil commented on Aug 8, 2023

    @mcanouil
    Collaborator

    To note, it's a duplicate of:

  5. added
    duplicate
    and removed
    bug
    on Aug 8, 2023
  6. jjallaire commented on Aug 8, 2023

    @jjallaire
    Collaborator

    Yeah, I agree that we should find a way to have the temporary notebook have a more distinguished name so this doesn't occur.

  7. cscheid commented on Aug 11, 2023

    @cscheid
    Member

    I imagine this entire class of bugs goes away when we implement the execution planner in 1.5, but I agree that if we can ship a workaround in 1.4 we absolutely should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions