--- id: baron version: "0.10.1" license: lgplv3+ license_treatment: copyleft maintenance: abandoned --- # baron — Full Syntax Tree for python to make writing refactoring code a realist task License: copyleft · Maintenance: abandoned · Downloads: 414.1K/mo ## What it is and what it does Baron is a Full Syntax Tree library that parses Python source code into a JSON-like structure while preserving all formatting details—comments, whitespace, and line breaks—that a standard AST discards. Unlike Python's built-in ast module, Baron guarantees that converting code to FST and back produces identical source code. The library outputs trees similar to Python AST but with modifications to be more human-intuitive, making it suitable for code transformation tasks like variable renaming, function inlining, and refactoring operations where formatting must be preserved. The package depends only on rply and installs with low friction. However, it is no longer actively maintained—the last release was in December 2021 and the project is marked abandoned. Baron is positioned as a low-level tool; the documentation explicitly recommends using RedBaron (a higher-level abstraction built on Baron) for most use cases. Support covers Python 2 grammar and up to Python 3.7. Use it for: - Rename variables in source files without accidentally modifying strings or comments containing the same text - Inline functions or methods while preserving original code formatting and structure - Extract code blocks into separate functions or modules with exact formatting preservation - Implement custom refactoring operations not available in standard IDE tools or rope - Analyze and transform code while maintaining exact source formatting for version control diffs ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Baron parses Python source code into a Full Syntax Tree (FST) that preserves all formatting, comments, and whitespace, and can be converted back to identical source code. No—unless you are working with a frozen Python 2 or 3.7 codebase and have no alternative. The project is abandoned (last commit 2021-12-09, 1709 days ago), and the documentation recommends RedBaron as the usable layer instead. If you need FST parsing for modern Python or active maintenance, look elsewhere; if you need it for legacy code and can accept a frozen dependency, proceed with caution. ## Install pip install baron uv add baron poetry add baron ## Installing baron Before you install: Low install friction with a single dependency (rply). However, the project is abandoned—last release was 2021-12-09 and no commits since then. Use only if you need FST parsing for Python 2 through 3.7 grammar and are comfortable maintaining a frozen codebase. License in practice: Licensed under LGPLv3 (copyleft). Derivative works and modifications must be distributed under the same license; proprietary use requires careful compliance review. Quickstart: from baron import parse, dumps source_code = "x = 1" fst = parse(source_code) reconstructed = dumps(fst) assert reconstructed == source_code Verify before relying: - Whether baron handles Python 3.8+ grammar (documentation states support up to 3.7) - Current stability and bug-fix status given 1709 days since last release - Whether RedBaron (the recommended higher-level abstraction) is actively maintained as an alternative ## Package facts - License: lgplv3+ (copyleft) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 414.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python full syntax tree parser, preserve formatting ast, refactoring code transformation, python source code analysis, fst json tree representation, syntax-tree, code-refactoring, abandoned [View on SkillFed](https://skillfed.io/packages/baron) · [View on PyPI](https://pypi.org/project/baron/)