What is RedBaron?
masterRedBaron is a Python library designed for writing code that modifies source code (refactoring, tool building, or IDE integration).
Key characteristics:
- Lossless Modification: It is built on Baron, which uses a Full Syntax Tree (FST). This guarantees that
ast_to_code(code_to_ast(source_code)) == source_code, meaning it only modifies the parts of the code you explicitly target. - Intuitive API: The API is heavily inspired by BeautifulSoup, making it simple and intuitive for navigating and manipulating Python source code.
- Compatibility: The public API is guaranteed to be retro-compatible until version 2.0.