Introducing Python and Jupyter Notebooks Support in Microsoft Teams

Posted by

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Python is the fastest-growing language in popularity and is increasingly used in education for a variety of fields such as data science, mathematics, physics, and statistics. Jupyter Notebooks, interactive documents that comprise code, rich-text, and visualizations, are widely used and loved by data scientists and machine learning practitioners.


Today we are excited to announce the native integration of both Python and Jupyter files into the Teams Education edition. Educators will now be able to assign, view, edit, and run Python files (.py) and Python Notebooks (.ipynb) directly in Assignments in Teams for Education.

View, edit, and run Jupyter Notebooks in Teams EducationView, edit, and run Jupyter Notebooks in Teams Education

 

View, edit, and run Python files in Teams EducationView, edit, and run Python files in Teams Education

 

 

Notebooks and Python support in Assignments in Teams Education

As an educator, you can now upload notebooks and Python scripts as reference material or distribute them to students, which can then be submitted for grading. The new support means that these file types can now be rendered and viewed directly in Teams. The process has also been streamlined so that there is no setup required to edit and run code. It’s as simple as opening the notebook file and clicking “Start Jupyter kernel” in the ribbon that appears.

Picture23.gif

 

The entire process from distributing the assignment, completing it, turning it in, and grading it can be facilitated from Teams without ever needing to set up a separate coding environment.

In addition to the fundamental code running capabilities in Teams, a variety of enhanced features were introduced to improve the coding process. These features include:

  • Intellisense Autocompletions
    A panel of autocompletion suggestions will appear as users code. Use Tab or Enter to select from the given list. In addition, Intellisense also comes with best in class intellicode, a context aware code completion tool.
  • Variable Explorer
    Any active variables will be displayed in the Variable Explorer panel, providing details on the variable type, size, and value.
  • Table of Contents (notebook only)
    Denoted by the Markdown headers, the Table of Contents can be used to provide an outline of the document.
  • Comments (notebook only)

Leaves notes-to-self as you code. Or alternatively as an instructor, leave comments directly on code segments when grading and providing feedback.

Intellicode and Intellisense support in python and notebook filesIntellicode and Intellisense support in python and notebook files

 

How to work with Notebooks and Python files in Teams Assignments

Creating an assignment

To create an assignment using notebooks, follow the normal Create Flow here: Create an assignment in Microsoft Teams. Add an existing .py (python) file or .ipynb (Jupyter notebook) file from your OneDrive or local machine to the attachment section.

 

Changing the compute resource

By default, you will be connected to the in-browser compute called . Pyolite will allow you to run all your code in the browser without any additional setup. When using Pyolite for the first time, there will be a prompt to remind you that Pyolite loads python modules from a third-party site. Please see their documentation for additional information.

Changing the compute resource.png

If you prefer using a non-browser compute (e.g., a local or remote Jupyter server), you can do so from the Runtime tab in the toolbar. Connecting to a local or remote will give you full control of your code execution environment (e.g. fine grain package management), but of course, introduces additional complexity. To do so, follow these instructions:

  1. In the Runtime tab of the python file/notebook in Teams, select the compute dropdown that contains “In-browser”, and click “Add”.
  2. Next, use your compute and start a Jupyter server instance, copy both the URL (e.g. http://localhost:8888/) and the token. If you need help with installing, starting a Jupyter server, or configuring it to meet the security requirements of your organization please work with your IT department and consult the Jupyter Org’s documentation regarding configuring Jupyter servers.
  3. Switch back to Teams and enter both the URL of the Jupyter server and the Jupyter authentication information into the Add compute. Click Add.
  4. You are now connected to your Jupyter compute and can run the file or notebook cells.

File safety

When you first open a notebook or a Python file using Teams, you will see a prompt about trust. Since some files could be harmful, please only open files in trusted mode when you know the content is safe. Otherwise, you can open the files in restricted mode, which still allows you to view and comment on the files. You can change your trust decision using the File tab of the toolbar.

File Safety.png

 

Feedback

Give the Jupyter notebook and python support in Teams a try and let us know what you think. If you have any questions or feedback, please let us know your thoughts in this feedback forum!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.