$npx skillfedfor your agent

varname

Dark magics about variable names in python.

Worth itPyPI Software DevelopmentReleased Apr 2026414.9K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — varname-1.0.0-py3-none-any.whl
v1.0.0 · released 2026-04-16 · Python >=3.9 · 2 runtime deps: executing, typing-extensions

Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and solves a real metaprogramming need. It is well-documented with concrete examples. Install it if you need runtime variable name introspection; skip it if your code does not require that capability.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.9 or later; earlier versions need varname < 0.11.
  • Low install friction with only two runtime dependencies (executing and typing-extensions).
  • Actively maintained with recent commits; last release 120 days ago and repository shows 357 stars.

License · maintenance · safety

MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

last release 2026-04-16 (120 days) · last repo commit 2026-04-16 · 357 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 414,920 downloads/mo, #6,828 on PyPI

Verify before relying

from varname import varname

def function():
    return varname()

func = function()  # func == 'func'
  • Whether frame inspection works reliably across all Python 3.9+ implementations and edge cases.
  • Performance characteristics when called repeatedly in hot code paths.
  • Compatibility with async/await patterns beyond the asyncio.run example shown.
Same gist for agents: .md · .json

What it is and what it does

Varname is a metaprogramming library that uses stack frame inspection to retrieve the names of variables that function or class calls are assigned to, from inside those functions or classes. It exposes this core capability through functions like `varname()` (to get the assignment variable name), `argname()` (to fetch the names or source of arguments passed to a function), and `will()` (to detect the next attribute access). The library depends on executing for bytecode inspection and typing-extensions for type hints.

The package is useful when you need runtime introspection of variable names—for instance, to automatically populate an object's `__varname__` attribute with the name it was assigned to, to create dictionaries without explicitly repeating key names, or to implement debugging utilities that print variable names alongside their values. It handles complex cases like multiple assignment, nested unpacking, and calls wrapped through intermediate functions.

Use it for

  • Automatically populate an object's id or name field with the variable name it was assigned to.
  • Create dictionaries from variables without repeating key names (jsobj helper).
  • Implement debug utilities that print variable names and values together.
  • Fetch the names or source expressions of arguments passed to a function.
  • Detect which attribute will be accessed next on an object (will function).

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is actively maintained, has low install friction, carries a permissive MIT license, and solves a real metaprogramming need. It is well-documented with concrete examples. Install it if you need runtime variable name introspection; skip it if your code does not require that capability.

Install

varname on PyPI

Before you install

Low install friction with only two runtime dependencies (executing and typing-extensions). Actively maintained with recent commits; last release 120 days ago and repository shows 357 stars.

Requires Python 3.9 or later; earlier versions need varname < 0.11.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

from varname import varname

def function():
    return varname()

func = function()  # func == 'func'

Verify before relying

  • Whether frame inspection works reliably across all Python 3.9+ implementations and edge cases.
  • Performance characteristics when called repeatedly in hot code paths.
  • Compatibility with async/await patterns beyond the asyncio.run example shown.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
executingtyping-extensions
MaintenanceActively maintained 120 days since the last release
Last repo commit
First released
Downloads414,920 / month, #6,828 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: varname-1.0.0-py3-none-any.whl

Tags

Capabilities
get variable name at runtimeretrieve function argument namesdetect variable assignment nameintrospect variable names pythonruntime variable name inspectionfunction argument source codeattribute name detection
Topics
metaprogrammingintrospectiondebugging

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “get variable name at runtime”

  • varnameRetrieves variable names at runtime from inside functions and…
  • nameofRetrieves the name of a variable or attribute as a string at runtime…
  • envierEnvier extracts application configuration from environment variables…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also nameof · executing · getname · singleton-decorator · patchy · read-version · snoop · argbind · public · icecream