{"id":23282,"library":"astatine","title":"astatine","description":"A collection of handy helper functions for Python's AST module. Provides utilities to simplify AST manipulation, node comparison, pattern matching, and source code reconstruction. Current version 0.3.3 requires Python >=3.6 and is in maintenance mode with no recent releases since 2023.","status":"maintenance","version":"0.3.3","language":"python","source_language":"en","source_url":"https://github.com/python-formate/astatine","tags":["ast","utility","python-ast","code-analysis","ast-tools"],"install":[{"cmd":"pip install astatine","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Used for some AST utilities, optional.","package":"astroid","optional":true}],"imports":[{"note":"","wrong":"","symbol":"format_node","correct":"from astatine import format_node"},{"note":"","wrong":"","symbol":"compare_nodes","correct":"from astatine import compare_nodes"},{"note":"","wrong":"","symbol":"walk","correct":"from astatine import walk"},{"note":"'ast.unparse' is available in Python 3.9+, but astatine's unparse works on older versions and has different behavior.","wrong":"from ast import unparse","symbol":"unparse","correct":"from astatine import unparse"}],"quickstart":{"code":"import ast\nfrom astatine import format_node, compare_nodes, unparse\n\ntree = ast.parse('x = 1 + 2')\nprint(format_node(tree))\n# compare nodes\nnode1 = ast.parse('a + b').body[0].value\nnode2 = ast.parse('a + b').body[0].value\nprint(compare_nodes(node1, node2))  # True\n# unparse to source\nprint(unparse(tree))","lang":"python","description":"Basic usage: format AST nodes, compare structures, and convert AST back to source code."},"warnings":[{"fix":"Consider using Python's built-in ast module when possible, or switch to active alternatives like 'astor' or 'typed_ast'.","message":"astatine is in maintenance mode with no active development since 2023. Future Python versions (3.12+) may break compatibility.","severity":"deprecated","affected_versions":"all versions"},{"fix":"Use ast.unparse (Python 3.9+) for reliable output, or thoroughly test astatine's unparse on your ASTs.","message":"The 'unparse' function does not produce valid Python code for all AST nodes (e.g., f-strings with complex expressions may raise errors).","severity":"gotcha","affected_versions":"all"},{"fix":"Prefer ast.walk for standard traversal unless you specifically need astatine's behavior.","message":"astatine's 'walk' function may behave differently than ast.walk for some node types (e.g., it can miss certain subtrees).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to 0.3.3: pip install --upgrade astatine","cause":"Older version of astatine (pre-0.3.0) did not include unparse.","error":"AttributeError: module 'astatine' has no attribute 'unparse'"},{"fix":"Check documentation for correct signature: format_node(node, indent=2).","cause":"The 'indent' parameter was introduced in 0.2.0; using older version or wrong signature.","error":"TypeError: format_node() got an unexpected keyword argument 'indent'"},{"fix":"Install version 0.1.0 or later: pip install 'astatine>=0.1.0'","cause":"The 'walk' function was added in 0.1.0, but might be missing if installed a very old version.","error":"ImportError: cannot import name 'walk' from 'astatine'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}