Code Monkey home page Code Monkey logo

vscode-jupyter-python's Introduction

vscode-jupyter-python README

Run automatically-inferred Python code blocks in Jupyter.

In this example, the only keyboard shortcut used is Shift+Enter:

This is inspired by the Hydrogen and hydrogen-python extensions for Atom.

Install

Install from the Visual Studio Marketplace or search kylebarron.vscode-jupyter-python in the vscode extensions search bar.

Features

  • Infer a logical "block" of code to be run at once, without needing to manually mark cell boundaries with # %%.

    In general a "block" is the current line plus any following lines with a greater initial indentation.

    Additionally there's a list of keywords where the "block" of code should be expanded, even when that code appears at the same indentation level. For example:

    # cursor
    # โ†“
      if x > 0:
        foo()
      else:
        bar()

    in this case a naive "include only code with greater indentation" would exclude the else clause, so else is included in the list of keywords where the code should be extended despite being at the initial indentation. See "extension settings" below for how to modify this list.

Keyboard Shortcuts

By default there are two shortcuts defined:

  • Cmd+Enter/Ctrl+Enter: Run an automatically-inferred code block but don't move the cursor.
  • Shift+Enter: Run an automatically-inferred code block and move the cursor down to the start of the next code block.

Requirements

This depends on the upstream vscode-jupyter extension, where this extension simply infers what text to send to jupyter.execSelectionInteractive.

Extension Settings

  • vscode-jupyter-python.expandCodeList: This list is used to determine when code that is part of the same indentation level as the starting text should be included in the inferred block. You may define your own custom elements to modify the code to your preferred behaviour. In the default setting, else, elif, except, finally, as well as all closing braces are expanded on.

Known Issues

This is an early package so there are probably bugs.

  • Support for extending block upwards (i.e. if a decorator is on the previous line, include it in the current selection)

vscode-jupyter-python's People

Contributors

kylebarron avatar xclrr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.