Registry / serialization / astatine

astatine

JSON →
library0.3.3pypypi✓ verified 80d ago

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.

pip install astatine
INSTALL
IMPORT
SIG · ASTATINE
A
astatine
serializationpythonv0.3.3
Install
1.8s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ASTTokens
from astatine import ASTTokens
from astatine import format_node
get_attribute_name
from astatine import get_attribute_name
get_constants
from astatine import get_constants

Basic usage: format AST nodes, compare structures, and convert AST back to source code.

import ast from astatine import format_node, compare_nodes, unparse tree = ast.parse('x = 1 + 2') print(format_node(tree)) # compare nodes node1 = ast.parse('a + b').body[0].value node2 = ast.parse('a + b').body[0].value print(compare_nodes(node1, node2)) # True # unparse to source print(unparse(tree))
Debug
Known issues
deprecatedastatine is in maintenance mode with no active development since 2023. Future Python versions (3.12+) may break compatibility.
fix
Consider using Python's built-in ast module when possible, or switch to active alternatives like 'astor' or 'typed_ast'.
affects: all versions
gotchaThe 'unparse' function does not produce valid Python code for all AST nodes (e.g., f-strings with complex expressions may raise errors).
fix
Use ast.unparse (Python 3.9+) for reliable output, or thoroughly test astatine's unparse on your ASTs.
affects: all
gotchaastatine's 'walk' function may behave differently than ast.walk for some node types (e.g., it can miss certain subtrees).
fix
Prefer ast.walk for standard traversal unless you specifically need astatine's behavior.
affects: all
Upgrade
Version history
0.3.3latest on PyPI · released Aug 15, 2023
Audit
Dependencies
astroidoptionalUsed for some AST utilities, optional.
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
astatine — pip install astatine · libregistry