[code-quality] RedBaron, a bottom-up refactoring lib/tool for python

Laurent Peuch cortex at worlddomination.be
Mon Nov 17 21:07:58 CET 2014


Hello Eduardo,

> My approach was to convert python code to XML (and back to python)
> This allow any generic XML tool to be used to manipulate the XML-code,
> and then convert back to python without the need to create specific tools.

Funny, you aren't the first one I've found who has taken this
approach. This guys is converting lib2to3 output to xml and throwing
lxml on it https://github.com/bukzor/RefactorLib I don't know what
it's worth, he doesn't seem to have done any advertisement for it and
the code is not very big.

> The implementation uses python's AST tree and the tokenize module
> to retrieve information that is thrown away by the AST.
> This way I didnt need to implement my own python parser.
> It ended up being much more work than I expected but I still believe thats
> better than maitaining another parser.

Oh, I understand you so much, I didn't knew how much that would took
me to parse python, if I knew I probably would have never done this
project.

Cheers,

-- 

Laurent Peuch -- Bram


More information about the code-quality mailing list