Last Site Update: 20 July 2010 | Latest Version: 1.6.0


Main

Download

Screenshots

Manual

Developers

About/Contact


Pydev Aptana

Previous (Installing) Root Next (Creating a project)


Configure Interpreter

After installing it, the first thing you must do is configure the Python and/or Jython and/or IronPython interpreter. To configure the interpreter:

  1. Go to: window > preferences > pydev > Interpreter - (Python/Jython/IronPython).

  2. Choose the interpreter you have installed in your computer (such as python.exe, jython.jar or ipy.exe).

    Note that the Auto Config will try to find it in your PATH, but it can fail if it's not there.

  3. Select the paths that will be in your SYSTEM PYTHONPATH.

IMPORTANT: Select only folders that will NOT be used as source folders for any project of yours (those should be later configured as source folders in the project).

After those steps, you should have a screen as presented below:

images/interpreter.png

How to check if the information was correctly gotten

The System libs must contain at least the Lib and the Lib/site-packages directory.

The Forced builtin libs must contain the modules built into the interpreter (and others whose analysis should be done dynamically. See: Forced Builtins).

What if it is not correct?

The most common error is having a problem in the environment variables used from the shell that spawned Eclipse, in a way that for some reason when getting the variables of one interpreter, it gathers the info from another interpreter (thus mixing the interpreter and the actual libraries).

Usually running (from the command prompt) the file that gives that info for Pydev can help you discovering the problem in your configuration (interpreterInfo.py):

That file is usually located at: eclipsepluginsorg.python.pydev_$version$PySrcinterpreterInfo.py, but it can be at other location depending on how you installed it )

python.exe interpreterInfo.py

java.exe -cp c:pathtojython.jar org.python.util.jython interpreterInfo.py

ipy.exe interpreterInfo.py

If you're unable to find out what's going on, please ask in the users forum (giving the output obtained from executing interpreterInfo.py in your machine).

What if I add something new in my System PYTHONPATH after configuring it?

If you add something to your python installation, you need to either add it manually as a 'new folder' in the System PYTHONPATH (if it's still not under a folder in the PYTHONPATH) or (recommended) remove your interpreter and add it again, then, press apply.

Note that if you added a library that's already under a folder in the PYTHONPATH, you have to at least go to the interpreter preferences and press apply so that it clears its internal caches (after the configuration is done, things are set in stone for Pydev)

Libraries

The System libs are the libraries that will be added to the PYTHONPATH of any project that is using this interpreter.

For Python and IronPython, it's composed of folders, zip files and egg files. Note that if dlls should be added to the PYTHONPATH, the folders actually containing those dlls should be added, and they must have the same name to be imported in the code (the case is important). I.e.: if you want to import iTextDll, it must be called iTextDll.dll (note that .pyd and .so extensions are also accepted).

For Jython, it's composed of folders and jars.

Forced Builtins

The Forced builtin libs are the libraries that are built-in the interpreter, such as __builtin__, sha, etc or libraries that should forcefully analyzed through shell introspection (the other option to analyze modules with too much runtime information is providing Predefined Completions).

For Python, you should have around 50 entries

For Jython around 30 entries.

For IronPython more than 100 entries. All the packages built into .NET should be included here -- e.g.: Microsoft, Microsoft.Windows.Themes, System, System.IO, etc.

Additionally, you may add other libraries that you want to treat as builtins, such as os, wxPython, OpenGL, etc. This is very important, because Pydev works on the java side only with static information, but some modules don't have much information when analyzed statically, so, Pydev creates a shell to get information on those. Another important thing is that they must be on your system pythonpath (otherwise, the shell will be unable to get that information).

images/interpreter_forced_builtins.png

Predefined Completions

Predefined completions are completions acquired from sources that provide only the interfaces for a given Python module (with Python 3.0 syntax).

A predefined completion module may be created by having a module with the extension ".pypredef" with regular Python 3.0 contents, but with attributes having assigns to its type and methods having as the body a sole return statement -- and the docstring may have anything.

Example for a my.source.module (must be declared in a my.source.module.pypredef file):

MyConstantA = int
MyConstantB = int

class MyClass:

    instanceAttribute = QObject

    def __init__(self, parent=None):
        '''

        @type parent: QObject
        '''

    def registerTimer(interval, object):
        '''

        @type interval: int
        @type object: QObject
        '''
        return int

Note 1: the name of the file is the exact name of the module

Note 2: .pypredef files are not searched in subfolders

Optionally a QScintilla .api file may be added. When this is done, Pydev will try to create .pypredef files from that .api file and will add the folder containing those to the PYTHONPATH. Note that this conversion is still in beta and the file may not be correctly generated, so, keep an eye for errors logged when a code-completion that would use those modules (while it will not fail, those completions won't be shown using the .pypredef files). In those situations, please create a bug-report with the .api file that generated incorrect code.

images/interpreter_predefined.png

Environment

The variables defined at the environment will be set as environment variables when running a script that uses the given interpreter (note that it can still be overridden in the run configuration)

String substitution variables

Strings defined here may be used in:

  • project configuration for source folders and external libraries
  • launch configuration for the main module

They can be used in those places in the format: ${DECLARED_VARIABLE}

Cygwin users

Pydev currently has no support for cygwin. Currently you'll be able to configure the interpreter with cygwin, but there are still other related problems (mostly on converting between windows and cygwin paths as needed).


Previous (Installing) Root Next (Creating a project)

Copyright: Aptana, Inc. 2008-2010