Next step after pychecker

Sylvain Thenault sylvain.thenault at nospam.logilab.fr
Tue Feb 1 05:21:24 EST 2005


On Tue, 01 Feb 2005 05:18:12 +0100, Philippe Fremy wrote:
> 	Hi,

Hi

> I would like to develop a tool that goes one step further than pychecker
> to ensure python program validity. The idea would be to get close to what
> people get on ocaml: a static verification of all types of the program,
> without any kind of variable declaration. This would definitely brings a
> lot of power to python.
> 
> The idea is to analyse the whole program, identify constraints on function
> arguments and check that these constraints are verified by other parts of
> the program.

Did you take a look at the starkiller [1] and pypy projects [2] ?

> What is in your opinion the best tool to achieve this ? I had an
> extensive look at pychecker, and it could certainly be extended to do
> the job. Things that still concern me are that it works on the bytecode,
> which prevents it from working with jython and the new .NET python.
> 
> I am currently reading the documentation on AST and visitor, but I am
> not sure that this will be the best tool either. The AST seems quite
> deep and I am afraid that it will make the analysis quite slow and
> complicated.
 
are you talking about the ast returned by the "parser" module, or the ast
from the "compiler" module ? The former is a higher abstraction, using
specific class instances in the tree, and most importantly with all the
parsing junk removed. See [3]. You may also be interested in pylint
[4] which is a pychecker like program built in top of the compiler ast,
and so doesn't require actual import of the analyzed code. However it's
not yet as advanced as pychecker regarding bug detection.

And finally as another poster said you should probably keep an eye open
on the python 2.5 ast branch work...

Hope that helps !

[1]http://www.python.org/pycon/dc2004/papers/1/paper.pdf)
[2]http://codespeak.net/pypy/index.cgi?home
[3]http://www.python.org/doc/current/lib/module-compiler.ast.html
[4]http://www.logilab.org/projects/pylint

-- 
Sylvain Thénault                               LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org





More information about the Python-list mailing list