{"id":13478291,"url":"https://github.com/kiyoon/jupynium.nvim","last_synced_at":"2025-05-14T23:06:02.253Z","repository":{"id":65228657,"uuid":"587921135","full_name":"kiyoon/jupynium.nvim","owner":"kiyoon","description":"Selenium-automated Jupyter Notebook that is synchronised with Neovim in real-time.","archived":false,"fork":false,"pushed_at":"2025-02-19T05:17:26.000Z","size":318,"stargazers_count":605,"open_issues_count":10,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-13T20:39:09.626Z","etag":null,"topics":["jupyter-notebook","neovim","neovim-plugin","neovim-plugins","nvim","nvim-plugin","nvim-plugins","vim"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiyoon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"kiyoon"}},"created_at":"2023-01-11T22:34:15.000Z","updated_at":"2025-04-12T10:47:22.000Z","dependencies_parsed_at":"2023-12-29T06:25:14.334Z","dependency_job_id":"51a7da02-2b26-400b-a3e0-8932c71fb297","html_url":"https://github.com/kiyoon/jupynium.nvim","commit_stats":{"total_commits":145,"total_committers":10,"mean_commits":14.5,"dds":"0.11724137931034484","last_synced_commit":"b0b71577c6e4a613b6a4180068dd0b2de0659e52"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiyoon%2Fjupynium.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiyoon%2Fjupynium.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiyoon%2Fjupynium.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiyoon%2Fjupynium.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiyoon","download_url":"https://codeload.github.com/kiyoon/jupynium.nvim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243358,"owners_count":22038046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter-notebook","neovim","neovim-plugin","neovim-plugins","nvim","nvim-plugin","nvim-plugins","vim"],"created_at":"2024-07-31T16:01:55.097Z","updated_at":"2025-05-14T23:05:57.245Z","avatar_url":"https://github.com/kiyoon.png","language":"Python","readme":"# Jupynium: Control Jupyter Notebook on Neovim with ZERO Compromise\n\n|  |  |\n|--|--|\n|[![Ruff](https://img.shields.io/badge/Ruff-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)](https://github.com/astral-sh/ruff) [![StyLua](https://img.shields.io/badge/stylua-%232C2D72.svg?style=for-the-badge\u0026logo=lua\u0026logoColor=white)](https://github.com/JohnnyMorganz/StyLua) |[![Actions status](https://github.com/kiyoon/jupynium.nvim/workflows/Style%20checking/badge.svg)](https://github.com/kiyoon/jupynium.nvim/actions)|\n| [![Ruff](https://img.shields.io/badge/Ruff-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)](https://github.com/astral-sh/ruff) | [![Actions status](https://github.com/kiyoon/jupynium.nvim/workflows/Linting/badge.svg)](https://github.com/kiyoon/jupynium.nvim/actions) |\n| [![pytest](https://img.shields.io/badge/pytest-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)](https://github.com/pytest-dev/pytest) | [![Actions status](https://github.com/kiyoon/jupynium.nvim/workflows/Tests/badge.svg)](https://github.com/kiyoon/jupynium.nvim/actions) |\n| [![uv](https://img.shields.io/badge/uv-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)](https://github.com/astral-sh/uv) | [![Actions status](https://github.com/kiyoon/jupynium.nvim/workflows/Check%20pip%20compile%20sync/badge.svg)](https://github.com/kiyoon/jupynium.nvim/actions) |\n\n**It's just like a markdown live preview, but it's Jupyter Notebook live preview!**\n\nJupynium uses Selenium to automate Jupyter Notebook, synchronising everything you type on Neovim.  \nNever leave Neovim. Switch tabs on the browser as you switch files on Neovim.\n\nNote that it doesn't sync from Notebook to Neovim so only modify from Neovim.\n\n\u003cimg src=https://user-images.githubusercontent.com/12980409/221559945-46f12a38-2fb8-4156-bb94-b87e831ac8f5.gif width=100% /\u003e\n\n## How does it work?\n\n\u003cimg src=https://user-images.githubusercontent.com/12980409/211933889-e31e844c-1cf3-4d1a-acdc-70cb6e244ee4.png width=50% /\u003e\n\nThe Jupynium server will receive events from Neovim, keep the copy of the buffer and apply that to the Jupyter Notebook by using Selenium browser automation. It interacts only through the front end so it doesn't require installing extensions on the kernel etc., which makes it possible to:\n\n- Develop locally, run remotely (or vice versa)\n- Use university-hosted Jupyter Notebook\n- Use any other languages / kernels such as R\n\n## 🛠️ Installation\n\n### Requirements\n\n- 💻 Linux, macOS and Windows (CMD, PowerShell, WSL2)\n- ✌️ Neovim \u003e= v0.8\n- 🦊 Firefox\n  - Other browsers are not supported due to their limitation with Selenium (see [#49](https://github.com/kiyoon/jupynium.nvim/issues/49#issuecomment-1443304753))\n- 🦎 Mozilla geckodriver\n  - May already be installed with Firefox. Check `geckodriver -V`\n- 🐍 Python \u003e= 3.9\n- 📔 Jupyter Notebook \u003e= 6.2\n  - Jupyter Lab is not supported\n  - \n    ```sh\n    # jupyter-console is optional and used for `:JupyniumKernelOpenInTerminal`\n    pip install notebook nbclassic jupyter-console\n    ```\n\n#### Important note about Notebook 7 (breaking change!)\nJupynium does not support Notebook 7 yet. In the meantime, you can change the `default_notebook_URL = \"localhost:8888/nbclassic\"` in `require(\"jupynium\").setup({ ... })` to use the classic (Notebook 6) interface with Jupynium. This is the new default setting from now on.\n\nDon't forget to upgrade your notebook and install nbclassic (`pip install --upgrade notebook nbclassic`) when you set this.\n\n\n### Install Python\n\nDon't have system Python 3.9? You can use [uv](https://github.com/astral-sh/uv) which downloads python and creates a virtual environment.\n\n```bash\n# This downloads python 3.13 if it doesn't exist.\nuv venv ~/.virtualenvs/jupynium --python=3.13\n```\n\nOr with [Conda](https://docs.conda.io/en/latest/miniconda.html):\n\n```bash\nconda create -n jupynium python=3\n```\n\nIf you want to use system python, (not conda or uv), upgrade pip. This solves many problems:\n\n```bash\n# pip \u003e= 23.0 recommended\npip3 install --upgrade pip\n```\n\n### Install Jupynium\n\n\u003cdetails\u003e\n\u003csummary\u003e\nClick to see vim-plug and packer installation.\n\u003c/summary\u003e\n\nWith vim-plug:\n\n```vim\nPlug 'kiyoon/jupynium.nvim', { 'do': 'pip3 install --user .' }\n\" Plug 'kiyoon/jupynium.nvim', { 'do': 'uv pip install . --python=$HOME/.virtualenvs/jupynium/bin/python' }\n\" Plug 'kiyoon/jupynium.nvim', { 'do': 'conda run --no-capture-output -n jupynium pip install .' }\nPlug 'rcarriga/nvim-notify'   \" optional\nPlug 'stevearc/dressing.nvim' \" optional, UI for :JupyniumKernelSelect\n```\n\nWith packer.nvim:\n\n```lua\nuse { \"kiyoon/jupynium.nvim\", run = \"pip3 install --user .\" }\n-- use { \"kiyoon/jupynium.nvim\", run = \"uv pip install . --python=$HOME/.virtualenvs/jupynium/bin/python\" }\n-- use { \"kiyoon/jupynium.nvim\", run = \"conda run --no-capture-output -n jupynium pip install .\" }\nuse { \"rcarriga/nvim-notify\" }   -- optional\nuse { \"stevearc/dressing.nvim\" } -- optional, UI for :JupyniumKernelSelect\n```\n\u003c/details\u003e\n\nWith 💤lazy.nvim:\n\n```lua\n  {\n    \"kiyoon/jupynium.nvim\",\n    build = \"pip3 install --user .\",\n    -- build = \"uv pip install . --python=$HOME/.virtualenvs/jupynium/bin/python\",\n    -- build = \"conda run --no-capture-output -n jupynium pip install .\",\n  },\n  \"rcarriga/nvim-notify\",   -- optional\n  \"stevearc/dressing.nvim\", -- optional, UI for :JupyniumKernelSelect\n```\n\n#### Configure Jupynium\n\nThe default configuration values are below and work well for system-level Python users. If you're a Conda user, you need to change `python_host` to execute using the `conda` command instead.\n\n\u003cdetails\u003e\n\u003csummary\u003e\nClick to see the setup defaults\n\u003c/summary\u003e\n\n```lua\nrequire(\"jupynium\").setup({\n  --- For Conda environment named \"jupynium\",\n  -- python_host = { \"conda\", \"run\", \"--no-capture-output\", \"-n\", \"jupynium\", \"python\" },\n  python_host = vim.g.python3_host_prog or \"python3\",\n\n  default_notebook_URL = \"localhost:8888/nbclassic\",\n\n  -- Write jupyter command but without \"notebook\"\n  -- When you call :JupyniumStartAndAttachToServer and no notebook is open,\n  -- then Jupynium will open the server for you using this command. (only when notebook_URL is localhost)\n  jupyter_command = \"jupyter\",\n  --- For Conda, maybe use base environment\n  --- then you can `conda install -n base nb_conda_kernels` to switch environment in Jupyter Notebook\n  -- jupyter_command = { \"conda\", \"run\", \"--no-capture-output\", \"-n\", \"base\", \"jupyter\" },\n\n  -- Used when notebook is launched by using jupyter_command.\n  -- If nil or \"\", it will open at the git directory of the current buffer,\n  -- but still navigate to the directory of the current buffer. (e.g. localhost:8888/nbclassic/tree/path/to/buffer)\n  notebook_dir = nil,\n\n  -- Used to remember the last session (password etc.).\n  -- e.g. '~/.mozilla/firefox/profiles.ini'\n  -- or '~/snap/firefox/common/.mozilla/firefox/profiles.ini'\n  firefox_profiles_ini_path = nil,\n  -- nil means the profile with Default=1\n  -- or set to something like 'default-release'\n  firefox_profile_name = nil,\n\n  -- Open the Jupynium server if it is not already running\n  -- which means that it will open the Selenium browser when you open this file.\n  -- Related command :JupyniumStartAndAttachToServer\n  auto_start_server = {\n    enable = false,\n    file_pattern = { \"*.ju.*\" },\n  },\n\n  -- Attach current nvim to the Jupynium server\n  -- Without this step, you can't use :JupyniumStartSync\n  -- Related command :JupyniumAttachToServer\n  auto_attach_to_server = {\n    enable = true,\n    file_pattern = { \"*.ju.*\", \"*.md\" },\n  },\n\n  -- Automatically open an Untitled.ipynb file on Notebook\n  -- when you open a .ju.py file on nvim.\n  -- Related command :JupyniumStartSync\n  auto_start_sync = {\n    enable = false,\n    file_pattern = { \"*.ju.*\", \"*.md\" },\n  },\n\n  -- Automatically keep filename.ipynb copy of filename.ju.py\n  -- by downloading from the Jupyter Notebook server.\n  -- WARNING: this will overwrite the file without asking\n  -- Related command :JupyniumDownloadIpynb\n  auto_download_ipynb = true,\n\n  -- Automatically close tab that is in sync when you close buffer in vim.\n  auto_close_tab = true,\n\n  -- Always scroll to the current cell.\n  -- Related command :JupyniumScrollToCell\n  autoscroll = {\n    enable = true,\n    mode = \"always\", -- \"always\" or \"invisible\"\n    cell = {\n      top_margin_percent = 20,\n    },\n  },\n\n  scroll = {\n    page = { step = 0.5 },\n    cell = {\n      top_margin_percent = 20,\n    },\n  },\n\n  -- Files to be detected as a jupynium file.\n  -- Add highlighting, keybindings, commands (e.g. :JupyniumStartAndAttachToServer)\n  -- Modify this if you already have lots of files in Jupytext format, for example.\n  jupynium_file_pattern = { \"*.ju.*\" },\n\n  use_default_keybindings = true,\n  textobjects = {\n    use_default_keybindings = true,\n  },\n\n  syntax_highlight = {\n    enable = true,\n  },\n\n  -- Dim all cells except the current one\n  -- Related command :JupyniumShortsightedToggle\n  shortsighted = false,\n\n  -- Configure floating window options\n  -- Related command :JupyniumKernelHover\n  kernel_hover = {\n    floating_win_opts = {\n      max_width = 84,\n      border = \"none\",\n    },\n  },\n\n  notify = {\n    ignore = {\n      -- \"download_ipynb\",\n      -- \"error_download_ipynb\",\n      -- \"attach_and_init\",\n      -- \"error_close_main_page\",\n      -- \"notebook_closed\",\n    },\n  },\n})\n\n-- You can link highlighting groups.\n-- This is the default (when colour scheme is unknown)\n-- Try with CursorColumn, Pmenu, Folded etc.\nvim.cmd [[\nhi! link JupyniumCodeCellSeparator CursorLine\nhi! link JupyniumMarkdownCellSeparator CursorLine\nhi! link JupyniumMarkdownCellContent CursorLine\nhi! link JupyniumMagicCommand Keyword\n]]\n\n-- Please share your favourite settings on other colour schemes, so I can add defaults.\n-- Currently, tokyonight is supported.\n```\n\n\u003c/details\u003e\n\n#### Optionally, configure `nvim-cmp` to show Jupyter kernel completion\n\n```lua\nlocal cmp = require \"cmp\"\nlocal compare = cmp.config.compare\n\ncmp.setup {\n  sources = {\n    { name = \"jupynium\", priority = 1000 },  -- consider higher priority than LSP\n    { name = \"nvim_lsp\", priority = 100 },\n    -- ...\n  },\n  sorting = {\n    priority_weight = 1.0,\n    comparators = {\n      compare.score,            -- Jupyter kernel completion shows prior to LSP\n      compare.recently_used,\n      compare.locality,\n      -- ...\n    },\n  },\n}\n```\n\n#### Optionally, configure `nvim-ufo` to fold cells\n\nThere is an API serving as a folds provider, which will return a table with format `{startLine=#num, endLine=#num}`.  \n\n```lua\nrequire(\"jupynium\").get_folds()\n```\n\nYou should use it with a fold plugin like [nvim-ufo](https://github.com/kevinhwang91/nvim-ufo).  \nSee [#88](https://github.com/kiyoon/jupynium.nvim/pull/88) for more detail and an example configuration.\n\n## 🏃 Quick Start\n\n- Open a `*.ju.py` file.\n- Execute `:JupyniumStartAndAttachToServer`. This will open Jupyter Notebook on the Firefox browser.\n  - If not, clarify option `jupyter_command` or just open the Notebook server by yourself: `jupyter notebook`\n- Execute `:JupyniumStartSync`. This will create an `Untitled.ipynb` file on the browser.\n- Now you can type `# %%` in Neovim to create a code cell.\n  - You'll see everything you type below that will be synchronised in the browser.\n  - Execute cells using the default keybind `\u003cspace\u003ex`.\n\nFor detailed instructions, see Usage below.\n\n## 🚦 Usage\n\nThere are 2 general steps to using Jupynium:\n\n1. Setup a Jupynium file\n2. Connect to the Jupynium server\n\nThe Jupynium server stays alive as long as the browser is alive. So you can see them as the same thing in this doc.\nFor example:\n\n- Starting Jupynium server = opening a Selenium browser\n- Manually closing the browser = closing the Jupynium server\n\n### Setup a Jupynium file\n\nJupynium uses a Jupytext's percent format (see the `Jupynium file format` section below). This Jupytext file named `.ju.py` is what you will primarily be interacting with, rather than the `.ipynb` file directly. The contents of the Jupynium file are synced to the browser notebook where it can be viewed in real-time. If you want to keep a copy of the notebook, it can be downloaded as an `.ipynb` file later.\n\nFirst, it's recommended to set a password on your notebook (rather than using tokens):\n\n```console\n$ jupyter notebook password\nEnter password: 🔒\n\n$ jupyter notebook    # leave notebook opened\n```\n\n#### If you want to start a new notebook\n\n1. Manually create a local Jupynium file called `\u003cfilename\u003e.ju.py`\n2. Done! The rest happens after connecting to the server\n\n#### If you want to open an existing notebook\n\nThere are currently 2 ways of converting an existing `.ipynb` file to a Jupynium file:\n\n**Option 1**: Use an included command line tool:\n\n```bash\nipynb2jupytext [-h] [--stdout] [--code_only] file.ipynb [file.ju.py]\n```\n\nIf you're already familiar with Jupytext, feel free to use it instead.\n\n**Option 2**: This method requires that you have already connected to the Jupynium server:\n\n1. Open your `.ipynb` file in the web browser after connecting to the server\n2. In a new Neovim buffer, run `:JupyniumLoadFromIpynbTab`. This will convert the contents of the notebook file to Jupynium format.\n3. Save your buffer as `\u003cfilename\u003e.ju.py`\n\nWhen using Jupynium for the first time, it's recommended to start a new notebook to make sure everything works before trying to load existing files.\n\n### Connect to the Jupynium server\n\n(This is for local Neovim only. For remote Neovim, see [Command-Line Usage](#%EF%B8%8F-command-line-usage-attach-to-remote-neovim))\n\nIn Neovim, with your Jupynium `.ju.py` file open, you can run `:JupyniumStartAndAttachToServer` to start the notebook server.\n\n#### Sync current buffer to the Jupynium server\n\nYou need to be on the main notebook page (file browser) for the next few steps.\n\nAlthough Neovim is now attached to the server, it won't automatically start syncing.\n\nTo sync your Neovim Jupynium file to a notebook, run `:JupyniumStartSync`.\n\nYou can also:\n\n- `:JupyniumStartSync filename` to give a name to the notebook (`filename.ipynb`) instead of `Untitled.ipynb`. This does not open existing files. If a file with that name already exists then the filename argument will just be ignored.\n- To sync a Jupynium file to an existing notebook, manually open the file in the browser, and `:JupyniumStartSync 2` to sync to the 2nd tab (count from 1).\n\nAt this point, any changes you make within the Neovim Jupynium file will be reflected live in the browser. Make sure you do not make changes inside the browser itself, as the sync is only one-way (from Neovim to browser).\n\nIf you want to save a copy of the `.ipynb` file, run `:JupyniumDownloadIpynb`. There is also a configuration option to enable automatic downloading.\n\n#### Sync multiple Jupynium files\n\nYou can sync multiple files at the same time. Simple run `:JupyniumStartSync` again with the new file you want to sync.\n\n#### Use multiple Neovim\n\nYou can run `:JupyniumStartSync` on a new Neovim instance.  \nIf you have `auto_attach_to_server = false` during setup, you need to run `:JupyniumAttachToServer` and `:JupyniumStartSync`.\n\n## 📝 Jupynium file format (.ju.py or .ju.\\*)\n\nThe Jupynium file format follows Jupytext's percent format. In order for Jupynium to detect the files, name them as `*.ju.py` or specify `jupynium_file_pattern` in `require(\"jupynium\").setup()`.\n\n**Code cell:**  \nAny code below this line (and before the next separator) will be the content of a code cell.\n\n- `# %%`\n\n**Magic commands**\n\n- `# %time` becomes `%time` in notebook.\n- If you want to really comment out magic commands, comment it two times like `## %time`.\n\n**Markdown cell:**\nAny code below this line will be markdown cell content.\n\n- `# %% [md]`\n- `# %% [markdown]`\n\nIn Python, the recommended way is to wrap the whole cell content as a multi-line string.\n\n```python\n# %% [md]\n\"\"\"\n# This is a markdown heading\nThis is markdown content\n\"\"\"\n```\n\nIn other languages like R, you'll need to comment every line.\n\n```r\n# %% [md]\n# # This is a markdown heading\n# This is markdown content\n```\n\n**Explicitly specify the first cell separator to use it like a notebook.**\n\n- If there is one or more cells, it works as a notebook mode.\n  - Contents before the first cell are ignored, so use it as a heading (shebang etc.)\n- If there is no cell, it works as a markdown preview mode.\n  - It will still open ipynb file but will one have one markdown cell.\n\n## ⌨️ Keybindings\n\n- `\u003cspace\u003ex`: Execute selected cells\n- `\u003cspace\u003ec`: Clear selected cells\n- `\u003cPageUp\u003e`, `\u003cPageDown\u003e`: Scroll notebook\n- `\u003cspace\u003ejs`: Scroll to cell (if autoscroll is disabled)\n- `\u003cspace\u003eK`: Hover (inspect a variable)\n- `\u003cspace\u003ejo`: Toggle output scroll (when output is long)\n\nIf you want custom keymaps, add `use_default_keybindings = false` and follow `M.default_keybindings()` in [lua/jupynium/init.lua](lua/jupynium/init.lua).\n\n### Textobjects\n\n- `[j`, `]j`: go to previous / next cell separator\n  - Repeat with `;` and `,` if you have [nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects).\n    Follow their instructions for keybindings for this.\n- `\u003cspace\u003ejj`: go to current cell separator\n- `vaj`,`vij`, `vaJ`, `viJ`: select current cell\n  - `a`: include separator, `i`: exclude separator\n  - `j`: exclude next separator, `J`: include next separator\n\nIf you want custom keymaps, add `textobjects = { use_default_keybindings = false }` and follow `M.default_keybindings()` in [lua/jupynium/textobj.lua](lua/jupynium/textobj.lua).\n\n## 📡 Available Vim Commands\n\n```vim\n\" Server (only used when Neovim is local. See Command-Line Usage for remote neovim)\n:JupyniumStartAndAttachToServer [notebook_URL]\n:JupyniumStartAndAttachToServerInTerminal [notebook_URL]    \" Useful for debugging\n:JupyniumAttachToServer [notebook_URL]\n\n\" Sync\n:JupyniumStartSync [filename / tab_index]\n:JupyniumStopSync\n:JupyniumLoadFromIpynbTab tab_index\n:JupyniumLoadFromIpynbTabAndStartSync tab_index\n\n\" Notebook (while syncing)\n:JupyniumSaveIpynb\n:JupyniumDownloadIpynb [filename]\n:JupyniumAutoDownloadIpynbToggle\n\n:JupyniumScrollToCell\n:JupyniumScrollUp\n:JupyniumScrollDown\n:JupyniumAutoscrollToggle\n\n:JupyniumExecuteSelectedCells\n:JupyniumClearSelectedCellsOutputs\n:JupyniumToggleSelectedCellsOutputsScroll\n\n:JupyniumKernelRestart\n:JupyniumKernelInterrupt\n:JupyniumKernelSelect\n:JupyniumKernelHover      \" See value like LSP hover\n:JupyniumKernelOpenInTerminal [hostname] \" Connect to kernel of synchronized notebook\n\n\" Highlight\n:JupyniumShortsightedToggle\n```\n\n## Lua API\n\nThe core API is provided as a global function.\n\n```lua\n--- Execute javascript in the browser. It will switch to the correct tab before executing.\n---@param bufnr: integer | nil If given, before executing the code it will switch to the tab of this buffer. Requires syncing in advance.\n---@param code string Javascript code\n---@return boolean, object: Success, response\nJupynium_execute_javascript(bufnr, code)\n```\n\nExample: get kernel name and language\n\n```lua\n-- Use bufnr=nil if you don't want to switch tab\nlocal code = [[return [Jupyter.notebook.kernel.name, Jupyter.kernelselector.kernelspecs];]]\nlocal status_ok, kernel_name_and_spec = Jupynium_execute_javascript(0, code)\nif status_ok then\n  local kernel_name = kernel_name_and_spec[1]   -- \"python3\"\n  local kernel_spec = kernel_name_and_spec[2]\n  local kernel_language = kernel_spec[kernel_name].spec.language  -- \"python\"\n  local kernel_display_name = kernel_spec[kernel_name].spec.display_name  -- \"Python 3 (ipykernel)\"\nend\n```\n\n## 👨‍💻️ Command-Line Usage (attach to remote Neovim)\n\n**You don't need to install the vim plugin to use Jupynium.** The plugin is responsible of adding `:JupyniumStartAndAttachToServer` etc. that just calls the command line program, plus it has textobjects and shortsighted support.\n\nInstall Jupynium if you haven't already:\n\n```bash\npip3 install jupynium\n```\n\nOpen a python/markdown file with nvim and see `:echo v:servername`.  \nRun Jupynium like:\n\n```bash\njupynium --nvim_listen_addr /tmp/your_socket_path\n```\n\nOr, you can run Neovim like\n\n```bash\nnvim --listen localhost:18898 notebook.ju.py\n```\n\nThen start Jupynium as well as attaching the neovim to it.\n\n```bash\njupynium --nvim_listen_addr localhost:18898\n```\n\nNote that you can attach to remote neovim by changing `localhost` to `servername.com` or using SSH port forwarding.\n\nThis will open Firefox with Selenium, defaulting to `http://localhost:8888/nbclassic`.\n\nAdditionally,\n\n- You can run `jupynium` command multiple times to attach more than one Neovim instance.\n- `jupynium --notebook_URL localhost:18888` to view different notebook.\n- You can just run `jupynium` without arguments to just leave the server / browser running and wait for nvim to attach.\n\n## ⚠️ Caution\n\nThe program is in the alpha stage. If it crashes it's likely that the whole browser turns off without saving!\n\n### Rules\n\n1. Always leave the home page accessible. Jupynium interacts with it to open files. Do not close, or move to another website.\n\n- It's okay to move between directories.\n\n2. It's OK to close the notebook pages. If you do so, it will stop syncing that buffer.\n3. Changing tab ordering or making it to a separate window is OK.\n\n## 🤔 FAQ\n\n\u003e Firefox doesn't run.\n\nMake sure your setup with selenium has no problem. Run the following python code to see if selenium is even working.\n\n```python\n# Run with the same environment Jupynium is installed.\nfrom selenium import webdriver\ndriver = webdriver.Firefox()\ndriver.get(\"https://www.selenium.dev/selenium/web/web-form.html\")\n```\n\nIf you're using Ubuntu 22.04 or higher, you need to either install firefox with apt (not snap) or put snap geckodriver in `$PATH`.\nSee \u003chttps://stackoverflow.com/questions/72405117/selenium-geckodriver-profile-missing-your-firefox-profile-cannot-be-loaded\u003e\n\n\u003e 🌽 How do I use different languages / kernels?\n\nInstead of `*.ju.py` if you make files named `*.ju.*` (e.g. `*.ju.r`) you will see all the keybindings and commands.  \nAll the procedures should be the same.\n\n\u003e The notebook content is not in sync with vim. How do I fix it?\n\nYou probably would have accidentally modified directly from the notebook.\n\n1. If you want to keep the vim content and sync to the notebook, just \u003cins\u003eadd one more cell in the notebook and start making changes in vim\u003c/ins\u003e. It works because Jupynium tries to only update the currently modified cell if the number of cells is the same in both. If it differs, it will fully update the entire content.\n2. To keep the notebook content and load that to vim, run `:JupyniumLoadFromIpynbTab [tab_index]` without making changes on vim.\n\n## 📰 Fun Facts\n\n- I spent my whole Christmas and New Year holidays (and more) just making this plugin.\n- This is the star history chart with relevant plugins. Thank you for helping it grow!\n\n[![Star History Chart](https://api.star-history.com/svg?repos=kiyoon/jupynium.nvim,imbue-ai/jupyter_ascending,imbue-ai/jupyter_ascending.vim,dccsillag/magma-nvim,luk400/vim-jukit\u0026type=Date)](https://star-history.com/#kiyoon/jupynium.nvim\u0026imbue-ai/jupyter_ascending\u0026imbue-ai/jupyter_ascending.vim\u0026dccsillag/magma-nvim\u0026luk400/vim-jukit\u0026Date)\n","funding_links":["https://github.com/sponsors/kiyoon"],"categories":["Python","Utility","Live Preview"],"sub_categories":["Indent"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiyoon%2Fjupynium.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiyoon%2Fjupynium.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiyoon%2Fjupynium.nvim/lists"}