tessl install tessl/pypi-varname@0.15.0Dark magics about variable names in python
Agent Success
Agent success rate when using this tile
90%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.41x
Baseline
Agent success rate without this tile
64%
A utility for logging and tracking variable assignments in different contexts.
Track variable names for direct assignments where the assignment is the primary statement.
user_data = create_record() should return "user_data") @testfirst, second = create_pair() should return ("first", "second")) @testconfig: Config = create_config() should return "config") @testTrack variable names when assignments occur within expressions or control flow statements.
if data := fetch_data(): ... should return "data") @testwhile item := get_next(): ... should return "item") @testresult = process(data := fetch()) where fetch() is called should return "data") @test@generates
def track_direct_assignment() -> str | tuple[str, ...]:
"""
Captures the variable name(s) from a direct assignment statement.
Returns a string for single assignment or tuple of strings for multiple assignments.
Should be called from functions that are directly assigned to variables.
"""
pass
def track_expression_assignment() -> str:
"""
Captures the variable name from an assignment within an expression context.
Returns a string with the variable name.
Should be called from functions used in walrus operators or expression contexts.
"""
passProvides variable name introspection capabilities.
@satisfied-by