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

Using nbautoexport in VSCode #128

Open
gacek91 opened this issue Jul 24, 2024 · 1 comment
Open

Using nbautoexport in VSCode #128

gacek91 opened this issue Jul 24, 2024 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@gacek91
Copy link

gacek91 commented Jul 24, 2024

  • nbautoexport version: 0.5.2
  • Python version: 3.12.4
  • Operating System: macOS Sonoma 14.4

Description

I’m trying to run nbautoexport in Jupyter Notebooks opened in VSCode. Conversion from .ipynb to .py works without any problems in Jupyter Notebook/Jupyter Lab. However, whenever I connect VSCode to an active Jupyter session, neither automatic nor manual saves force the library to do the export to a .py file.

It seems probable that this is not an issue with nbautoexport itself, but rather with how VSCode saves notebook files. Nevertheless, I would be very grateful for any suggestions on how to tackle this issue.

What I Did

  1. Installed nbautoexport
  2. Tested the behaviour in Jupyter Notebook/Jupyter Lab:
  • Conversion works without any problems.
  1. Tested the behavior in VSCode:
  • Using the same session where nbautoexport worked with Jupyter Notebook/Lab (doesn’t work)
  • Using a new session created in VSCode (doesn’t work)

I also tried adding % autosave 120 to force save the notebooks every 2 minutes, and it also didn’t work.

Observations:

  • Jupyter Notebook/Jupyter Lab: Export to .py works as expected.
  • VSCode: Neither automatic nor manual saves trigger the export.

Additional Information:

  • No error messages were received during testing.
@jayqi
Copy link
Member

jayqi commented Jul 24, 2024

I'm not quite certain what you mean by "session" when you say "using the same session" as Jupyter Notebook/Lab. Do you mean "kernel"?

In any case, nbautoexport not working with VS Code is a general limitation we have. We hook into APIs related to Jupyter Notebook/Lab's functionality as an editor application (i.e., disk I/O) to trigger the export. VS Code is itself an editor and handles that stuff independently.

Supporting VS Code is going to involve building VS-Code-specific support, probably through a VS Code extension. It's something we're certainly interested in, as myself and other folks on our team also often use VS Code for notebooks. (Currently, my work-around is to just run nbautoexport export from the command-line manually periodically.) I had played around with making a VS Code extension for nbautoexport a year or two ago, but I wasn't familiar with developing extensions and didn't make much progress on getting something to work.

@jayqi jayqi added enhancement New feature or request help wanted Extra attention is needed labels Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants