Giter VIP home page Giter VIP logo

microsoft / vscode-jupyter Goto Github PK

View Code? Open in Web Editor NEW
1.2K 42.0 265.0 171.05 MB

VS Code Jupyter extension

Home Page: https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter

License: MIT License

Dockerfile 0.10% Shell 0.98% JavaScript 1.34% Python 21.89% Jupyter Notebook 6.35% TypeScript 68.26% CSS 0.49% HTML 0.45% Less 0.13% Batchfile 0.01% Roff 0.01%
jupyter vscode vscode-extension datascience machine-learning

vscode-jupyter's Introduction

Jupyter Extension for Visual Studio Code

A Visual Studio Code extension that provides basic notebook support for language kernels that are supported in Jupyter Notebooks today, and allows any Python environment to be used as a Jupyter kernel. This is NOT a Jupyter kernel--you must have Python environment in which you've installed the Jupyter package, though many language kernels will work with no modification. To enable advanced features, modifications may be needed in the VS Code language extensions.

NotebookUI

Link Description
File an issue Report problems and suggest enhancements
Go to docs Jupyter extension and data science in VS Code documentation, tutorials, and more
Discussions Post questions, and engage in community discussions

Work in the browser

Editing Jupyter notebooks in VS Code can also be done on the browser in two ways.

  1. The Jupyter extension has support for a web based interface provided by vscode.dev (which includes github.dev, available by typing '.' when viewing a repo on github.com)
  2. The Jupyter extension can be installed on VS Code in GitHub Codespaces the same way it is done locally (or sync your VS Code settings to have your extensions installed automatically on Codespaces).

Installed extensions

The Jupyter Extension will automatically install the following extensions by default to provide enhanced Jupyter notebook experiences in VS Code.

You can also install the Jupyter PowerToys extension to try out experimental features (not installed by default). Extensions installed through the marketplace are subject to the Marketplace Terms of Use, and any or all of these extensions can be disabled or uninstalled.

Working with Python

Quick Start

  • Step 1. Install VS Code
  • Step 2. Install Anaconda/Miniconda or another Python environment in which you've installed the Jupyter package
  • Since not working with Python, make sure to have a Jupyter Kernel that corresponds to the language you would like to use installed on your machine.
  • Step 3. Install the Jupyter Extension and the Python Extension
  • Step 4. Open or create a notebook file by opening the Command Palette (Ctrl+Shift+P) and select Jupyter: Create New Jupyter Notebook.
  • Step 5. Select your kernel by clicking on the kernel picker in the top right of the notebook or by invoking the Notebook: Select Notebook Kernel command and start coding!

Working with other Languages

The Jupyter Extension supports other languages in addition to Python such as Julia, R, and C#.

Quick Start

  • Step 1. Install VS Code
  • Step 2. Since not working with Python, make sure to have a Jupyter kernelspec that corresponds to the language you would like to use installed on your machine.
  • Step 3. Install the Jupyter Extension
  • Step 4. Open or create a notebook file and start coding!

Notebook support

The Jupyter Extension uses the built-in notebook support from VS Code. This UI gives a number of advantages to users of notebooks:

  • Out of the box support for VS Code's vast array of basic code editing features like hot exit, find & replace, and code folding.
  • Editor extensions like VIM, bracket colorization, linters and many more are available while editing a cell.
  • Deep integration with general workbench and file-based features in VS Code like outline view (Table of Contents), breadcrumbs and other operations.
  • Fast load times for Jupyter notebook (.ipynb) files. Any notebook file is loaded and rendered as quickly as possible, while execution-related operations are initialized behind the scenes.
  • Includes a notebook-friendly diff tool, making it much easier to compare and see differences between code cells, output and metadata.
  • Extensibility beyond what the Jupyter extension provides. Extensions can now add their own language or runtime-specific take on notebooks, such as the .NET Interactive Notebooks and Gather
  • While the Jupyter extension comes packaged with a large set of the most commonly used renderers for output, the marketplace supports custom installable renderers to make working with your notebooks even more productive. To get started writing your own, see VS Code's renderer api documentation.

Useful commands

Open the Command Palette (Command+Shift+P on macOS and Ctrl+Shift+P on Windows/Linux) and type in one of the following commands:

Command Description
Jupyter: Create New Jupyter Notebook Creates a new Jupyter Notebook
Notebook: Select Notebook Kernel Select or switch kernels within your notebook
Notebook: Change Cell Language Change the language of the cell currently in focus
Jupyter: Export to HTML Jupyter: Export to PDF Create a presentation-friendly version of your notebook in HTML or PDF

