Navigation

  • index
  • next |
  • Spyder v2.0 documentation »

Spyder - Documentation

Spyder is the Scientific PYthon Development EnviRonment:

  • a powerful interactive development environment for the Python language with advanced editing, interactive testing, debugging and introspection features
  • and a numerical computing environment thanks to the support of IPython (enhanced interactive Python interpreter) and popular Python libraries such as NumPy (linear algebra), SciPy (signal and image processing) or matplotlib (interactive 2D/3D plotting).

Spyder may also be used as a library providing powerful console-related widgets for your PyQt-based applications – for example, it may be used to integrate a debugging console directly in the layout of your graphical user interface.

Spyder websites:
  • Downloads, bug reports and feature requests: http://spyderlib.googlecode.com
  • Discussions: http://groups.google.com/group/spyderlib

Contents:

  • Overview
  • Installation
    • Dependencies
    • Installation
    • Help and support
  • Command line options
  • Light mode
  • Console
    • Reloading modules: the User Module Deleter (UMD)
  • Variable Explorer
  • Object inspector
  • Online help
  • History log
  • Explorer
  • Project Explorer
  • Editor
  • Find in files
  • Pylint extension
  • Internal Console
    • Special commands

Indices and tables:

  • Index
  • Search Page

Navigation

  • index
  • next |
  • Spyder v2.0 documentation »
© Copyright 2009, Pierre Raybaut. Created using Sphinx 1.0.4.


  • next |
  • previous |
  • Spyder v2.0 documentation »

Overview

Spyder is a Python development environment with the following key features:

Key features:

  • general features:
    • MATLAB-like PYTHONPATH management dialog box (works with all consoles)
    • Windows only: current user environment variables editor
    • direct links to documentation (Python, Matplotlib, !NumPy, !Scipy, etc.)
    • direct link to Python(x,y) launcher
    • direct links to !QtDesigner, !QtLinguist and !QtAssistant (Qt documentation)
  • preferences dialog box:
    • keyboard shortcuts
    • syntax coloring schemes (source editor, history log, object inspector)
    • console: background color (black/white), automatic code completion, etc.
    • and a lot more...
  • Editor:
    • syntax coloring (Python, C/C++, Fortran)
    • breakpoints and conditional breakpoints (debugger: pdb)
    • run or debug Python scripts (see console features)
    • run configuration dialog box:
      • working directory
      • command line options
      • run in a new Python interpreter or in an existing Python/IPython interpreter
      • Python interpreter command line options
    • code outline explorer: functions, classes, if/else/try/... statements
    • powerful code introspection features (powered by rope):
      • code completion
      • calltips
      • go-to-definition: go to object (any symbol: function, class, attribute, etc.) definition by pressing Ctrl+Left mouse click on word or Ctrl+G (default shortcut)
    • occurence highlighting
    • typing helpers (optional):
      • automatically insert closing parentheses, braces and brackets
      • automatically unindent after ‘else’, ‘elif’, ‘finally’, etc.
    • to-do lists (TODO, FIXME, XXX)
    • errors/warnings (real-time code analysis provided by pyflakes)
    • integrated `pylint` code analysis
    • direct link to winpdb external debugger
  • Console:
    • all consoles are executed in a separate process
    • code completion/calltips and automatic link to object inspector (see below)
    • open Python interpreters, IPython interpreters or basic terminal command windows
    • run Python scripts (see source editor features)
    • variable explorer:
      • GUI-based editors for a lot of data types (numbers, strings, lists, arrays, dictionaries, ...)
      • import/export data from/to a lot of file types (text files, !NumPy files, MATLAB files)
      • multiple array/list/dict editor instances at once, thus allowing to compare variable contents
      • data visualization
  • History log
  • Object inspector:
    • provide documentation or source code on any Python object (class, function, module, ...)
    • documentation may be displayed as an html page thanks to the rich text mode (powered by sphinx)
  • Online help: automatically generated html documentation on installed Python modules
  • Find in files: find string occurences in a directory, a mercurial repository or directly in PYTHONPATH (support for regular expressions and included/excluded string lists)
  • Explorer
  • Project Explorer (support Pydev project import)

Spyder may also be used as a PyQt4 extension library (module ‘spyderlib’). For example, the Python interactive shell widget used in Spyder may be embedded in your own PyQt4 application.

