qualname
__qualname__ emulation for older Python versions
What it is and what it does
qualname is a backport shim that adds the `__qualname__` attribute (introduced in Python 3.3) to classes and functions in older Python versions. It works by inspecting and parsing the source code of the module containing the target object, then walking its abstract syntax tree to determine the fully qualified name—for example, 'C.D.g' for a method g inside a nested class D inside class C.
The package is designed for Python 2.6–3.4 codebases that need to introspect nested class and function names before `__qualname__` became standard. It has no runtime dependencies and relies entirely on the `ast` module and source file availability. However, the package has been unmaintained since 2015 and is incompatible with modern Python versions.
Use it for:
- Introspect qualified names of nested classes and methods in Python 2 or early Python 3 code for logging or debugging.
- Support legacy Python 2 codebases that require qualified name information for reflection or dynamic dispatch.
- Provide a uniform API for accessing qualified names across Python 2 and 3.3+ in projects that must support both.
- Enable error reporting or stack trace formatting that includes the full qualified name of a function or class.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a `qualname()` function that emulates Python 3.3+'s `__qualname__` attribute for classes and nested functions in older Python versions by parsing source code and traversing the AST.
No. The package is abandoned (last release 2015-04-11, no updates since then) and explicitly targets Python 2.6–3.4, all of which are end-of-life. Modern Python has `__qualname__` built-in. Install only if you are maintaining legacy Python 2 code with no path to upgrade and have verified the package works in your specific environment.
Install
qualname on PyPI
pip
pip install qualnameuv
uv add qualnamepoetry
poetry add qualnameInstalling qualname
Before you install
High install friction: the package has been abandoned since its only release on 2015-04-11, with no updates since then. It targets Python 2.6–3.4, versions now far outside modern support. Installation may succeed but the package is unmaintained and unlikely to receive bug fixes.
License in practice
BSD license is permissive and imposes minimal restrictions on use or modification, making it safe to incorporate into most projects from a licensing standpoint.
Quickstart
pip install qualname
from qualname import qualname
class C:
class D:
def g(self):
pass
print(qualname(C.D.g)) # 'C.D.g'
Requires source files to be available on disk; does not work with dynamically generated or compiled code. Targets Python 2.6–3.4; behavior on modern Python versions is untested.
Verify before relying
- Whether the package functions correctly on Python 3.5+, given it was last released in 2015 and explicitly targets only up to 3.4.
- Whether source-code-based AST parsing handles all edge cases (decorators, metaclasses, dynamic definitions) reliably.
- Current real-world usage: the package has 395769 monthly downloads but was abandoned in 2015, suggesting either legacy dependents or inflated statistics.
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,143 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 395,769/month — #6,979 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: qualname-0.1.0.tar.gz
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
inspect2Provides the Python 3.6 inspect module API on…
permissive · top 15,000 on PyPI
codefindCodefind locates code objects by filename and…
unclear · top 15,000 on PyPI
openqasm3Provides a reference abstract syntax tree (AST)…
permissive · top 15,000 on PyPI
eval-type-backportEnables newer Python typing syntax (like `X |…
permissive · top 1,000 on PyPI
enum-compatConditionally installs enum34 on Python…
permissive · top 5,000 on PyPI
pkgutil_resolve_nameProvides a backport of Python 3.9's…
permissive · top 1,000 on PyPI
nameofRetrieves the name of a variable or attribute…
permissive · top 15,000 on PyPI
astunparseConverts Python abstract syntax trees (ASTs)…
permissive · top 5,000 on PyPI
dataclassesProvides the PEP 557 dataclasses module for…
permissive · top 5,000 on PyPI
pep8-namingA flake8 plugin that checks Python code for…
permissive · top 5,000 on PyPI