To see all available Jupyter Notebook commands, open the Command Palette and type Jupyter or Notebook.

Context Keys for Key bindings

You can use the extension's context keys in 'when' clauses. Here's an example:

  {
    "key": "ctrl+i",
    "command": "jupyter.runAndDebugCell",
    "when": "!jupyter.webExtension"
  }

That keybinding states the jupyter.runAndDebugCell command should map to CTRL+I when not in the jupyter.webExtension.

The full list of context keys can be found here: https://github.com/microsoft/vscode-jupyter/wiki/Extensibility-for-other-extensions#context-keys-for-keybindings

Feature details

Learn more about the rich features of the Jupyter extension:

  • IntelliSense: Edit your code with auto-completion, code navigation, syntax checking and more.

  • Jupyter Notebooks: Create and edit Jupyter Notebooks, add and run code/markdown cells, render plots, create presentation-friendly versions of your notebook by exporting to HTML or PDF and more.

Supported locales

The extension is available in multiple languages: de, en, es, fa, fr, it, ja, ko-kr, nl, pl, pt-br, ru, tr, zh-cn, zh-tw

Questions, issues, feature requests, and contributions

  • If you have a question about how to accomplish something with the extension, please ask on Discussions. Our wiki can be a source of information as well.

  • Any and all feedback is appreciated and welcome! If you come across a problem or bug with the extension, please file an issue.

    • If someone has already filed an issue that encompasses your feedback, please leave a ๐Ÿ‘/๐Ÿ‘Ž reaction on the issue.
  • Contributions are always welcome, so please see our contributing guide for more details.

  • If you're interested in the development of the extension, you can read about our development process

Data and telemetry

The Microsoft Jupyter Extension for Visual Studio Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. This extension respects the telemetry.telemetryLevel setting which you can learn more about at https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

vscode-jupyter's People

Contributors

amunger avatar archmoj avatar brettcannon avatar d3r3kk avatar dependabot[bot] avatar donjayamanne avatar ericsnowcurrently avatar gandhis1 avatar greazer avatar heejaechang avatar ianmatthewhuff avatar int19h avatar jabooth avatar jakebailey avatar janosh avatar joyceerhl avatar karthiknadig avatar kimadeline avatar lramos15 avatar luabud avatar minsa110 avatar peterjclaw avatar rchiodo avatar rebornix avatar roblourens avatar sadasant avatar techwithtim avatar tyriar avatar vandyliu avatar yoyokrazy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-jupyter's Issues

Tolerance of ipython cell magics in source code cells

Environment data

  • VS Code version: 1.27.1
  • Extension version: 2018.8.0
  • OS and version: macOS 10.14
  • Python version: Anaconda Python 3.6
  • Type of virtual environment used: conda
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

When using a python file as a makeshift Jupyter notebook (with use of the VSCode Jupyter extension), valid ipython kernel code is flagged as invalid by the Python parser. For instance, cell magics, which begin with one or two percent signs, are flagged as syntax errors

Expected behavior

The parser should ignore valid ipython cell magic syntax; flagging these as problems just adds noise. A good solution might be to have the Python extension have its own internal Jupyter flag, which when enabled would understand that ipython cell magics are syntactically correct, but when disabled would treat the file as vanilla Python for the purpose of checking syntax.

Steps to reproduce:

Write e.g., %matplotlib inline at the top of the file.

Python Interactive window does not use the python associated with the current file when starting

Currently we aren't passing the resource: Uri value into most methods.
This would result in various parts of the extension not working correctly in a multi-root environment (current code will pick settings from first available workspace folder).

Examples:

This only applies to multi-root environments.

DSBugBash: Support magic commands

Actual behavior

Magic commands are not valid python commands, hence magic commands in the python file end up with red squigglys (marked as invalid syntax from Language Server).

Expected behavior

Add support for magic commands without noise in problems panel

DSBugBash: Handling non existence of Jupyter

Actual behavior

When running a cell in python:

  • Interactive window opens up
  • Error message display about Jupyter not being installed