Navigation

  • index
  • next |
  • previous |


  • next |
  • previous |
  • Spyder v2.0 documentation »

Installation

Dependencies

Requirements:
  • Python 2.x (x>=5)
  • PyQt4 4.x (x>=4)
Recommended modules:
  • pyflakes >v0.3.0 (real-time code analysis)
  • rope >=v0.9.2 (editor code completion, calltips and go-to-definition)
  • sphinx >=v0.6 (object inspector’s rich text mode)
  • numpy (N-dimensional arrays)
  • scipy (signal/image processing)
  • matplotlib (2D/3D plotting)
  • IPython (enhanced Python interpreter)
Optional modules:
  • pylint (code analysis)

Installation

From the source package:
python setup.py install

Help and support

Spyder websites:
  • Downloads, bug reports and feature requests: http://spyderlib.googlecode.com
  • Discussions: http://groups.google.com/group/spyderlib

Navigation

  • index
  • next |


  • next |
  • previous |
  • Spyder v2.0 documentation »

Command line options

Spyder’s command line options are the following: (type ‘python spyder.py –help’ to show the text below)

Options:
-h, --help | show this help message and exit
-l, --light | Light version (all add-ons are disabled)
--session=STARTUP_SESSION
Startup session
--reset | Reset to default session
--optimize | Optimize Spyder bytecode (this may require administrative privileges)
-w WORKING_DIRECTORY, --workdir=WORKING_DIRECTORY
Default working directory
-d, --debug | Debug mode (stds are not redirected)
--multithread | Internal console is executed in another thread (separate from main application thread)
--profile | Profile mode (internal test, not related with Python profiling)


  • next |
  • previous |
  • Spyder v2.0 documentation »

Light mode

Spyder may be started in light mode with the following command:

python spyder.py --light

or

python spyder.py -l

The light mode is a very simple and light environment with the Console and the Variable Explorer.

Related plugins:
  • Console
  • Variable Explorer


  • next |
  • previous |
  • Spyder v2.0 documentation »

Console

The Console is where you may enter, interact with and visualize data, inside a command interpreter. All the commands entered in the console are executed in a separate process, thus allowing the user to interrupt any process at any time.

Many command windows may be created in the Console:

  • Python interpreter
  • IPython interpreter (the external module IPython is required)
  • Running Python script
  • System command window (this terminal emulation window has quite limited features compared to a real terminal: it may be useful on Windows platforms where the system terminal is not much more powerful - on the contrary, on GNU/Linux, a real system terminal is opened, outside Spyder)

Python-based command windows support the following features:

  • Code completion and calltips
  • Variable explorer with GUI-based editors for arrays, lists, dictionaries, strings, etc.
  • Debugging with standard Python debugger (pdb): at each breakpoint the corresponding script is opened in the Editor at the breakpoint line number
  • User Module Deleter (see below)
Related plugins:
  • Object inspector
  • History log
  • Editor
  • Explorer

Reloading modules: the User Module Deleter (UMD)

When working with Python scripts interactively, one must keep in mind that Python import a module from its source code (on disk) only when parsing the first corresponding import statement. During this first import, the byte code is generated (.pyc file) if necessary and the imported module code object is cached in sys.modules. Then, when re-importing the same module, this cached code object will be directly used even if the source code file (.py[w] file) has changed meanwhile.

This behavior is sometimes unexpected when working with the Python interpreter in interactive mode, because one must either always restart the interpreter or remove manually the .pyc files to be sure that changes made in imported modules were taken into account.

The User Module Deleter (UMD) is a Spyder console’s exclusive feature that forces the Python interpreter to reload modules completely when executing a Python script.

For example, when UMD is turned on, one may test complex applications within the same Python interpreter without having to restart it every time (restart time may be relatively long when testing GUI-based applications).


  • next |
  • previous |
  • Spyder v2.0 documentation »

Variable Explorer

The variable explorer shows the globals() namespace contents (i.e. all global object references) of the current console: it supports both the Console (Python or IPython interpreter running in a remote process) and the Internal Console.

The following screenshots show some interesting features such as editing lists, strings, dictionaries, NumPy arrays, or plotting/showing NumPy arrays data.

