This extension is still in early development.
Peptide provides key-bindings to interactively develop Python programs, like CIDER/SLIME in the Lisp world.
Peptide is syntax-aware. It uses tree-sitter
to parse the source file and
select the appropriate code to execute in the REPL. See the Features
section for what can be selected.
Instead of printing the evaluation result to the terminal, Peptide displays the result inline, in the text editor. This provides instantaneous feedback and greater interactivity to the development experience.
Peptide uses Jupyter as a REPL backend.
NOTE: if you don't have Jupyter, follow the instructions to install it.
-
In your Python project's root folder, start a Jupyter server:
$ jupyter server [I 2022-01-15 15:55:44.742 ServerApp] Jupyter Server 1.13.1 is running at: [I 2022-01-15 15:55:44.742 ServerApp] http://localhost:8888/?token=baf72577cfb778a52d0317347c7863359a3facc17464f710
-
Copy the URL in the output. This contains the token that Peptide uses to communicate with the Jupyter Server.
-
In VSCode, go to "View" -> "Command Palette" (or Cmd + Shift + P on Mac). Run
Peptide: Connect to a Running Jupyter Server
, and paste the URL. -
Use any of the code evaluation commands described in the feature section.
-
At any time, press Shift + Esc, or choose
Peptide: Clear Inline Evaluation Result
in the Command Palette to clear the inline evaluation results.
- key-binding: Alt/Option + Enter
This command selects the top-level statement (e.g. function definition, assign statement, function call, etc.) under cursor, and evaluates it.
- key-binding: Ctrl + Enter
A form is one of:
- parenthesized_expression
- function call
- identifier (variable),
- or, a primitive value
This command selects a form that's immediately before the cursor. This is useful when inspecting parameters passed into a function call.
- key-binding: Ctrl + Alt+ Enter
This command sends the entire source file to the REPL for evaluation. This is useful when loading up the functions in the file before calling the evaluation commands.
This extension is still in early development.
Peptide is the Python Editor Plugin To Interactively Develop and Evaluate, à la CIDER and SLIME.