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

Proposal: delete auto-exported file that are renamed #65

Closed
cccntu opened this issue Jan 10, 2021 · 3 comments
Closed

Proposal: delete auto-exported file that are renamed #65

cccntu opened this issue Jan 10, 2021 · 3 comments

Comments

@cccntu
Copy link

cccntu commented Jan 10, 2021

Currently if I rename a notebook, the exported file with old name is not deleted.

@jayqi
Copy link
Member

jayqi commented Jan 10, 2021

Hi @cccntu, thank you for using nbautoexport and for opening the issue.

Have you taken a look at the experimental clean command? You can check out the documentation page for it to see more about how to use it. We developed the clean command for this exact use case. The clean command works by checking files that exist against files that are expected to exist based on present notebooks. However, this is something you'll have to do manually, and it won't work automatically.

As for developing some kind of automatic functionality:

  • I don't know of a way to know when a notebook as been renamed. If you're renaming the notebook through Jupyter and Jupyter has some kind of event and hook for it, we can potentially do something with that, but I don't know about any functionality like that in Jupyter. However, this still won't work if you're renaming the notebook using a shell or if you rename it through your OS file browser. A completely general solution will probably be impossible for us to handle.
  • We did consider having the aforementioned clean command be able to run automatically after exporting, but we decided that having files deleted without user input needs a really high bar of reliability, and that clean's heuristic isn't good enough.

Let us know what you think!

@cccntu
Copy link
Author

cccntu commented Jan 11, 2021

Hi @jayqi , thank you for the thorough explanation.

  • I just checked out the doc and tried the clean command, and I think it's good. Also, I think the design consideration is very reasonable.
  • I also tried the export command, but found they always exports every files. Maybe we can check the modified time and only export the necessary files? (like in Make) So user can add this command in Makefile without generating all the files each time. And add a flag to force regenerating everything.

@jayqi
Copy link
Member

jayqi commented Jan 11, 2021

Awesome. I am going to close this issue for now since it looks like the clean command is good enough. We can later if there is a lot of demand for an automatic solution.

I've opened #67 for your suggestion about export.

@jayqi jayqi closed this as completed Jan 11, 2021
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

No branches or pull requests

2 participants