<type>how-to</type>
<domain>install</domain>
<id>raspberry</id>
<title>Using Wing with Raspberry Pi</title>
<date>$Date: 2006-12-28 17:21:43 -0500 (Thu, 28 Dec 2006) $</date>
<product>pro+</product>
<summary>Learn how Wing Pro speeds up development and debugging of Python 
code running on a Raspberry Pi.</summary>

.. note::
  **"Within a couple of minutes I could fence in and eliminate an error 
  with the handling of a GPRS modem attached to the Raspberry Pi that 
  before I was trying to hunt down for hours."** 
  *-- Robert Rottermann*, redCOR AG

.. image:: /images/screenshots/wing7-screenshot-dark.png
  :alt: Wing Pro Screen Shot
  :width: 574
  :height: 423
  :popup: 1

`Wing Pro <https://wingware.com>`__ is a Python IDE that can be used to develop, test, and
debug Python code running on the `Raspberry Pi <http://raspberrypi.org/>`__. 

If you do not already have Wing Pro installed, `download it now <https://wingware.com/downloads/wingpro>`__.

This document describes how to configure Wing for Raspberry Pi. To get started using Wing
as your Python IDE, please refer to the tutorial in Wing's ``Help`` menu or read the
`Quickstart Guide <ref:howtos/quickstart>`__.

Configuration
-------------

Wing Pro does not run on the Raspberry Pi, but you can set up Wing Pro on a computer connected to
the Raspberry Pi to work on and debug Python code remotely.  This is configured as follows:

* If you do not already have Wing Pro installed, `download it now 
  <https://wingware.com/downloads/wingpro>`__ on Windows, Linux, or macOS.
  
* Make sure you can connect to the Raspberry Pi from the machine where Wing
  IDE will be running, using ``ssh`` (or `PuTTY <http://www.putty.org/>`__ on 
  Windows).  If you don't have either ``ssh`` or PuTTY, you can also connect
  using Wing's built-in SSH implementation.  See `Setting up SSH for Remote 
  Development <ref:proj/remote-ssh>`__ for a detailed description of the
  available configuration options.  However, in most cases all you need to
  know is the Raspberry Pi's ip address.

* If you are using a Raspberry Pi Zero, an old slower model, or have a slow network
  connection to the Pi, then you should increase some of Wing's default network timeouts
  to accommodate slower than normal remote system response times.  The following 
  preferences should be set:
  
  * `Debugger > Network > Network Timeout <script:show_preferences_gui#prefname="debug.network-timeout">`__ -- 30 seconds
  * `Remote Development > SSH Timeout <script:show_preferences_gui#prefname="main.ssh-timeout">`__ -- 30 seconds
  * `Remote Development > Hung Connection Timeout <script:show_preferences_gui#prefname="main.hung-connection-threshold">`__ -- 20 seconds
  
* Start up Wing and use ``New Project`` from the ``Project`` menu to create
  a project.  Select ``Create New Configuration`` from the ``Host`` menu 
  in the ``New Project`` dialog and then select ``Raspberry Pi`` for the
  ``Remote Host Type`` in the ``New Remote Host`` dialog.
  
* Then fill in the ``New Remote Host`` fields as follows:
  
  * **Identifier** -- Set this to ``rasp`` or some other short identifier for
    the Raspberry Pi.  This name is used only within Wing.
  * **Host Name** -- Set this to the string you use to SSH into the Raspberry
    Pi.  In most cases you'll need both a username and IP address, such as
    ``pi@192.168.0.2``.
    
  Note that you can edit your configuration later, or add remote hosts to any 
  project, from the ``Remote Hosts`` item in the ``Project`` menu.
    
* Next click ``OK`` to create the remote host configuration.  Wing will attempt to 
  install the remote agent and then establish a connection to the Raspberry Pi. If this
  fails, details of the SSH command's output will be given in the resulting dialog.
  
* Once you have the remote agent working, continue through the ``New Project`` dialog
  to select or create your source directory and select or create the Python environment
  to use.  See `Creating a Project <ref:proj/creating-a-project>`__ for details.

  After you press ``Create Project`` Wing will create a new untitled project configured
  to work with your Raspberry Pi.  Save it to local disk from the ``Project`` menu,
  for example as ``rasp.wpr``.
  
Once this is done, you can open files from the Project tool, with ``Open
From Project`` and in other ways, and work with them as if they were on
your local machine.  That includes debugging, running unit tests, issuing
revision control commands, searching, running a Python Shell or OS Commands
remotely, and using other features like goto-definition, find uses, and 
refactoring.

Related Documents
-----------------

For more information see:

* `Raspberry Pi home page <http://raspberrypi.org/>`__ for documentation and downloads.

* `Quickstart Guide <ref:howtos/quickstart>`__ contains additional basic information
  about getting started with Wing.
  
* `Tutorial <ref:intro/tutorial>`__ provides a gentler introduction to Wing's features.

* `Wing Reference Manual <ref:manual>`__ documents Wing in detail.
