{"id":503,"date":"2016-03-29T09:00:45","date_gmt":"2016-03-29T17:00:45","guid":{"rendered":"http:\/\/blogs.msdn.microsoft.com\/pythonengineering\/?p=503"},"modified":"2019-02-17T15:27:10","modified_gmt":"2019-02-17T22:27:10","slug":"azure-python-sdk-2-0-0-is-out","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/python\/azure-python-sdk-2-0-0-is-out\/","title":{"rendered":"Azure Python SDK 2.0.0rc2 is out! Why it&#8217;s a major step for Azure with Python."},"content":{"rendered":"<p>My name is Laurent and I recently moved from France to join the Python team at Microsoft. Along with the rest of our team, I am responsible for maintaining the Azure Python SDK, and we are glad to announce the 2.0.0 RC2 version! This is a major step for Python on\u00a0Azure and the product of several teams collaborating in Microsoft to establish a solid foundation for the future of the Python SDK. This post will give you an idea of what you can expect of this release.<\/p>\n<p><strong>Once upon a time<\/strong><\/p>\n<p>Let&#8217;s go back in the past, when the <a href=\"https:\/\/pypi.python.org\/pypi\/azure\/0.11.1\" target=\"_blank\" rel=\"noopener\">0.x versions<\/a> of\u00a0the\u00a0Azure Python SDK were released using the\u00a0<a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/introducing-the-windows-azure-service-management-api\/\" target=\"_blank\" rel=\"noopener\">Azure Service Management<\/a>\u00a0API (a.k.a. ASM). This Python SDK was written by hand against each Azure service. Moreover, ASM was not strict on the URL\u00a0and answer format of the REST API. For instance, some services handled only JSON, some others XML or Atom\/XML format. It was very difficult to work in this situation to be able to scale the SDK as fast as Azure grew up. Because of these issues you needed to use C# to be on the edge of the latest Azure features.<\/p>\n<p>The new <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/resource-group-overview\/\" target=\"_blank\" rel=\"noopener\">Azure Resource Management<\/a> (a.k.a ARM) REST API is built over a more common approach for each Azure service. Each service is\u00a0associated with a <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/resource-manager-supported-services\/\" target=\"_blank\" rel=\"noopener\">provider<\/a> and you can group several service components into a resource group. This also allows you to <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/resource-group-template-deploy\/\" target=\"_blank\" rel=\"noopener\">deploy any service using a JSON template<\/a>. And since this internally uses the same REST APIs, every new service has automatic template support. The <a href=\"https:\/\/github.com\/Azure\/azure-quickstart-templates\" target=\"_blank\" rel=\"noopener\">ARM template website<\/a> is a gold mine for every Azure addict.<\/p>\n<p>Since ARM is a common framework, which comes with a stronger model &#8212; URL patterns and HTTP responses are more consistent\u00a0than ASM &#8212; it&#8217;s now possible to describe a meta-model of each service REST API, and then use this meta-model to generate the SDK. The first attempt gave the <a href=\"https:\/\/pypi.python.org\/pypi\/azure\/1.0.3\">Azure Python SDK 1.x series<\/a>, but it was not powerful enough and was abandoned.<\/p>\n<p>From this first experiment, we learned and chose to use the <a href=\"http:\/\/swagger.io\/\">Swagger format<\/a> to describe <a href=\"https:\/\/github.com\/Azure\/azure-rest-api-specs\">all our REST API models<\/a>. We also decided, at Microsoft, to create our own Swagger based code generator, called <a href=\"https:\/\/www.nuget.org\/packages\/autorest\/\">Autorest<\/a>, to have the flexibility we wanted to provide the best SDK for our users. Obviously Autorest is Open Source!<\/p>\n<p>The really important point here is that now, <strong>every <\/strong>SDK (even C#) will use the generator to build their SDK. Autorest is indeed capable of generation of C#, Python, Java, Ruby, NodeJS and soon PHP.\u00a0Autorest is available in Visual Studio (as a reminder, don&#8217;t forget that <a href=\"https:\/\/aka.ms\/ptvs\" target=\"_blank\" rel=\"noopener\">Visual Studio is Python friendly<\/a>) or\u00a0can be run easily on <a href=\"http:\/\/www.mono-project.com\/docs\/getting-started\/install\/linux\/\" target=\"_blank\" rel=\"noopener\">Linux using Mono<\/a>.<\/p>\n<p><strong>What about Python specifically?<\/strong><\/p>\n<p>The Azure Python SDK 2.0.0 RC2 is the first Python release from Autorest. It provides supports for<\/p>\n<ul>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementauthorization.html\" target=\"_blank\" rel=\"noopener\"><em>Authorization Resource Management<\/em><\/a>\u00a0: permissions, subscriptions, roles and more<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementcdn.html\" target=\"_blank\" rel=\"noopener\"><em>CDN Resource Management<\/em><\/a>\u00a0:\u00a0profiles, endpoints creation and more<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementcomputenetwork.html\" target=\"_blank\" rel=\"noopener\"><em>Compute Resource Management<\/em><\/a>\u00a0: virtual machines, availability sets and more<\/li>\n<li>Apps:\n<ul>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementapps.html\" target=\"_blank\" rel=\"noopener\"><em>Logic Apps Resource Management<\/em><\/a>\u00a0: workflow and job management<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementapps.html\" target=\"_blank\" rel=\"noopener\"><em>Web Apps Management<\/em><\/a>\u00a0:\u00a0App Service Plan, web sites, certificate, domains and more<\/li>\n<\/ul>\n<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementcomputenetwork.html\" target=\"_blank\" rel=\"noopener\"><em>Network Resource Management<\/em><\/a>\u00a0: Application Gateways, Express route, Load balancers, virtual networks, public ip, subnets and more<\/li>\n<li><em><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementnotificationhubs.html\" target=\"_blank\" rel=\"noopener\">Notification Hubs Resource Management<\/a>\u00a0:\u00a0<\/em>Namespaces, hub creation\/deletion and more<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementredis.html\" target=\"_blank\" rel=\"noopener\"><em>Redis Cache Resource Management<\/em><\/a>\u00a0:\u00a0create cache and more<\/li>\n<li><em><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagement.html\" target=\"_blank\" rel=\"noopener\">Resource Management<\/a>\u00a0is separated in four clients:<\/em>\n<ul>\n<li>resources : create resource groups, register providers, do deployments and more<\/li>\n<li>features : manage features of provider and more<\/li>\n<li>locks : manage resource group lock and more<\/li>\n<li>subscriptions : manage subscriptions and more<\/li>\n<\/ul>\n<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementscheduler.html\" target=\"_blank\" rel=\"noopener\"><em>Scheduler Management<\/em><\/a>\u00a0:\u00a0create job collections, create job and more<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/resourcemanagementstorage.html\" target=\"_blank\" rel=\"noopener\"><em>Storage Resource Management<\/em><\/a>\u00a0:\u00a0create storage accounts, list keys, and more<\/li>\n<li><a class=\"reference internal\" href=\"https:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/graphrbac.html\" target=\"_blank\" rel=\"noopener\"><em>Azure Active Directory Graph RBAC<\/em><\/a>\u00a0: manage users, applications and more<\/li>\n<\/ul>\n<p>You can found it as usual on <a href=\"https:\/\/pypi.python.org\/pypi\/azure\/\" target=\"_blank\" rel=\"noopener\">PyPI<\/a>, compatible with Python 3.5, 3.4, 3.3 and 2.7. You can install the whole azure meta-package or directly one specific service (i.e. <a href=\"https:\/\/pypi.python.org\/pypi\/azure-mgmt-compute\/\" target=\"_blank\" rel=\"noopener\">azure-mgmt-compute<\/a>).<\/p>\n<p>We have some\u00a0examples on how to use the SDK in our <a href=\"http:\/\/azure-sdk-for-python.readthedocs.org\/en\/latest\/index.html\" target=\"_blank\" rel=\"noopener\">ReadTheDocs website<\/a>.<\/p>\n<p><strong>Roadmap<\/strong><\/p>\n<p>First of all, the version is tagged as a Release Candidate. Why is that? Because in our team we care about quality of the product we ship. We trust in unit testing, <a href=\"https:\/\/travis-ci.org\/Azure\/azure-sdk-for-python\" target=\"_blank\" rel=\"noopener\">continuous integration<\/a> and <a href=\"https:\/\/coveralls.io\/github\/Azure\/azure-sdk-for-python\" target=\"_blank\" rel=\"noopener\">coverage report<\/a>. And we did not achieve the level of testing we estimate necessary to tag this SDK\u00a0as stable. We will tag it as stable &#8220;when it&#8217;s ready&#8221;. Quality over quantity.<\/p>\n<p>What kind of improvements can you expect for the SDK? Direct improvements follow two axes:<\/p>\n<ol>\n<li>Autorest enhancement. Each simple new enhancement in the Autorest software can be provided to every service client in the SDK at the same time. One of the key feature that interests us is <a href=\"http:\/\/www.snarky.ca\/how-the-heck-does-async-await-work-in-python-3-5\" target=\"_blank\" rel=\"noopener\">Python 3.5 async\/await<\/a> which is perfectly suitable for a cloud SDK.\u00a0We also want to try to find the right balance between homogeneity between the others language SDK and the Pythonic way to write code,\u00a0so that it feels natural to Python developers.<\/li>\n<li>Swagger files enhancement. Each team works in parallel in their service Swagger files. Some service which are not available now will be available soon since they are currently in progress (<a href=\"https:\/\/github.com\/azure\/\" target=\"_blank\" rel=\"noopener\">DNS<\/a>, <a href=\"https:\/\/github.com\/azure\/\" target=\"_blank\" rel=\"noopener\">Datalake<\/a>\u00a0or <a href=\"https:\/\/github.com\/azure\/\" target=\"_blank\" rel=\"noopener\">Search<\/a>). This is also the central way for all language to ask for new service coverage (<a href=\"https:\/\/github.com\/Azure\/azure-rest-api-specs\/issues\/67\" target=\"_blank\" rel=\"noopener\">KeyVault<\/a>, <a href=\"https:\/\/github.com\/Azure\/azure-rest-api-specs\/issues\/175\" target=\"_blank\" rel=\"noopener\">SQL Management<\/a>,&#8230;)<\/li>\n<\/ol>\n<p>There is currently no specific dated roadmap for Autorest new features. For the Swagger part, we would like to publish any new library as soon as we think that the Swagger file is at least functional as a preview version. Please feel free to ask for new features on <a href=\"https:\/\/github.com\/Azure\/azure-sdk-for-python\/issues\" target=\"_blank\" rel=\"noopener\">our issue tracker<\/a> (we will dispatch to the Autorest tracker as necessary) and to check\/ask for new Azure service in the <a href=\"https:\/\/github.com\/Azure\/azure-rest-api-specs\" target=\"_blank\" rel=\"noopener\">Swagger repo<\/a>.<\/p>\n<p>In addition, we are\u00a0currently working on the automation process from the Swagger files to the SDK code. This would allow everyone who wants to contribute to <em>every SDK at the same time<\/em> to:<\/p>\n<ul>\n<li>Do a fork of the Swagger repo and a fork of the Python repo (or any other language you are interested in to test).<\/li>\n<li>Commit a Swagger modification, and (using <a href=\"https:\/\/travis-ci.org\/\" target=\"_blank\" rel=\"noopener\">Travis<\/a>) the Python code will be automatically generated in a new branch in your SDK fork for you to test<\/li>\n<li>Submit a PR to the Swagger repo<\/li>\n<li>Et voil\u00e0!<\/li>\n<\/ul>\n<p>Follow our blog for a detailed post about how to use this automation yourself soon!<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>With Azure Python SDK 2.0.0 generation, we provide a solid foundation based on the well-established Swagger format and a strong investment in the Autorest tool to scale the Python SDK over each Azure services. This provides:<\/p>\n<ul>\n<li>More consistency between the services<\/li>\n<li>Faster releases and updates once a new service is created to get the SDK<\/li>\n<li>An easy way to contribute to not only Python but all SDK (writing Swagger files)<\/li>\n<\/ul>\n<p>And don&#8217;t forget, Microsoft Build is on this week in San Francisco, and we will be there with a booth and some talks. Come say hi! We\u2019d love to meet you and hear how you&#8217;re using Python.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My name is Laurent and I recently moved from France to join the Python team at Microsoft. Along with the rest of our team, I am responsible for maintaining the Azure Python SDK, and we are glad to announce the 2.0.0 RC2 version! This is a major step for Python on\u00a0Azure and the product of [&hellip;]<\/p>\n","protected":false},"author":812,"featured_media":10119,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-503","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure"],"acf":[],"blog_post_summary":"<p>My name is Laurent and I recently moved from France to join the Python team at Microsoft. Along with the rest of our team, I am responsible for maintaining the Azure Python SDK, and we are glad to announce the 2.0.0 RC2 version! This is a major step for Python on\u00a0Azure and the product of [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/users\/812"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/comments?post=503"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/posts\/503\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media\/10119"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/media?parent=503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/categories?post=503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/python\/wp-json\/wp\/v2\/tags?post=503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}