Saturday, December 20, 2014

Developing kivy apps with Eclipse/PyDev (including YAPYG!)

Eclipse is an open source IDE with many cool features like navigating source, refactoring and debugger integration

One of the things I really like about kivy is that installing it is extremely easy: just download the archive, extract it, and run kivy.bat, and you have a working shell to try stuff out. Sooner or later though you will find yourself wanting a nicer environment to work in than a basic text editor, and here is where Eclipse comes in. The following instructions describe the procedure for setting up Eclipse and the Pydev plugin as an IDE for kivy and YAPYG under Windows.

Setting up Eclipse

  1. Download Eclipse (get "Eclipse IDE for Java Developers" at the top)
  2. (If you don't have it installed already, you will need a Java runtime environment (JRE) to use Eclipse (Java SE 7 or greater is recommended).
  3. Extract the downloaded archive to anywhere (there is no setup)
  4. Create a shortcut to the extracted eclipse.exe on your desktop or whereever

Setting up PyDev

Official instructions are on this page.
  1. Start Eclipse
  2. Choose Help > Install New Software... in the menu
  3. Click the Add... button and enter PyDev as the name and http://pydev.org/updates as the location
  4. Select PyDev in the Work with: box and wait for PyDev to appear in the box below so you can select it for installation
  5. Click Next several times, accepting all the licenses, until Eclipse asks you to restart to enable the just downloaded plugin

Setting up kivy in Eclipse

  1. Download the kivy archive and extract to e.g. C:\Kivy-1.8.0-py2.7-win32
  2. Start Eclipse and choose Window > Preferences in the menu
  3. Choose PyDev/Python interpreter in the left pane and adjust to these settings:


Adding YAPYG as an Eclipse project

  1. Choose File > New > PyDev Project in the menu
  2. Name the project YAPYG Engine and select the Create links to existing sources radiobutton below
  3. Add the main directory of your YAPYG source download as a source
  4. To make compiling and installing the engine easy, choose Run > Run configurations in the menu and create a Compile YAPYG Engine configuration
  5. Set the Main Module of the configuration to setup.py in the main directory, and set Program Arguments in the Arguments tab to "install" without the quotes. Also enable "Run" for this project in the Common tab.

Adding the YAPYG demo as an Eclipse project

  1. Create a new PyDev project and name accordingly
  2. Point to the examples directory for the sources and select demo_main.py as the main module
  3. Add a debug and/or run configuration

No comments:

Post a Comment