[Bf-committers] (re) proposal for pep8 for blender scripts

Ton Roosendaal ton at blender.org
Fri Oct 30 13:12:57 CET 2009


Hi,

I'm fine to follow Campbell's proposal. The 80 chars thing can be kept 
liberal, as a practical suggestion than a strict rule.

Python.org devs: just make using tabs an error, come on, be bold! :)

-Ton-

------------------------------------------------------------------------
Ton Roosendaal  Blender Foundation   ton at blender.org    www.blender.org
Blender Institute   Entrepotdok 57A  1018AD Amsterdam   The Netherlands

On 29 Oct, 2009, at 14:53, Campbell Barton wrote:

> While at BConf I met with Stani (SPE, Phatch author) and Theo (PySlate
> author), One thing that came up was how we don't have (any?) python
> developers,
> in the sense that active developers who write python scripts have
> learnt from looking at other scripts in blender (myself), or C
> developers who also write some python.
>
> Who is/isn't a python developer is a bit vague, but I always get
> really negative responses in #python whenever I show them our code,
> and blender somehow has a very bad reputation there.
>
> Stani and I went over the existing python scripts and API to see how
> it could better conform to the 'python way', he found a few things
> that are easy to fix, (eg. using __somevar__ when we shouldn't, maybe
> follow how django defines fields (rna props)).
>
> What interested me most was how we could use PyLint, PyFlages and
> pythons pep8 checker to ensure consistent style.
> we ran some tests on blenders code which showed many mixed
> tabs/spaces, interestingly some bugs too (vars used before defined).
>
> http://www.python.org/dev/peps/pep-0008/
>
> I already wrote a mail suggesting pep8 which wasn't widely accepted
> but now I'm more convinced then before that this is a worthwhile
> change.
> (reference old mail
> http://lists.blender.org/pipermail/bf-taskforce25/2009-May/000827.html)
>
> One exception I think we should make is the 80 width line.
> Screen size is given as a reason for this however blender is graphics
> software and I think its fair to assume people are not developing
> blender on tiny screens,
> pythons tools can be configured not to check for this.
>
> Reasons to switch...
> 1) pep8 is strongly encouraged by (official) python
> 2) people who learn python in blender can transfer better to other 
> projects
> 3) python developers have an easier time working on blenders code.
> 4) We get to use pythons tools for checking consistency. (and even 
> finding bugs)
>
> To me the reasons NOT to switch are just lazy
> 1) have to configure editor to use spaces
> 2) takes some effort to convert
>
> While on its own style isn't so important to me I think this is one
> way that we can improve blender/python.
>
> With Phatch this change was made by converting files one by one,
> commenting each as conforming, so as not to try fix all errors at
> once.
> Then changes to these scripts can be maintained by validated and 
> corrected.
> To me this seems a sensible way to get this done.
>
> -- 
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



More information about the Bf-committers mailing list