or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/varname@0.15.x
tile.json

tessl/pypi-varname

tessl install tessl/pypi-varname@0.15.0

Dark 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%

task.mdevals/scenario-5/

Variable Name Logger

A utility for logging and tracking variable assignments in different contexts.

Capabilities

Direct Assignment Tracking

Track variable names for direct assignments where the assignment is the primary statement.

  • When a variable is directly assigned, capture its name (e.g., user_data = create_record() should return "user_data") @test
  • When multiple variables are assigned via unpacking, capture all names (e.g., first, second = create_pair() should return ("first", "second")) @test
  • When assignment includes type annotation, capture the variable name (e.g., config: Config = create_config() should return "config") @test

Expression Context Assignment Tracking

Track variable names when assignments occur within expressions or control flow statements.

  • When assignment occurs in a walrus operator within an if statement, capture the variable name (e.g., if data := fetch_data(): ... should return "data") @test
  • When assignment occurs in a walrus operator within a while loop, capture the variable name (e.g., while item := get_next(): ... should return "item") @test
  • When the result is used as part of a larger expression, capture the variable name (e.g., result = process(data := fetch()) where fetch() is called should return "data") @test

Implementation

@generates

API

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.
    """
    pass

Dependencies { .dependencies }

varname { .dependency }

Provides variable name introspection capabilities.

@satisfied-by