I’m very excited to talk about Python on Windows, which has enjoyed a resurgence at Microsoft over the past couple of years, culminating in the release of Python Tools for Visual Studio and Python on Windows Azure. Let’s dive in to see what we have. But first, a little background…
What is Python & Who Uses It?
Python is a modern, easy to use, concise language that has become an indispensable tool in the modern developer’s arsenal. It’s consistently been in the top 10 TIOBE index, and has become the CS101 language at many universities. But partly due to its vast and deep suite of libraries, it also spans the CS PhD and Mission Critical app zip codes as well. Who exactly uses Python these days? Here’s a snapshot; these names represent some of the highest trafficked sites and popular desktop and networked applications.
Python is also pretty popular. Here are the results of a popularity poll Hacker News recently ran:
Another key aspect of the language is that it’s cross-platform. In fact we had to do very little to get the Python Windows Azure Client Libraries to work on MacOS and Linux.
Python on Windows Azure
In our initial offering, Python on Windows Azure provides the following:
- Python Client Libraries
- Django & Cloud Services
- Visual Studio Integration for Python /Azure
- Python on Windows or Linux VM’s
Python Client Libraries – The Client Libraries are a set of Pythonic, OS independent wrappers for the Windows Azure Services, such as Storage, Queues, etc. You can use them on Mac or Linux machines as well, locally or on VM’s to tap in to Windows Azure vast computation and storage services:
Upload to blob:
myblob = open(r’task1.txt’, ‘r’).read()
blob_service.put_blob(‘mycontainer’, ‘myblob’, myblob, x_ms_blob_type=‘BlockBlob’)
List the blobs:
blobs = blob_service.list_blobs(‘mycontainer’)
for blob in blobs:
blob = blob_service.get_blob(‘mycontainer’, ‘myblob’)
with open(r‘out-task1.txt’, ‘w‘) as f:
Django – For web work, we’ve provided support for Django initially – this includes server side support via IIS and deployment via Python Tools for Visual Studio (PTVS). On Windows you can use WebPI to install everything you need (Python, Django, PTVS, etc.) and be up and running with your 1st website in 15 minutes. Once deployed, you can use Windows Azure’s scalability and region support to manage complex sites efficiently:
Preparing the app for deployment to Windows Azure in PTVS:
Python Tools for Visual Studio – There are a number of good IDE’s, including web-based ones for writing Python. We’re a bit biased toward PTVS, which is a free and OSS (Apache license) plug-in for Visual Studio. If you’re already a VS user, it’s just a quick install. If you’re not, you can install the Integrated Shell + PTVS to get going – this combo gives you a free “Python Express” essentially. The key features of PTVS are:
- Support for CPython, IronPython
- Local & remote Debugging
- Integrated REPL with inline graphics
- Object Browser
- Parallel Computing
This video provides a quick overview of basic Editing features of PTVS.
Debugging Django templates:
Intellisense support for Django templates:
Check out this video to get a feel for deploying a Django site on Windows Azure (Cloud Service mode). You can also deploy from a Mac/Linux machine into a Linux VM.
PTVS also has advanced features such as high-performance computing (including debugging MPI code), which we’ll enable on Windows Azure in the future.
IPython – We’re also very excited about IPython notebook, which is a web-based general purpose IDE for developing Python, and more importantly, prototyping “ideas”. You can run the notebook on any modern browser that supports websockets (Chrome, Safari, IE10 soon, …) and the “Engine” itself runs on Windows Azure in a VM (Linux or Windows):
This powerful paradigm means instant access to the vast and deep Python ecosystem in a highly productive environment, backed by solid availability and scalability of Windows Azure. Whether you’re a modeler, teacher or researcher, this opens up a whole set of new possibilities, especially with prototyping, sharing and collaboration. And best of all, no installs! Check out this video of IPython, which describes some of its features.
Summary & Roadmap
As you can see, there’s a lot to like about Python on Windows Azure:
- It’s a great language, with awesome libraries and a very active community of developers, estimated to be around ~1.5 million
- Django & Flask are robust web frameworks with excellent Windows support
- PTVS with Windows Azure support turns VS into a world-class Python IDE & best of all it’s FREE (and OSS)
- IPython, backed by Windows Azure, turns any browser on any OS into a powerful exploration, analysis and visualization environment
- The Windows Azure Client Libraries provide easy, Pythonic access to Windows Azure services from Windows, MacOS and Linux
- Persistent Linux and Windows VM’s enable running any Python stack you desire
I should also emphasize that the members of the Python team are huge OSS fans and would love to see you get involved and contribute as well. The Windows Azure Client libraries are OSS on github. PTVS is OSS on Codeplex. If there’s a bug or feature you’d like to work on, please let us know!
We’re also considering support for Big Data (via Hadoop) and High Performance Computing on Windows Azure. Do you have any ideas on what we should work on? Please let us know!
- By Shahrokh Mortazavi, Partner Program Manager, Windows Azure