Chapter 1. Introduction to PTVS

Python Tools in Visual Studio (PTVS) is an extremely powerful tool because of the following reasons:

  • It gives Python developers a powerful IDE with many helpful coding features and integrations in one unique environment.
  • PTVS provides developers on the Windows platform the opportunity to use their favorite IDE—Visual Studio—to explore, learn, and manage one of the most commonly used scripting languages.

In this chapter, we will have a high-level overview of PTVS, starting with a step-by-step tutorial for installing and configuring it correctly followed by a quick overview of the principle tools of Visual Studio to control the Python environment and configuration. Understanding the Visual Studio windows will greatly benefit your ability to explore and manage workflows of the source code and the structure of your Python project.

Step-by-step installation and configuration

There are various formats of PTVS available for installation depending on your preexisting installed version of Visual Studio. PTVS is available for Visual Studio 2010, 2012, and 2013 (Pro edition or above).

If the previously mentioned versions of Visual Studio are not installed on your computer, it's possible to install a standalone version of PTVS. Visual Studio permits side-by-side installation, meaning it provides the ability to install multiple versions on one system. The only prerequisite is that the older version must be installed before the newer one.

The different types of installations possible for PTVS are described on its CodePlex website, http://go.microsoft.com/fwlink/?LinkID=390659.

Step-by-step installation and configuration

The preceding figure is taken from http://go.microsoft.com/fwlink/?LinkID=390659.

The most important prerequisite for Visual Studio 2013 is to have Windows 7 (32 or 64 bit) or above running as your operating system.

Once you have sorted out the prerequisites and installed the PTVS package of your choice, you will need to decide on the type of Python interpreter. Choosing the appropriate Python interpreter depends on your need for your project. Refer to the PTVS CodePlex page at http://go.microsoft.com/fwlink/?LinkID=299429 to help your decision-making process. You can choose between CPython and IronPython (32 or 64 bit). If you chose CPython, then you can choose between Python Version 2.7 and 3.3. It is recommended to use CPython 3.3 32 bit for most cases. For web development, the recommendation would be CPython 2.7 32 bit.

Make your choice based on what you intend to do and the framework that you will be using with Python. For the scope of this book, we suggest to install the 32-bit CPython Version 2.7. For the latest complete list of downloadable Python interpreters, please refer to the PTVS CodePlex page at http://go.microsoft.com/fwlink/?LinkID=390659.

Once the interpreter is installed, you can fire up PTVS by opening the Visual Studio 2013 application from the Start menu. If everything works, this is what you are going to see on your screen:

Step-by-step installation and configuration

Let's check whether the whole system works properly. Create a new project and see if it runs as follows:

  1. To create a new project, navigate to the New Project menu under File to launch the New Project dialog box.
    Step-by-step installation and configuration
  2. Select Python Application and click on OK. This will create a new project and a basic Hello World Python application file.
    Step-by-step installation and configuration
  3. Start the app by clicking on the Start button in the toolbar, or just hit F5.
    Step-by-step installation and configuration
  4. If you have any previous installations of Python on your system, you should see the application response window with the Hello World message, as shown in the following screenshot:
    Step-by-step installation and configuration
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.251