--- id: weakrefmethod version: "1.0.3" license: PSF license_treatment: permissive maintenance: aging --- # weakrefmethod — A WeakMethod class for storing bound methods using weak references. License: permissive · Maintenance: aging · Downloads: 74.0K/mo ## What it is and what it does WeakMethod is a utility for storing references to bound methods without preventing their parent object from being garbage collected. This package backports Python 3.4's standard library WeakMethod class to Python 2.6 and 2.7, allowing developers on those older versions to use weak method references in their code. The package has no runtime dependencies and is a pure-Python implementation. However, it targets Python versions that are no longer actively maintained. Installing this package makes sense only if you are maintaining legacy Python 2 code that specifically needs weak method storage. Use it for: - Prevent memory leaks in Python 2 code by storing weak references to bound methods instead of strong references - Implement observer patterns or event handlers in Python 2 that don't keep objects alive - Maintain legacy Python 2.6 or 2.7 projects that require weak method references without reimplementing the logic ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a WeakMethod class for storing bound methods using weak references, backported to Python 2.6 and 2.7 from Python 3.4's standard library. No, unless you are actively maintaining Python 2.6 or 2.7 code. The package is unmaintained (last release 2016-07-18), and modern Python versions include WeakMethod in the standard library. For any new or current projects, use the built-in weakref.WeakMethod instead. ## Install pip install weakrefmethod uv add weakrefmethod poetry add weakrefmethod ## Installing weakrefmethod Before you install: High install friction due to source distribution only. The package is aging—last release in 2016, no updates since then—and targets Python 2.6 and 2.7, which are long out of support. License in practice: Licensed under the Python Software Foundation License (permissive). No restrictions on use, modification, or distribution in your own code. Quickstart: pip install weakrefmethod from weakrefmethod import WeakMethod class MyClass: def method(self): pass obj = MyClass() weak_method = WeakMethod(obj.method) Package targets Python 2.6 and 2.7, which are no longer supported. WeakMethod is available in the standard library for Python 3.4 and later. Verify before relying: - Whether this package actually works on modern Python versions despite targeting only Python 2.6–2.7 - Whether any real-world projects still depend on this backport or if it is purely historical - Current status of Python 2 support in production environments ## Package facts - License: PSF (permissive) - Python support: unspecified - Install friction: high - Maintenance: aging - Downloads: 74.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags weak references bound methods, weakref WeakMethod backport, weak method storage python 2, garbage collection bound methods, weakref memory management, python-2-legacy, memory-management [View on SkillFed](https://skillfed.io/packages/weakrefmethod) · [View on PyPI](https://pypi.org/project/weakrefmethod/)