Hands-On Software Engineering with Python
上QQ阅读APP看书,第一时间看更新

Eclipse variations + PyDev

The Eclipse Platform, managed by the Eclipse Foundation (www.eclipse.org), is intended to provide a robust, customizable and fully featured IDE for any number of languages and development focuses. It's an open source project, and has spun off at least two distinct child variants (Aptana Studio, focused on web development),  and LiClipse , (focusing on Python development).

The LiClipse installation will be used as the basis of comparison here, since it requires no language-specific setup to begin writing Python code, but it's perhaps worth noting that any Eclipse-derived installation that has access to the same plugins and extensions (PyDev for Python language support, and EGit for Git support) would provide the same functionality. All that said, Eclipse is not, perhaps, for everyone. It can be a very heavy IDE, especially if it's providing support for more than a couple of languages, and can have a significant operational footprint memory and CPU usage – even if its supported languages and functionality set is fairly tightly controlled:

  • Large project support: Great
  • Refactoring support: Good
  • Language exploration: Fair
  • Code execution: Good
  • Bells and whistles: Good

Here is a screenshot of LiClipse, showing a code outline view of the open code file, project properties, and a task list automatically generated from TODO comments in the open code files:

Eclipse's support for large Python projects is very good:

  • Multiple projects can be defined and open for modification at the same time
  • Each project can have its own distinct Python interpreter, which can be a project-specific virtual environment, allowing distinct package requirements on a per-project basis, while still also allowing execution
  • Projects can be set up to use other projects through the Project References settings as dependencies, and code execution will take those dependencies into account; that is, if code is run in a project that has a different project set up as a reference/dependency, the first project will still have access to the second's code and installed packages

Refactoring support across all the Eclipse-derived IDEs is also quite good, providing processes for the renaming of code elements including modules, the extraction of variables and methods, and facilities for the generation of properties and other code constructs. There may be other refactoring capabilities that are context dependent, and thus aren't obviously available at first glance.

Once a Python environment has been associated with a project, the structure of that environment is completely available in the project's UI. By itself, that allows for drill-down exploration of what packages and functionality are available through the associated environment. Less obviously, control-clicking on a member of an installed package (for example, on urllib.request in the example code from Chapter 5The hms_sys System-Project, or the urlopen function that module provides) will take the developer to the actual member (method or property) of the actual module that the project has in its installation.

The Eclipse family of IDEs provides reasonably good execution capabilities for Python code, though it takes some getting used to. Any module or package file can be executed if or as needed, and any results, be they output or errors, will be displayed. The execution of a specific file also generates an internal run configuration that can be modified or removed as needed.

The Eclipse/PyDev bells and whistles are, for the most part, comparable with those of Geany and IDLE  code and structure coloration is available and configurable, autosuggestion and autocompletion is available. The one potentially significant item that LiClipse in particular provides from the get-go is an integrated Git client. LiClipse's Git integration, before any repositories have been cloned, is shown here: