← Back to team overview

openerp-expert-framework team mailing list archive

handling deprecations in the source code of OpenERP

 

Hello,

I wanted to bring to your attention the proposal I made in
https://bugs.launchpad.net/openobject-server/+bug/1052392 and for which
I proposed an implementation in
https://code.launchpad.net/~c2c/openobject-server/trunk-deprecate-osv_osv

This is about using python stdlib DeprecationWarning and warnings module
to tag deprecated features, rather than just putting a comment in the
source code where it will likely be missed by most developers.

The trunk-deprecate-osv_osv branch provides support code to do issue
such warnings and control how they are displayed, and implements a
tricky bit, namely the definition of a metaclass for the deprecation of
osv.osv and osv.osv_memory as a base class. There are also 2 linked
branches replacing these base classes by orm.Model and
orm.TransientModel respectively in server and addons.

I have not gone through all the comments mentioning deprecation in the
code base to add deprecation warnings and the @deprecated decorator, as
I first wanted some feedback about this.

Another important thing on which I have no control is the definition of
a deprecation policy. In my opinion there should be a well defined
workflow for feature deprecation, so that developers can plan for it and
act accordingly. The way I've been practicing in other projects is that
when a feature is deprecated, it stays available for a guaranteed number
of releases (e.g. 1 major release), after which it is dropped
altogether. So this would mean that a method or class marked as
deprecated in 6.x would still be available in 7.x and would be dropped
in 8.0. Optionally, it is possible to tag a feature as Pending
Deprecation, in which case it is deprecated in the next stable release
and then moves on as previously. All this requires tagging the
DeprecationWarning with the version in which they were introduced : a
simple "[6.1]" at the beginning of the deprecation message is generally
enough. This is something I did not do in the trunk-deprecate-osv_osv
branch.

Thanks for your attention


-- 
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com



Follow ups