A terminal-based Python notebook editor that brings Jupyter-style interactive coding to your command line.
Sage lets you write and execute Python code in cells, just like Jupyter notebooks, but entirely in your terminal. Work with the speed and efficiency of a text editor while getting the interactivity of a notebook environment.
- Cell-based execution: Organize code into executable cells using
##$$delimiters - Live output display: View execution results in a dedicated output pane
- Multiple kernels: Connect to different Python environments and switch between them
- Execution state tracking: See which cells have been executed and their output history
- Syntax highlighting: Python code is highlighted for better readability
- Smart autocomplete: Get code suggestions as you type
- Bracket matching: Automatically highlights matching brackets and parentheses
- Find and replace: Search through code with regex support
- Undo/redo: Full history of all edits
- Multiple selection modes: Click, double-click to select words, triple-click for lines
- Mouse support: Click to position cursor, drag to select, scroll with mouse wheel
- System clipboard: Copy and paste between Sage and other applications
- Auto-save indicators: Know when your work is saved
- Smart indentation: Tab/Shift+Tab to indent/unindent selections
- Word-level navigation: Jump between words with Ctrl+Arrow keys
- Interactive mode: Edit and execute cells in a live session
- Headless execution: Run notebook files from the command line without opening the editor
- Error handling: Execution stops on errors with clear traceback information
- Output persistence: Cell outputs remain visible until cleared or re-executed
sage myfile.py # Open an existing file or create a new one
sage # Start with an empty fileExecute a Python notebook file without opening the editor:
sage --execute myfile.py
sage --execute myfile.py --python /path/to/python3 # Use specific PythonHeadless mode will execute each cell in order, print outputs, and stop if any cell encounters an error.
Ctrl+S: Save fileCtrl+Q: Quit
Ctrl+Z: UndoCtrl+C: CopyCtrl+X: CutCtrl+V: PasteCtrl+A: Select allCtrl+Backspace: Delete word backwardTab: Indent selection (or insert tab)Shift+Tab: Unindent selection
- Arrow keys: Move cursor
Home/End: Move to start/end of linePage Up/Page Down: Scroll viewportCtrl+Home: Move to start of fileCtrl+End: Move to end of fileCtrl+Left/Ctrl+Right: Move by word
Ctrl+F: FindCtrl+H: Find and replaceCtrl+Shift+F: Find nextCtrl+Shift+H: Find previous
Ctrl+E: Execute current cellCtrl+K: Select/change Python kernelCtrl+L: Clear cell outputsCtrl+O: Toggle focus between editor and output pane
- Left click: Position cursor
- Click and drag: Select text
- Double click: Select word
- Triple click: Select line
- Scroll wheel: Scroll viewport
Cells are the building blocks of your notebook. Sage uses ##$$ as a cell delimiter:
# Cell 1: Import libraries
import numpy as np
import matplotlib.pyplot as plt
##$$
# Cell 2: Generate data
x = np.linspace(0, 10, 100)
y = np.sin(x)
##$$
# Cell 3: Plot results
plt.plot(x, y)
plt.show()Each cell can be executed independently with Ctrl+E. Without delimiters, the entire file is treated as a single cell.
Sage automatically discovers Python interpreters on your system. Press Ctrl+K to:
- View available Python environments
- Switch between different Python versions
- Connect to virtual environments
You can also specify a Python interpreter via shebang in your file:
#!/usr/bin/env python3Or use the --python flag when running in headless mode.
- Double-click any word to see all occurrences highlighted throughout your file
- Use Ctrl+O to toggle focus between the editor and output pane for easy scrolling through results
- Ctrl+L clears all cell outputs when you want a fresh start
- Press Esc to cancel find/replace or other dialogs
- Sage auto-launches in a terminal if you open it from a file manager