So, speak to most people in the Python community and they are going to be Mac users or Linux users. Python is baked into these operating systems and everything works nicely (most of the time). But, there are some of us who work on Windows (or, more precisely, all platforms) so how do we fair?
In the past, Windows has been a bit of a pain for the Python developer. What should be simple never was; if it wasn’t a build script failing, or a compiler not present, then it was lack of support for awesome tools such as virtualenv, easy_install and pip. Things just weren’t as simple as they were on OSX or ‘nix.
But here we are with Windows 10, and more importantly Visual Studio 2015. Now, Visual Studio was always a good development environment if you were writing for .Net. It was fully featured and had many happy users. With Visual Studio 2015 there are three important things to note:
- It is free. Yes, the community edition (with the Python tools) is 100% free. If you’re part of an organisation and you the want the Pro edition, there’s the usual Microsoft fee: Visual Studio 2015
- It has the brilliant Python tools for Visual Studio built in which gives you virtualenv management, with pip, requirements.txt, etc.
- It installs all those pesky compilers that you always had to hunt around for.
So, you download Visual Studio 2015 and go to install it.. make sure you select all the Python tools! This is a complete set of tools (you can also get them separately from GitHub here: https://github.com/Microsoft/PTVS if you miss this, but it’s just easier to install it all at once). When you install all these tools, you’ll find that the compilers that are needed for pip to be able to build your Python packages are installed to. Bye bye build errors.
When using Visual Studio 2015 with Python tools, you have to change your mentality a little bit from the OSX/Linux world. Much less is done at the shell, instead you click on things. You get all the Python syntax highlighting you would expect, and Visual Studio lets you manage your interpreters too. If you want to use a virtualenv you simply click on a few menu items and Visual Studio will build it for you – it has a rather cool feature too: if you have a requirements.txt file in your project, the env will automatically be built with pip setting up all your dependencies from the requirements file.
When you are in full coding mode, you’re going to need a decent debugger. Visual Studio give you a sturdy debugger which gives all the usual analysis – and it doesn’t feel like a bolt on at all. You even get a the ability to quickly pop open an interactive python shell for some quick hacking.
For further reading checkout the excellent Python Tools for Visual Studio on Amazon Kindle or Paperback (click here)
by Cathy Wong.
Of course, there are other IDEs out there that are good too. We particularly like PyCharm and use this across multiple OSes. The only issue here is that you have to install the compilers in Windows yourself (and we’ve been burned by this before).
Ultimately the choice of IDE is a personal one. However, Python development on Windows is finally coming of age and should not be written off!