In this section, we will review Pycharm and WingIDE as development environments for python scripting.
The main development environments for script-development
Setting up a development environment
In order to rapidly develop and debug Python applications, it is absolutely necessary to use a solid IDE. If you want to try different options, we recommend you check out the list that is on the official site of Python, where they can see the tools according to their operating systems and their needs: https://wiki.python.org/moin/IntegratedDevelopmentEnvironments.
Of all the environments, we will highlight the following:
- Pycharm: http://www.jetbrains.com/pycharm
- Wing IDE: https://wingware.com
Pycharm
PyCharm is an IDE developed by the company Jetbrains, and is based on IntelliJ IDEA, the IDE of the same company, but focused on Java and is the base for Android Studio.
PyCharm is multi-platform and we can find binaries for Windows, Linux, and macOS X. There are two versions of PyCharm: community and professional, with differences in features related to integration with web frameworks and database support.
In this url we can see a comparison between community and professional edition: http://www.jetbrains.com/pycharm
The main advantages of this development environment are:
- Autocomplete, syntax highlighter, analysis tool and refactoring.
- Integration with web frameworks such as Django, Flask, Pyramid, Web2Py, jQuery, and AngularJS.
- Advanced debugger.
- Compatible with SQLAlchemy (ORM), Google App Engine, Cython.
- Connection with version-control systems: Git, CVS, Mercurial.
WingIDE
WingIDE is a multi-platform environment available for Windows, Mac, and Linux and provides all the functionalities at the level of debugging and variables-exploration.
WingIDE has a rich feature set that will easily support the development of sophisticated Python Applications. With WingIDE, you are able to inspect variables, stack arguments, and memory locations without the process changing any of their values before you can record them. Breakpoints are the most common feature that you will use when debugging a process. Wing Personal is the free version of this Python IDE, which can be found at https://wingware.com/downloads/wingide-personal
WingIDE uses the Python configuration installed in your system:
Debugging with WingIDE
In this example, we are debugging a Python script that accepts two input parameters:
An interesting topic is the possibility of adding a breakpoint in our program with the option Add Breakpoint option, in this way, we can debug and see the contents of the variables just at the point where we have established the breakpoint:
We can set a breakpoint in the call to the view_parameters method.
To execute a script in debug mode with parameters, you have to edit the properties of the script and add the parameters that our script needs within the debug tag:
If we execute in debug mode with a breakpoint inside the function, we can see the content of the parameters in local string variables:
In the following screenshot we can visualize the values of the params variable that contains the values we are debugging: