Wing Pro 6 adds the ability to connect to a remote host through a secure SSH tunnel in order to work with files stored remotely in the same way that Wing supports working with files on your local system. Editing, debugging, testing, searching, version control, Python Shell, OS Commands, and other features all work with remote systems.
Currently, Wing can work remotely to OS X and Intel or ARM Linux systems. This includes any PEP 513 compatible Intel Linux system and ARM systems like Raspberry Pi and Jolla phone. We are still expanding the range of remote systems that we support. For a detailed list of the remote host types supported in the current release, please see Supported Platforms. If you try a device and cannot get it working, please don't hesitate to email support at wingware dot com for help.
Before you can set up remote development in Wing, you first need to have an SSH key pair and set up password-less (SSH key authenticated) remote access to your target host using ssh on Linux and OS X or PuTTY on Windows. If you don't already have this, please refer to SSH Setup Details in Wing's documentation.
Creating a Project
To set up a new project that works with a remote host, select New Project from the Project menu and choose Connect to Remote Host (via SSH) as the project type. Then enter an Identifier to use for the remote host, the `Host Name or ip address (optionally in the form username@hostname), and for WINGHOME specify the location at which Wing should install its remote agent on the remote host. You only need to specify Python Executable if Python is not on the PATH on your selected remote host or you want to select one of several Python installations (this is relatively rare).
For example, here is a configuration to access a RedHat Linux system on my local network from Windows 10:
To keep things simple, leave Store Project on Remote Host unchecked and then press OK. This will create the project and a remote host configuration, and will try to contact the remote agent. Unless you've already installed the remote agent on that remote host in the WINGHOME your specified, you will get a dialog that looks like this:
Press Install Remote Agent and Wing will install the agent and then retry establishing a connection to the agent. If this succeeds, you will see a dialog as follows:
Close this dialog and you will see a confirmation that the project was created successfully:
In this case, just select Save Later.
Using Your Project
Now you can right-click on the Project tool (accessed from the Tools menu) and select Add Existing Directory to add a directory containing your source code. Don't add your entire home directory or many 1000's of files since remote development does have higher latency for processing files than local development. Press the Browse button in the Add Directory dialog to browse files on the remote system. Afterward, save the project to local disk with Save Project in the Project menu.
If you restart the Python Shell from its Options menu, Wing should start the shell on the remote host. For example, here is Python running remotely on a CentOS 6 system from Wing on Windows 10:
To debug, open a file from the directory you added to the project and select Start/Continue in the Debug menu. Wing launches the file in the debugger on the remote host and will reach breakpoints and exceptions. Debugging a remote file works the same way as for local files. You can use the Debug Probe, Stack Data, Watch and other tools to inspect and debug your code.
Other tools, including the Testing tool for unit testing, the version control integrations, and OS Commands for executing non-Python command lines all work on the remote host. Everything you do is protected through the use of secure SSH tunnels to the remote host.
The remote host configuration you created along with your project is stored within the project file in this case, because you stored the project on local disk. You can view and edit the configuration, or create other remote host configurations, from Remote Hosts in the Project menu. Here is an example where two remote hosts were created:
It is possible to set up multiple remote host configurations for one project, but the project's Python Executable in Project Properties (from the Project menu) can only point to one of the remote hosts, and that is where the Python Shell and debug processes are run. Changing the Python Executable is what determines whether a project points to local disk or some remote system. Here are the Project Properties that were set up automatically in the project we created above:
In this example, we stored the project file on local disk. Project files can also be stored on the remote host. In that case, the remote host configuration needs to be checked as Shared, as for remote host osx in the Manage Remote Hosts dialog above. This stores the remote host configuration locally so that it can be used to access the remote project later with Open Remote Project from the Project menu.
You can also use this feature to remotely open a regular Wing project, for example to work on something that resides on your desktop computer while you relax on the couch with your laptop.
For more detailed instructions and advanced configuration options see Remote Hosts.
Don't hesitate to contact us at support at wingware dot com if you need help getting remote development working.
This is the first in a series of articles on features that are new or improved in Wing IDE version 6.
Wing IDE is a Python IDE with closely integrated editing, debugging, and unit testing capabilities. Wing version 6 improved and extended support for multiple selections on the editor, making it easier to select and then apply edits to a number of selections at once.
The first thing to say about multiple selections is that they are not the right tool to use if you are trying to change the name of a symbol globally across multiple files. In that case, you should use Rename Symbol refactoring instead from the Refactor menu. This will complete the operation in one step, rather than requiring editing each file
That said, multiple selections are very useful when you are trying to change a subset of occurrences of a symbol, or want to edit strings that are not symbol or that occur in comments or strings.
Multiple selections are created by selecting one occurrence of the string you want to edit and using the multiple selection icon in the toolbar, or the key bindings for the commands found in the Edit > Multiple Selections menu to also select other occurrences of that string:
Adding the next occurrence, or dropping the current occurrence and adding the next one, are the most common way in which multiple selections are made. You can also add all occurrences of the current selection within the file, class, function, method, or block, and there are options to select only occurrences that match in case or that are whole words.
Another way to make multiple selections is to Ctrl-click (or Command-click on OS X) and select an additional non-empty range of text. This can be combined with the above to create arbitrary sets of selections that don't necessarily all contain the same text.
After you've started making selections, Wing will show a popup that includes all the selections, whether or not they are on screen:
Clicking on items in the popup will scroll the editor to show that selection. You can remove items accidentally selected by mousing over the item and pressing the red X icon.
Once you have all the selections that you want made in the editor, you can move the caret or type and your edits will be applied to all the selections at once. For example, pressing left arrow following by Ctrl-D for forward-delete, following by x will replace the first letter of each selection with x:
For more information, please see Multiple Selections in the documentation or just Download Wing IDE and try it with your own source code. The Quick Start will take you through the basics of setting up the IDE, and the Tutorial provides a more in-depth introduction to all of Wing IDE's features.
Wing IDE is an integrated development environment that can be used to develop and debug Python code running on the Raspberry Pi. Wing provides auto-completion, call tips, a powerful debugger, and many other features that help you write, navigate, and understand Python code.
The Raspberry Pi is not really capable of running Wing IDE itself, but you can set up Wing IDE on a computer connected to the Raspberry Pi to work on and debug Python code remotely.
To do this, you will first need (1) a network connection between the Raspberry Pi and the computer where Wing IDE will be running, and (2) a way to share files between the two computers.
The easiest way to connect the Raspberry Pi to your network is with ethernet, or see the instructions at the end of Using Wing IDE with Raspberry Pi for configuring a wifi connection.
For file sharing, use Samba, or simply transfer a copy of your files to the Raspberry Pi using scp or rsync.
Installing and Configuring the Debugger
Once you have a network connection and some sort of file sharing set up, the next step is to install and configure Wing IDE's debugger. This is done as follows:
- If you do not already have Wing IDE 5.1.5 or later installed, download a free trial on Windows, Linux, or OS X.
- Download the Raspberry Pi debugger package to your Raspberry Pi and unpack it with tar xzf wing-debugger-raspbian-6.0.1-1.tgz. This creates a directory named wing-debugger-raspbian-6.0.1-1.
- Launch Wing IDE and make sure that Accept Debug Connections is checked when you click on the bug icon in the lower left of Wing's main window. Hovering the mouse over the bug icon will show additional status information, including the port Wing is listening on, which should be 50005 by default.
- Copy wingdebugpw from the machine where you have Wing IDE installed to the Raspberry Pi and place it into the directory wing-debugger-raspbian-6.0.1-1. This file is located in the Settings Directory, which is listed 5th in Wing's About box.
- On the Raspberry Pi, use /sbin/ifconfig to determine the IP address of the Raspberry Pi (not 127.0.0.1, but instead the number listed under eth0 or wlan0 if you're using wifi).
On the host where Wing IDE is running (not the Raspberry Pi), establish an ssh reverse tunnel to the Raspberry Pi so the debugger can connect back to the IDE. On Linux and OS X this is done as follows:
ssh -N -R 50005:localhost:50005 <user>@<rasp_ip>
You'll need to replace <user>@<rasp_ip> with the login name on the Raspberry Pi and the ip address from the previous step.
The -f option can be added just after ssh to cause ssh to run in the background. Without this option, you can use Ctrl-C to terminate the tunnel. With it, you'll need to use ps and kill to manage the process.
On Windows, use PuTTY to configure an ssh tunnel using the same settings on the Connections > SSH > Tunnels page: Set Source port to 50005, Destination to localhost:50005, and select the Remote radio button, then press the Add button. Once this is done the tunnel will be established whenever PuTTY is connected to the Raspberry Pi.
In Wing IDE's Preferences, use the Debugger > External/Remote > Location Map preference to set up a mapping from the location of your files on the remote host (the Raspberry Pi) and the machine where the IDE is running.
For example, if you have files in /home/pi/ on your Raspberry Pi that match those in /Users/pitest/src/ on the machine where Wing is running, then you would add those two to the location mapping for 127.0.0.1, with home/pi/ as the remote directory and /Users/pitest/src/ as the local directory.
Don't add a location map for the Raspberry Pi's ip address because your ssh tunnel makes it look like the connection is coming from 127.0.0.1 and not the Raspberry Pi.
Invoking the Debugger
There are two ways to invoke the debugger: (1) from the command line, or (2) from within your Python code. The latter is useful if debugging code running under a web server or other environment not launched from the command line.
Debugging from the Command Line
To invoke the debugger without modifying any code, use the following command:
wing-debugger-raspbian-6.0.1-1/wingdb yourfile.py arg1 arg2
This is the same thing as python yourfile.py arg1 arg2 but runs your code in Wing's debugger so you can stop at breakpoints and exceptions in the IDE, step through your code, and interact using the Debug Probe in the Tools menu.
By default this runs with python and connects the debugger to localhost:50005, which matches the above ssh tunnel configuration. To change which Python is run, set the environment variable WINGDB_PYTHON:
Starting Debug from Python Code
To start debug from within Python code that is already running, edit wing-debugger-raspbian-6.0.1-1/wingdbstub.py and change the line WINGHOME = None to WINGHOME = /home/pi/wing-debugger-raspbian-6.0.1-1 where /home/pi should be replaced with the full path where you unpacked the debugger package earlier. Use pwd to obtain the full path if you don't know what it is.
Copy your edited wingdbstub.py into the same directory as your code and add import wingdbstub to your code. This new line is what initiates debugging and connects back to the IDE through the ssh tunnel.
An alternative to editing wingdbstub.py is to set WINGHOME in the environment instead with a command like export WINGHOME=/home/pi/wing-debugger-raspbian-6.0.1-1.
For additional configuration options and trouble-shooting, see Using Wing IDE with Raspberry Pi.
More information on Wing IDE can be found in the product overview.
Wing IDE Pro has long had the ability to jump to the point of definition of a symbol in source code (press F4 or right-click to select Goto Definition). This works whether or not the symbol is defined in the same file or in an imported module or package.
Similarly, the Find Symbol dialog in the Source menu jumps to symbols anywhere in the current file when you type a fragment that matches its name.
Wing IDE Pro 5.1 takes this a step further by adding a Find Symbol in Project dialog that works the same way but searches all files in the project for matching symbols:
When you type a fragment, it can apply anywhere within the symbol name. Multiple fragments separated by spaces can be used to narrow down context as well as symbol name, for example matching class name and then method name:
Find Symbol in Project is very fast, and it is a great way to quickly navigate through hundreds of thousands of lines of code. It is listed in the Source menu, along with the key binding that can be used to display it (Ctrl-Shift-T in most keyboard personalities). If you want to define your own key binding, the command name is find-symbol-in-project.Share this article:
Wing IDE Pro's debugger makes it easier to work interactively with Python. In addition to debugging, it is also a great way to navigate and understand unfamiliar code, and to write new code interactively in the live runtime state for which it is being designed.
The Debug Probe is an important part of Wing's support for interactive development. This is a Python shell that works in the current debug stack frame when the debug process is paused by a breakpoint or exception.
To use the Debug Probe, set a breakpoint in your code and start debugging from the toolbar icon or Debug menu. When you reach the breakpoint or any exception, you can start working interactively in the Debug Probe.
The menus at the top of the Debug Probe are used to select the process, thread, and stack frame you want to work within. Any changes made in the Debug Probe, or side effects of code that is invoked here, are made within the selected stack frame.
The Debug Probe provides auto-completion that is integrated with Wing's Source Assistant, where you can see call signature, documentation, and other information relevant to the code you are typing.
You can easily jump to point of definition of symbols in the debug probe or their types by pressing F4 or by navigating from the links in the Source Assistant.
Conditional breakpoints are handy for isolating a particular case for which new code is being written, giving you direct and convenient access to the actual data being passed to the code that you are working on. Everything you write can immediately be tested against the live runtime state.
To set or edit a conditional breakpoint, right click on the left-most margin in the editor. Breakpoints can also be ignore-counted or enabled/disabled from here, and an overview of breakpoints with statistics is available in the Breakpoints tool in the Tools menu.
In some cases it's useful to set a range of code in the editor as active in the Debug Probe, in order to make it easier to execute while working on it. This is done with the icons in the upper right corner of the Debug Probe.
Once an active range is set, it is highlighted in the editor and can be sent to the Debug Probe by pressing the icon in the top right of the Debug Probe or by binding a key to the command debug-probe-evaluate-active-range.
Getting Started with Wing IDE
A quick introduction to Wing IDE's features can be found in our Feature Overview Screencast.
Or just download Wing IDE and give it a try. The Tutorial in Wing's Help menu is a great way to get started.
2015Wing IDE 5.1 adds multi-process debugging and automatic child process debugging. Read more
Learn how to move the program counter while debugging Python code in Wing IDE Pro. Read more
2014Wing IDE 5.0.9 adds the ability to set an active range of code in the editor. This makes it easier to reevaluate edited sections of code in the Python Shell or Debug Probe. Read more
This new screencast takes you on a tour of some of the features in Wing IDE Professional version 5. Read more
How to get the most out of Wing IDE Pro's auto-completer and source assistant for Python. Read more
Learn how to use Wing IDE Pro's advanced auto-editing features to speed up writing and modifying Python code. Read more