Expected behavior

  • Do not display interactive window
  • Display a better message with:
    • Descriptive error message
    • Ability to get more information (someone starting with VSC+Jupyter wouldn't know what to do - propbably a link to a page)

We'd probably want to capture telemetry on how many people tried this and didn't have Jupyter installed (so we can improve the getting started experience).

DSBugBash: Support for Code Cell Titles

Create a cell as follows:

#%% Wow
import sys
print(sys.executable)

I would expect the cell in the interative window to have a title of Wow.
Right now it displays the cell with the comments.

Currently we have the text #%% ... being displayed in the interactive window, only when there's text after #%%.
screen shot 2018-11-02 at 10 14 04 am

Data Explorer / Variables Pane

Are there plans to support a data explorer, or variables view where one would execute a command and have the ability to explore the variable or at least get some informations about the variable (type, min, max...etc). Similar to how Rstudio/Pycharm has.
if theres a manual solution like custom tree views via extension API i will be happy to try it.

enabling ctrl+enter to execute current line in .py script and moving cursor to next line

Environment data

VS Code version: 1.19.1
Python Extension version: 0.9.1
Python Version: 3.6.2 anaconda
OS and version: win10 version 1709 (build 17025.1000)

Actual behavior

ctrl+enter does nothing

Expected behavior

ctrl+enter executes "Run Selection/Line in Python Terminal" [ / python.execSelectionInTerminal ] context menu option and indexes cursor in editor to next line, i.e. like behavior with vscode R extension environment and with vs17 ide python script support.

Steps to reproduce:

  • open .py file in vscode
  • place cursor on a line of script
  • enter "ctrl+enter"

Logs

Output from Python output panel

Output from Console window (Help->Developer Tools menu)

Python Interactive colorization misses stuff

We're using prismjs to do colorization. This isn't as robust as textmate

Case in point,

On the left textmate is identifying import as keyword.control. On the right prism doesn't even have that in its grammar.

The solution would probably be:
Use https://www.npmjs.com/package/vscode-textmate to tokenize the source before we send it to react
Use our current solution to load the json files with the colors and turn them into a css
Expand this css to have colors for every token
Change the react code to turn the code into tokenized html.

Alternatively might use this:
https://www.npmjs.com/package/@uiw/react-codemirror

Then just give it the appropriate css files. That's what Jupyter uses.

Double cells being output

Open folder
Add python file
Add cells
Run cells
Close folder
Reopen
Run cells

Double cells end up being output

Data science features do not correctly pick up the Conda scripts path

Environment data

  • VS Code version: Development
  • Extension version (available under the Extensions sidebar): Development
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Anaconda
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions:

Actual behavior

If VSCode is not launched from an Anaconda prompt with the Scripts directory in the path then it will fail to start jupyter server.

Expected behavior

We should be able to start Jupyter server without starting code from an Anaconda command prompt.

Steps to reproduce:

  1. Start VSCode from the taskbar or plain prompt
  2. Attempt to run a code cell in jupyter
  3. Jupyter not installed message pops up.

Logs

Output for Python in the Output panel (Viewโ†’Output, change the drop-down the upper-right of the Output panel to Python)

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

DSBugBash: Keyboard focus issues can cause problems

Actual behavior

Using keyboard to selecting the command Import Jupyter Notebook was displaying a Save Dialog.

Steps to reproduce:

  • On the Interactive Window click the Save icon
  • Using keyboard hit the esc key
  • Using keyboard open the command palette and select Import Jupyter Notebook
  • Hit the Enter key on keyboard
  • You now get the Save Dialog

Cause - Save icon in Interactive Window still has focus.

DSBugBash: Empty section in VSC after reloading

  • Run cell and wait for Interactive Widow to appear
  • Reload VSC
  • We now have an empty section where Interactive Window appeared

We should either not take up this space or display the Interactive Window with previous sessions results or other.

DSBugBash: UX updates in the "Python interactive" window top bar

  1. The height of the bar should match other VS Code tool windows (e.g. Output window)
  2. The space b/w the icons should also match other VS Code windows
  3. The icon colors need to be consistent (i'll check with Cherry)
  4. Don't change the icon color on mouse hover.
  5. Order of the icons (from left to right): Expand all, Collapse all, Restart kernel, SaveAs, Redo, Undo, Clear
  6. Tooltip for each icon:
    -- Expand all: Expand all cells
    -- Collapse all: Hide input on all cells
    -- Restart kernel: Restart Jupyter kernel
    -- SaveAs: Save the results into a Jupyter Notebook file
    -- Redo: Redo the last operation
    -- Undo: Undo the last operation
    -- Clear: Clear all the content

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.