The default variable explorer configuration allows to browse global variables without slowing the console even with very large NumPy arrays, lists or dictionaries. The trick is to truncate values, to hide collection contents (i.e. showing ‘<list @ address>’ instead of list contents) and to not show mininum and maximum values for NumPy arrays (see context menu options on the screenshot at the top of this page).

However, most of the time, choosing the opposite options won’t have too much effect on console’s performance:

Related plugins:
  • Console
  • Internal Console


  • next |
  • previous |
  • Spyder v2.0 documentation »

Object inspector

The object inspector plugin works together with the Console and the Editor: it shows automatically documentation available when the user is instantiating a class or calling a function (pressing the left parenthesis key after a valid function or class name triggers the object inspector).

Note that this automatic link may be disabled by pressing the “Lock” button (at the top right corner of the window).

Of course, one can use the documentation viewer directly by entering an object name in the editable combo box field, or by selecting old documentation requests in the combo box.

Plain text mode:

Rich text mode:

Sometimes, when docstrings are not available or not sufficient to document the object, the documentation viewer can show the source code (if available, i.e. if the object is pure Python):

Related plugins:
  • Console
  • Editor


  • next |
  • previous |
  • Spyder v2.0 documentation »

Online help

The online help plugin provides an internal web browser to explore dynamically generated Python documentation on installed module, including your own modules (this documentation is provided by a pydoc server running in background).

Related plugins:
  • Object inspector


  • next |
  • previous |
  • Spyder v2.0 documentation »

History log

The history log plugin collects command histories of Python/IPython interpreters or command windows.

Related plugins:
  • Console


  • next |
  • previous |
  • Spyder v2.0 documentation »

Explorer

The explorer plugin is a file/directory browser allowing the user to open files with the internal editor or with the appropriate application (Windows only).

Context menus may be used to run a script, open a terminal window or run a Windows explorer window (Windows only):

Related plugins:
  • Console
  • Editor


  • next |
  • previous |
  • Spyder v2.0 documentation »

Project Explorer

The project explorer plugin handles project management in Spyder with the following main features:

  • import from existing Pydev (Eclipse) or Spyder projects
  • add/remove project folders to/from Spyder’s PYTHONPATH directly from

the context menu or manage these folders in a dedicated dialog box

  • multiple file selection (for all available actions: open, rename, delete, and so on)
  • file type filters


  • next |
  • previous |
  • Spyder v2.0 documentation »

Editor

Spyder’s text editor is a multi-language editor with features such as syntax coloring, code analysis (real-time code analysis powered by pyflakes and advanced code analysis using pylint), introspection capabilities such as code completion, calltips and go-to-definition features (powered by rope), function/class browser, horizontal/vertical splitting features, etc.

Function/class/method browser:

Code analysis with pyflakes:

Horizontal/vertical splitting feature:

Related plugins:
  • Console
  • Explorer
  • Find in files


  • next |
  • previous |
  • Spyder v2.0 documentation »

Find in files

The Find in Files plugin provides text search in whole directories or mercurial repositories (or even in PYTHONPATH) with regular expression support for maximum search customization.

Related plugins:
  • Editor


  • next |
  • previous |
  • Spyder v2.0 documentation »

Pylint extension

Pylint extension may be used directly from the Editor, or by entering manually the Python module or package path - i.e. it works either with .py (or .pyw) Python scripts or with whole Python packages (directories containing an __init__.py script).

Related plugins:
  • Editor


  • Spyder v2.0 documentation »

Internal Console

The Internal Console is dedicated to Spyder internal debugging or may be used as an embedded Python console in your own application. All the commands entered in the internal console are executed in the same process as Spyder’s, but the Internal Console may be executed in a separate thread (this is optional and for example this is not the case in Spyder itself).

The internal console support the following features:

  • Code completion and calltips
  • User Module Deleter (as in Console)

Special commands

The following special commands are supported by the interactive console.

  • Edit script

    edit foobar.py will open foobar.py with Spyder’s editor. xedit foobar.py will open foobar.py with the external editor.

  • Execute script

    run foobar.py will execute foobar.py in interactive console.

  • Remove references

    clear x, y will remove references named x and y.

  • Shell commands

    !cmd will execute system command cmd (example !ls on Linux or !dir on Windows).

  • Python help

    object? will show object‘s help in documentation viewer.

  • GUI-based editor

    oedit(object) will open an appropriate GUI-based editor to modify object object and will return the result.


Index