Launch Configurations

Index of All Documentation » Wing Pro Reference Manual » Project Manager »

Most users of Wing will use the project-wide environment for debugging, executing, and testing code.

In some cases, multiple environments are needed in the same project, for example to run unit tests in different environments, or to set a different environment for specific entry points. To support this, launch configurations can be managed from the Project > Launch Configurations menu item. This manager is initially empty. Right click to create, edit, duplicate, or delete launch configurations.

Once defined, launch configurations can be referenced from per-file properties under the Debug/Execute and Testing tabs, and in the creation of named entry points.

Launch configurations contain the following properties, as organized under the Environment and Python tabs in the launch configuration properties dialog:

Python Executable -- When the Custom radio button is checked and the entered field is non-blank, this can be used to set the full path to the Python executable that should be used when debugging source code in this project. When Use default is selected, Wing uses the project configuration.

In Wing Pro, this field contains an additional option to select a configured remote host, so that the Python Executable used will be one that is running on that host. When this is done, the launch configuration will only be usable with files that are also stored on that remote host. See Remote Hosts for details.

Python Path -- The PYTHONPATH is used by Python to locate modules that are imported at runtime with the import statement. By default this uses the project setting. When the Use default checkbox selected, the inherited PYTHONPATH environment variable is used. Otherwise, when Custom is selected, the specified PYTHONPATH is used.

Python Options -- This is used to select the command line options sent to the Python interpreter while debugging. The default of -u sets Python into unbuffered I/O mode, which ensures that the debug process output, including prompts shown for keyboard input, will appear in a timely fashion.

Run Arguments -- Enter any run arguments here. Wing does not interpret backslashes ('') on the command line and passes them unchanged to the sub-process. The only exceptions to this rule are \' and \" (backslash followed by single or double quote), which allow inclusion of quotes inside quoted multi-word arguments.

Initial Directory -- Specifies the initial working directory. By default this uses the initial directory specified by the project-wide environment. When the Use default radio button is checked, the initial working directory will instead be the directory where the launched file is located. When Custom is selected, the specified directory is used instead (use $(WING:PROJECT_DIR) for the project's directory).

Environment -- This is used to specify values that should be added, modified, or removed from the environment. Each entry is in var=value form and must be specified one per line in the provided entry area. An entry in the form var= (without a value) will remove the given variable so it is undefined. The popup selector is used to choose the environment to modify: Either the startup environment seen when Wing was first started, or the Project-defined environment. When Use project values or Use inherited environment is chosen, any entered values are ignored and the selected environment is used without changes. Note that the environment inherited by Wing may differ on OS X according to whether you launched Wing from the command line or with the Finder.

Build Command -- This command will be executed before launching a subprocess with this launch configurations. This is useful to make sure that C/C++ extension modules are built, for example in conjunction with an external Makefile or distutils script, before execution is started. The build is configured through and takes place in the OS Commands tool.

For all of these, environment variable references may be used, as described in Environment Variable Expansion.

Shared Launch Configurations

By default each launch configuration is stored in the project file. In the launch configuration manager dialog, the Shared checkbox can be selected to cause Wing to store that launch configuration in the User Settings Directory instead, in a file named launch. Those launch configurations are then accessible from all projects.

Working on Different Machines or OSes

When the Shared checkbox is selected for a launch configuration, or when shared projects are used, it is necessary to design launch configurations carefully so that they will work across projects, machines, or operating systems.

For example, specifying a full path in the Python Path may not work on a different OS. The key to making this work is to use environment variable references in the form ${VARNAME} as described in Environment Variable Expansion. The referenced environment variables can be special environment variables defined by Wing, such as WING:PROJECT_DIR, or user-defined values that are set either system-wide, or in Project Properties. Note that values set in Environment in Project Properties are by default not stored in the shared project file, so those may vary on each development machine if desired.

A common example in configuring Python Path is to replace a full path like /Users/myname/src/project/src with ${WING:PROJECT_DIR}/src (this assumes you store the project in /Users/myname/src/project). In general, working of the project's location is a good approach to maintaining some independence from differences on different development machines and OSes.

To make file paths work across OSes, use forward slashes instead of back slashes. The character sequence .. can be used to move up a directory on all OSes, as for example in {WING:PROJECT_DIR}/../libs/src.