Feature Proposal / Workflow Idea: Jupytext-based Notebook Workflow in Zed #51653
sergioruiiz91
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
This workflow lets you work with Jupyter notebooks indirectly inside Zed, using Jupytext to sync between text-based formats (
.py,.R,.md,.Rmd) and.ipynbnotebooks.It gives you the speed, keybindings, and editor features of Zed while staying fully compatible with the Jupyter ecosystem.
Features / Benefits
.py + .md,.py + .ipynb.R + .ipynb,.R + .Rmd.py,.R,.md, or.Rmdare reflected in.ipynband vice versa.Limitations / Considerations
ZED_FILE/ZED_STEMhandling may require attention on new projects.Installation / Setup
1. Install Jupytext
Create a virtual environment and install Jupytext:
python -m venv .venv source .venv/bin/activate pip install jupytext2. Configure Zed Tasks
~/.config/zed/tasks.jsonor your project-level tasks.3. Using the Workflow
.pyor.Rfile in Zed..ipynbor.Rmd.Potential Improvements
%run cellshortcut).Tasks JSON Example
[ { "label": "Jupytext: Create new SESSION Python notebook (py + md)", "command": "read -p 'Name of new Python notebook: ' name && touch \"$name.py\" \"$name.md\" && jupytext --set-formats py,md \"$name.py\" && jupytext --sync \"$name.py\"", "use_new_terminal": true }, { "label": "Jupytext: Create new SESSION Python notebook (py + ipynb)", "command": "read -p 'Name of new Python notebook: ' name && touch \"$name.py\" \"$name.ipynb\" && jupytext --set-formats py,ipynb \"$name.py\" && jupytext --sync \"$name.py\"", "use_new_terminal": true }, { "label": "Jupytext: Create new SESSION R notebook (r + ipynb)", "command": "read -p 'Name of new R notebook: ' name && touch \"$name.R\" \"$name.ipynb\" && jupytext --set-formats R,ipynb \"$name.R\" && jupytext --sync \"$name.R\"", "use_new_terminal": true }, { "label": "Jupytext: Create new SESSION R notebook (r + rmd)", "command": "read -p 'Name of new R notebook: ' name && touch \"$name.R\" \"$name.Rmd\" && jupytext --set-formats R,Rmd \"$name.R\" && jupytext --sync \"$name.R\"", "use_new_terminal": true }, { "label": "Jupytext: TOTAL SYNC", "command": "jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "Python -> MD", "command": "touch \"$ZED_STEM.md\"; jupytext --set-formats py,md \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "MD -> Python", "command": "touch \"$ZED_STEM.py\"; jupytext --set-formats py,md \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "Python -> IPYNB", "command": "touch \"$ZED_STEM.ipynb\"; jupytext --set-formats py,ipynb \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "IPYNB -> Python", "command": "touch \"$ZED_STEM.py\"; jupytext --set-formats py,ipynb \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "R -> RMD", "command": "touch \"$ZED_STEM.Rmd\"; jupytext --set-formats R,Rmd \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "RMD -> R", "command": "touch \"$ZED_STEM.R\"; jupytext --set-formats R,Rmd \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "R -> IPYNB", "command": "touch \"$ZED_STEM.ipynb\"; jupytext --set-formats R,ipynb \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "IPYNB -> R", "command": "touch \"$ZED_STEM.R\"; jupytext --set-formats R,ipynb \"$ZED_FILE\"; jupytext --sync \"$ZED_FILE\"", "use_new_terminal": true }, { "label": "Jupytext: Run current cell (Python)", "command": "python -i \"$ZED_FILE\"", "use_new_terminal": false }, { "label": "Jupytext: Run entire Python notebook", "command": "python -i \"$ZED_FILE\"", "use_new_terminal": false }, { "label": "Run current cell (R)", "command": "R --quiet -e \"source('$ZED_FILE', echo=TRUE)\"", "use_new_terminal": false }, { "label": "Jupytext: Run entire R notebook", "command": "R --quiet -e \"source('$ZED_FILE', echo=TRUE)\"", "use_new_terminal": false } ]Beta Was this translation helpful? Give feedback.
All reactions