{"id":12065,"date":"2017-05-12T10:50:58","date_gmt":"2017-05-12T17:50:58","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/?p=12065"},"modified":"2019-10-24T17:36:43","modified_gmt":"2019-10-25T00:36:43","slug":"a-lap-around-python-in-visual-studio-2017","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/a-lap-around-python-in-visual-studio-2017\/","title":{"rendered":"A Lap Around Python in Visual Studio 2017"},"content":{"rendered":"<p>We\u2019re delighted to announce that our rich Python toolchain is fully available in Visual Studio 2017. Installation of Python tools, interpreters, runtimes, and numerous other features are directly integrated into the <a target=\"_blank\" href=\"https:\/\/www.visualstudio.com\/downloads\/\" rel=\"noopener noreferrer\">Visual Studio 2017 installer<\/a>. Just select the <b>Python development<\/b> or <b>Data science and analytical applications<\/b> workloads, both of which let you select specific interpreters like Anaconda and also provide a variety of productivity features:<\/p>\n<ul>\n<li>Cookiecutter template support, so you can create projects from dozens of templates hosted on GitHub with a few clicks.<\/li>\n<li>Azure cloud service tools, including template to augment existing apps and create new ones that use the latest Azure services ranging from SQL Databases to Data Lake.<\/li>\n<li>Python native development tools to write high-performance C++ extensions for Python.<\/li>\n<li>Support for code cells and a Jupyter Notebook-like Ctrl+Enter cell execution experience.<\/li>\n<\/ul>\n<p>In addition, for the first time we\u2019ve localized Python tools into the same 14 languages as Visual Studio, making for a seamless experience across the entire IDE.<\/p>\n<h2>All the tools in one place<\/h2>\n<p>Let\u2019s take a deeper look into the <b>Python development <\/b>workload in Visual Studio 2017. (For more on the <b>Data science and analytical applications<\/b> workload, see Shahrokh Mortazavi\u2019s post, <a target=\"_blank\" href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2017\/05\/10\/build-intelligent-apps-faster-with-visual-studio\/\" rel=\"noopener noreferrer\">Build Intelligent Apps Faster with Visual Studio<\/a>. You can also find full documentation for the Python tools at <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/python-in-visual-studio\" rel=\"noopener noreferrer\">Working with Python in Visual Studio<\/a>.)<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Python_Workload.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Python Workload\" alt=\"Python Workload\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Python_Workload.png\" width=\"1024\" height=\"768\" \/><\/a><\/p>\n<p>When you select the Python development workload in the Visual Studio installer, either with a new install or <a target=\"_blank\" href=\"http:\/\/blogs.msdn.microsoft.com\/pythonengineering\/2017\/05\/10\/python-now-stable-in-vs-2017\/\" rel=\"noopener noreferrer\">modifying your existing installation<\/a>, you of course get core Python language support including <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/code-editing\" rel=\"noopener noreferrer\">IntelliSense<\/a>, <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/python-projects\" rel=\"noopener noreferrer\">projects<\/a>, <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/debugging\" rel=\"noopener noreferrer\">local and remote debugging<\/a>, <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/profiling\" rel=\"noopener noreferrer\">profiling<\/a>, <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/unit-testing\" rel=\"noopener noreferrer\">unit testing<\/a>, and an <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/interactive-repl\" rel=\"noopener noreferrer\">integrated REPL environment<\/a>. Then you can easily select a variety of options as shown on the right side of the installer, including interpreters and specific toolsets. Let\u2019s take a quick look at these.<\/p>\n<h3>Python web support<\/h3>\n<p>Do you work on Django, Flask, or Bottle apps in Python? Or perhaps another framework? By adding <b>Python web support<\/b>, you get <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/template-web\" rel=\"noopener noreferrer\">templates<\/a> for these languages and the Visual Studio HTML editor with JavaScript (and TypeScript) support. You will also be able to easily publish web sites to Azure through the integrated tools.<\/p>\n<h3>Python native development tools<\/h3>\n<p>The <b>Python native development tools<\/b> component includes everything you need to build C++ extension modules, or even <a target=\"_blank\" href=\"https:\/\/github.com\/python\/cpython\" rel=\"noopener noreferrer\">build CPython from source<\/a>. You will get C++ project support and templates, <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/debugging-mixed-mode\" rel=\"noopener noreferrer\">mixed-mode debugging<\/a>, as well as the latest compiler and the Visual C++ compiler required for compatibility with Python 3.5 and later. You can experience all this for yourself with our <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/cpp-and-python\" rel=\"noopener noreferrer\">Creating a C++ Extension for Python<\/a> walkthrough.<\/p>\n<h3>Python IoT support<\/h3>\n<p>The Python IoT support option includes tools needed for writing apps in Python for <a target=\"_blank\" href=\"https:\/\/developer.microsoft.com\/en-us\/windows\/iot\" rel=\"noopener noreferrer\">Windows IoT Core<\/a>. Note that you\u2019ll also need to download the <a target=\"_blank\" href=\"https:\/\/github.com\/ms-iot\/python\/releases\" rel=\"noopener noreferrer\">Python UWP SDK<\/a>, which is not available through the Visual Studio installer.<\/p>\n<h3>Python and Anaconda distributions<\/h3>\n<p>Although you can edit Python code quite comfortably without an interpreter, you always need to install a Python interpreter to run it. Previously, this was something you had to do separately from installing the Python tools in Visual Studio, but not for Visual Studio 2017 you can select from a variety of interpreters right in the installer. For example, if you\u2019re just getting started you can just use the Python 3.6 default. Alternately, if you know that you want to use Python 2.7, or want the scientific tools in an Anaconda distribution, those options are readily available as well. And if you already have Python installed, <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/python-environments\" rel=\"noopener noreferrer\">you can easily point Visual Studio to use that environment as well<\/a>.<\/p>\n<h3>Cookiecutter Template Support<\/h3>\n<p>Cookiecutter is a popular Open Source templating engine that lets experts easily create highly customizable templates to help other users get started on a project with customized boilerplate code. With Cookicutter integrated directly into Visual Studio, you can more quickly stand up apps, prototype experiences that integrate different services, and try out new frameworks.<\/p>\n<p>You can search, install, and generate projects from Cookiecutter templates within Visual Studio <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/visualstudio\/python\/cookiecutter\" rel=\"noopener noreferrer\">using the Cookiecutter Explorer tool<\/a>.\u00a0The community has created several web app templates for Django and Flask, and recently we have seen an increasing number of templates for data science and machine learning.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Cookiecutter1.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Jupyter Interactive\" alt=\"Jupyter Interactive\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Cookiecutter1.png\" width=\"394\" height=\"658\" class=\"\" \/><\/a><\/p>\n<p>Recommended templates make it easy for you to discover Azure templates. We have worked several Azure teams to provide rich templates spanning scenarios ranging from High Performance Computing (HPC) using Azure Batch and Data Lake Store to Internet of Things (IoT) with Azure IoT Hub to web development with Azure Web App. The tool also checks if updates are available for an installed templates and prompt accordingly.<\/p>\n<p>Template description and links to issues, and documentations are surfaced up front to help you navigate to the relevant material on Github faster. All searches are live, so you are getting the latest template information and code from Github.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Cookiecutter2.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Jupyter Interactive\" alt=\"Jupyter Interactive\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Cookiecutter2.png\" width=\"386\" height=\"630\" class=\"\" \/><\/a><\/p>\n<p>A form UI makes is simple to add context like database connection strings, subscription ID, and provide various config settings and preferences. The result is a project that\u2019s tailored to your context so you can get started on the business logic faster. Check out <a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/python\/2016\/11\/02\/creating-apps-from-templates-cookiecutter-in-visual-studio-15\/\" rel=\"noopener noreferrer\">our detailed post<\/a> for more details. Template developers can also provide helpful descriptors for each of their context variables in the cookiecutter.json file. These descriptions are shown as tooltips in Visual Studio tool.<\/p>\n<h3>Working with Jupyter Notebooks<\/h3>\n<p>Many developers spend much of their time in the Python REPL experience, and Python in Visual Studio 2017 makes it even more powerful with the ability to debug and profile Jupyter notebooks directly in the Visual Studio IDE.<\/p>\n<p>To work with a notebook, simply download your IPYNB file as a .py file and open it in Visual Studio. You\u2019ll see that markdown cells have been turned into comments and each cell is collapsible and expandable. To run a cell, click anywhere in the cell and press Ctrl+Enter, just like you do in notebooks, which runs the cell in the the Python interactive window.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-JupyterInteractive.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Jupyter Interactive\" alt=\"Jupyter Interactive\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-JupyterInteractive.png\" width=\"895\" height=\"641\" class=\"\" \/><\/a><\/p>\n<p>You can add code cells by marking them with #%% and create as many interactive windows as you like, with a different Python environment for each one. If you have the Anaconda distribution installed, and you have been working on an online notebook service like Azure Notebooks, you may be able to run your code without installing any additional package by simply selecting Anaconda as your REPL environment.<\/p>\n<h3>Localization<\/h3>\n<p>For the first time, Python support for Visual Studio is available in all 14 languages that Visual Studio itself supports.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Localization1.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Localization\" alt=\"Localization\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-Localization1.png\" width=\"680\" height=\"383\" class=\"\" \/><\/a><\/p>\n<p>Choose the language packs you wish to install using the Visual Studio installer, and switch to your language of choice across the entire IDE, including the Python tools, by using <b>Tools &gt; Options &gt; Environment &gt; International Settings<\/b> in Visual Studio.<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-LanguagePacks.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Language Packs \" alt=\"Language Packs \" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-LanguagePacks.png\" width=\"680\" height=\"510\" class=\"\" \/><\/a><\/p>\n<p><a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-LanguageOptions.png\" rel=\"noopener noreferrer\"><img decoding=\"async\" title=\"Language Options\" alt=\"Language Options\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/BUILD2017-Python-Usman-LanguageOptions.png\" width=\"681\" height=\"459\" class=\"\" \/><\/a><\/p>\n<h2>Looking Ahead<\/h2>\n<p>With localization of the Python tools complete, we\u2019ll now be focusing on making our tools accessible over the next few months with better keyword navigation, high contrast support, and narrator friendliness. Some of these improvements have already made their way into the current release. We\u2019re also improving Azure App Service deployment and designing features for data scientists who might desire more overlap between Python and R tools. We\u2019d also love to hear what features are important to you! Let us know by filling or upvoting a <a target=\"_blank\" href=\"https:\/\/github.com\/Microsoft\/PTVS\/issues\" rel=\"noopener noreferrer\">Github issue<\/a>. For more frequent updates on our future progress, check out the <a target=\"_blank\" href=\"https:\/\/devblogs.microsoft.com\/python\/\" rel=\"noopener noreferrer\">Microsoft Python Engineering blog<\/a>.<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"600\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"150\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Usman-Anwer.jpg\" width=\"321\" height=\"321\" \/><\/td>\n<td valign=\"top\" width=\"600\"><strong>Usman Anwer<\/strong>, Program Manager II, Data Science Tools\n<a target=\"_blank\" href=\"https:\/\/twitter.com\/uanwer\" rel=\"noopener noreferrer\">@uanwer<\/a><\/p>\n<p>Usman works on Python and R Tools for Visual Studio and the Azure Python SDK. Previously, he was on the Developer Ecosystem and Platform team in Windows and Devices Group, where he worked on the Universal Windows Platform (UWP), UWP on Xbox, Windows 10 Bridge for Desktop Apps, and putting open source software in Windows.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019re delighted to announce that our rich Python toolchain is fully available in Visual Studio 2017. Installation of Python tools, interpreters, runtimes, and numerous other features are directly integrated into the Visual Studio 2017 installer. Just select the Python development or Data science and analytical applications workloads, both of which let you select specific interpreters [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1085,1030,1196,472,4980,561,155,1029],"tags":[237,242,1383,9,137,376,124,1054,172,585,357,125,182,156],"class_list":["post-12065","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-data","category-desktop","category-gaming","category-java","category-open-source","category-visual-studio","category-web","tag-net","tag-azure","tag-c","tag-debug","tag-html","tag-java","tag-javascript","tag-ml","tag-python","tag-r","tag-sql","tag-typescript","tag-unity","tag-visual-studio-2017"],"acf":[],"blog_post_summary":"<p>We\u2019re delighted to announce that our rich Python toolchain is fully available in Visual Studio 2017. Installation of Python tools, interpreters, runtimes, and numerous other features are directly integrated into the Visual Studio 2017 installer. Just select the Python development or Data science and analytical applications workloads, both of which let you select specific interpreters [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/12065","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=12065"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/12065\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=12065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=12065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=12065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}