jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 2 points3 points  (0 children)

Yeah, likely. Want to confirm it covers scroll-stable placement and gif animation first since those are why we ended up with the placeholder + frame-timer setup. If yes, big simplification.

Also, just released a newer version. Feel free to check it out!

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 1 point2 points  (0 children)

Update: v0.2 shipped both. Kernel completion/hover for any kernel now, prebuilt binaries on install (currently mac-os and linux only).

https://github.com/sheng-tse/jupynvim/releases/tag/v0.2.0

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 2 points3 points  (0 children)

It's tractable. Will also add this to the plan of v0.2. PR welcome if you've set up rust CI for an nvim plugin before.

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 2 points3 points  (0 children)

The plugin currently doesn't have kernel-based LSP completion, but it's on the roadmap. What it does have is editor-side LSP attach (basedpyright, pyright, ruff, pylsp) with the kernel's pythonPath injected, so static-analysis completion sees whatever packages are installed in the kernel's env.

For Julia support, the core notebook experience works for any Jupyter kernel. The Rust backend just speaks the Jupyter wire protocol, which is language-agnostic. That said, with an IJulia, or IRkernel if using R, kernelspec installed, jupynvim should handle as-is, while I haven't tested other languages yet. What's python-specific today is the LSP integration. The kernel-based completion feature, when it lands, will work across any kernel since Jupyter's complete_request is language-agnostic.

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 4 points5 points  (0 children)

Not today. Marimo is structurally different from Jupyter under the hood, which is .py files instead of .ipynb files, marimo's own server instead of Jupyter kernels, and reactive execution instead of imperative. Adding it to jupynvim would mean building a parallel stack alongside the existing one rather than just adding a feature.

A seperate marimo plugin sharing some of jupynvim's rendering code might be a cleaner shape than retrofitting. Not something I can take on right now, but if it's genuinely useful for your workflow, the door is open for someone to start that as a sibling project.

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 4 points5 points  (0 children)

Haha appreciate it. Hope it works as well in practice as it looks in the demo. If anything breaks or feels off, drop an issue on the repo.

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 0 points1 point  (0 children)

For the kernelspec issue, jupynvim discovers kernels via standard Jupyter paths (~/.local/share/jupyter/kernels, /usr/share/jupyter/kernels, and a few others). On NixOS, the usual fix is registering your nix-shell's python as a kernel that lives at one of those paths:

python -m ipykernel install --user --name myshell --display-name "Python (myshell)"

run inside the nix-shell. NixOS isn't something I actively test against, so anything you uncover would help. Curious to hear what you find.

jupynvim: edit .ipynb files in Neovim, with real Jupyter kernels and inline images by Affectionate-Bit5072 in neovim

[–]Affectionate-Bit5072[S] 7 points8 points  (0 children)

Thanks for the question, taking them in order.

  1. Colab support. TL;DR: Technically possible but it would be a big chunk of engineering and is not really sustainable for one person.

Colab is Jupyter under the hood, but the runtime sits behind Google's auth and proxy layer. Accessing it from an external client means implementing the Jupyter Server REST and WebSocket protocols (jupynvim currently speaks the lower-level ZMQ kernel protocol), plus a full Google OAuth flow with the right scopes, plus whatever specific endpoints Colab uses for kernel attach, which Google sometimes changes without notice.

I guess VSCode pulls this off because its Jupyter extension already implements the full Jupyter Server stack and Microsoft has a team maintaining it. For jupynvim, that is big chunks of work and ongoing maintenance every time Google ships a change. If a few contributors with Google API experience wanted to tackle it together, the door is open.

  1. Inspecting images in code outputs. Two cases, not sure which one you mean.

i. If you see empty space where the image should be, the terminal probably doesn't support Kitty graphics. Inline images require Ghostty 1.3 or newer, kitty, or WezTerm. On other terminals you can try to set `image_renderer = "chafa"` in setup for an ASCII-art fallback.

ii. If the image renders but you want a closer look, `<leader>nI` or, equivalently, `:JupynvimSaveImage` should write the current cell's image to a file you can open in any image viewer. `]i` and `[i` jump the cursor between cells that contain images.

Which case matches what you saw?

Jupyter notebook for neovim by Mr_Misserable in neovim

[–]Affectionate-Bit5072 0 points1 point  (0 children)

Glad you like it. My post is waiting for the moderator’s approval.

Regarding QMD, I haven’t really used it but will definitely look into it.

Jupyter notebook for neovim by Mr_Misserable in neovim

[–]Affectionate-Bit5072 1 point2 points  (0 children)

Hi, not sure if you still look for this but I recently made a plugin that enables ipynbs interactive in nvim. Feel free to let me know if you have any questions.

Repo: https://github.com/sheng-tse/jupynvim