[Bf-committers] Python API breakage - squeaking wheels

Campbell Barton ideasman42 at gmail.com
Tue May 28 12:26:43 CEST 2013


On Tue, May 28, 2013 at 1:32 AM, Campbell Barton <ideasman42 at gmail.com> wrote:
>>> [1] https://github.com/mattebb/3delightblender/blob/master/ui.py
>>> bpy.utils.register_module(): failed to registering class <class
>>> '3delightblender.ui.InlineRibPanel'>
>>> Traceback (most recent call last):
>>>   File "bin/blender.app/Contents/MacOS/2.67/scripts/modules/bpy/utils.py",
>>> line 578, in register_module
>>>     register_class(cls)
>>> AttributeError: expected Panel, InlineRibPanel class to have an "draw"
>>> attribute
>>
>> Quick reply about this python exception, the problem here is that you
>> have a mix-in class that gets registered.
>> InlineRibPanel, checked with 2.62 and it has the same behavior (quite
>> sure its been this way for over a year).
>>
>> So fix is to change:
>> class InlineRibPanel(CollectionPanel, bpy.types.Panel):
>> to...
>> class InlineRibPanel(CollectionPanel):
>
>
> Got the 3delight addon loading up ok.
> patch available here:
> https://github.com/mattebb/3delightblender/pull/5
>
> From the looks of it pynodes and ui-list updates in blender were the
> only significant api change that broke this.
> (both intentional changes/breakages to the API).
>
> --
> - Campbell

Follow up mail on this topic...

>From what I can see the recent breakages that happened for Matt's
3delight addon were known and intentional (PyNodes & UI-List), We
didn't do as good a job as we should of documenting these changes but
from what I can see the breakages at least were not caused by
'constant renaming' or general carelessness on part of devs.

I still am a bit concerned that we get many complaints but very little
real evidence of the cause of addon breakage - just that it happens,
I realize not every project is opensource but enough are that links to
scripts that break would be very helpful for API devs.


My conclusion is...
- BMesh API updates broke (most/all) import export scripts, this
annoyed users & devs giving a bad impression they don't forget
quickly.
- Some more recent breakage in areas of blender that were updated
updated (PyNodes, image alpha changes) - at some point scripts will
break if we change blender, hard to avoid.
- Early on we did indeed make some big changes (addon info header
name, registration, disabling editing settings while drawing)
- There is one exception to my assertion that we have not been all
that bad recently and thats the restriction of context access for
addon startup,
 ... this did indeed break some scripts but this was really bad
practice and I mainly did this because we kept getting complaints
about 3rd party scripts crashing blender - and this was one of the
main causes.


When we do make API changes/breakages (which shouldn't happen often),
just do a better job of documenting them, link to an example of how to
update a script in release logs.

If scripts do break I would prefer to know about it and have devs post
on bf-python which is currently quite low traffic.

But further I think we can continue development as we have been.

-- 
- Campbell


More information about the Bf-committers mailing list