Brussels / 31 January & 1 February 2015

schedule

RedBaron

a bottom up approach to refactoring in python


Writing code that modifies source code is a task reserved to a small number of audacious developers. RedBaron was built on the foundations of a Lossless Abstract Syntaxe Tree (AST) and serves to make customized refactoring accessible to as many developers as possible. It does so by offering an abstraction that allows to focus on specific objectives regardless of the low-level details.

RedBaron's aim is to make the process of writing of code that modifies source code easy (and fun) enough to change it into a manageable, or even desirable, task. To do so, RedBaron acts like BeautifulSoup/JQuery onto your Python source code. The idea is to make it powerful and expressive enough so that it can be directly used into a Python shell like IPython.

Baron, the basis for RedBaron , is a Syntax Tree for Python meant to preserve every information. In this way, [source code -> tree -> source code] will yield the exact same source code even at the formatting level. Baron is relatively stable; it comprises over 1000 unit tests; it was applied to the top 100 pypi packages; and it is documented. Though still in development, RedBaron is stable and functional. The next step consists in making it enjoyable to use. Around November it comprised more than 1200 unit tests, and was fully documented with numerous examples.

Source code and documentation:

  • RedBaron: https://github.com/psycojoker/redbaron http://redbaron.rtfd.org
  • Baron: https://github.com/psycojoker/baron http://baron.rtfd.org

The ambitious aim of RedBaron is to facilitate the writing of code-writing source code and make this task both realistic and enjoyable.

Speakers

Photo of Laurent Peuch Laurent Peuch

Links