Skip to main content

A buildout recipe to install and configure a PyDev project for Openerp

Project description

Version

An extension to anybox.recipe.openerp that generates Odoo projects for the Eclipse PyDev IDE.

What it is

This buildout recipe is an extension to the fully featured recipe developed by Anybox: anybox.recipe.openerp.

It generates a ready-to-use Eclipse PyDev Project, pointing to all dependencies required to develop, run and debug your Odoo server as well as your own addons.

The generated project is fully configured, including a preset PYTHONPATH so as to support debugging, pep8 import checks, auto completion

How to use it

Since the recipe is an extension to anybox.recipe.openerp, the first step, if not done, is to add your anybox.recipe.openerp, configuration to buildout.cfg and include it in ${buildout:parts}.

An example:

[buildout]
...
parts = ... openerp

[openerp]
recipe = anybox.recipe.openerp[bzr]:server
version = bzr lp:opcb-server/7.0  openerp last:1 bzr-init=stacked-branch
addons = bzr lp:ocb-addons/7.0  addons last:1 bzr-init=stacked-branch
         bzr lp:ocb-web/7.0 addons-web last:1 subdir=addons bzr-init=stacked-branch
         bzr lp:server-env-tools addons-server-env-tools last:1 bzr-init=stacked-branch
....

Another example using git and Odoo V8:

[buildout]
...
parts = ... openerp

[openerp]
recipe = anybox.recipe.openerp[bzr]:server
version = git https://github.com/odoo/odoo.git odoo master
addons = local parts/odoo/addons
....

A good practice is to use the inheritance mechanism of buildout to define your development environment in an other file such as devel.cfg:

[buildout]
extends = buildout.cfg
parts = ... pydevproject

[pydevproject]
<= openerp
recipe = acsone.recipe.odoo.pydev
name = my_project_name
python-version = python 2.7
python-interpreter = Default
eggs += any_additional_egg_you_want

Then prepare your virtualenv and install zc.buildout

$ virtualenv

$ bin/pip install zc.buildout

To run the recipe and generate your project, run

$ bin/buildout install pydevproject

The launch eclipse, import the project and you are ready to go. To debug, use bin/start_openerp_pydev in the eclipse debug configuration.

Supported options

These match the options of a PyDev Project.

name

The project name. This is just for Eclipse and can be anything you want.

python-version

The combination of interpreter and grammar version. E.g. python 2.7 (default is python 2.7)

python-interpreter

The interpreter name, as configured in the the Eclipse Preferences for PyDev. Usually Default is fine. (default is Default)

Behind the curtain

In addition to the startup scripts and configuration file generated by anybox.recipe.openerp., this recipe generates the two files that define a PyDev Project:

  • .project

  • .pydevproject.

While eggs and their dependencies are declared as external libraries, the server and its addons are declared as source folders. In the same time, the recipe uses in background the collective.recipe.omelette recipe to build a unified directory structure of declared addons, symlinking to the actual contents, in order to allow proper pep8 check and auto completion. This directory structure is also declared as external dependency to avoid confusion between source folder and the unified directory structure.

It’s a know issue that when same addons are both in the PYTHONPATH and addons_path (it’s the case with the generated project definition), it’s not possible to start the server due to import errors. To avoid this problem, the recipe adds to the generated scripts , specific code to remove parts of sys.path that are also in addons_path.

Contributors

Laurent Mignon (ACSONE SA/NV), Author

Change history

1.1 (2014-09-08)

  • github #1: support new addons layout on github. The eclipse syntax analyser also scan addons directory at root of the cloned directory if exists. BTW, code completion is fully functionnal with odoo sources distribution from github.

1.0 (2014-05-30)

  • First release [ACSONE SA/NV]

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acsone.recipe.odoo.pydev-1.1.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file acsone.recipe.odoo.pydev-1.1.tar.gz.

File metadata

File hashes

Hashes for acsone.recipe.odoo.pydev-1.1.tar.gz
Algorithm Hash digest
SHA256 4591cfaad5715c86b382521e4fd7619b336ca66e8379b10f13576a13331fa324
MD5 64f4fad63d08f1cfb0b1d6c960ac93e2
BLAKE2b-256 fea32dbae7476d7628a5a6659b8d83b681c0377c154a1e7eb4282e77b3982d78

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page