methodtools
Expand standard functools to methods
Decision gist · record as of 2026-08-14
Yes, if you need method caching and are not on Python 3.9+. For recent Python versions, verify first whether functools.lru_cache has addressed method caching natively; if not, methodtools is a straightforward, dependency-free solution. Dormant maintenance is acceptable for a stable, narrow-scope utility with no known vulnerabilities.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with no runtime dependencies.
- Dormant maintenance (last release 2023-02-05, last commit 2024-08-23) but repository remains active and unarchived.
License · maintenance · safety
BSD 2-Clause License (permissive) — BSD 2-Clause License (permissive) — you may use, modify, and distribute freely with minimal restrictions; suitable for both open and closed projects.
last release 2023-02-05 (1286 days) · last repo commit 2024-08-23 · 85 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 11,178,756 downloads/mo, #1,412 on PyPI
Alternatives
Verify before relying
pip install methodtools
from methodtools import lru_cache
class A:
@lru_cache()
def cached_method(self, x):
return x * 2- Whether functools32 is still required or recommended for Python 2 support in modern environments.
- Performance characteristics compared to functools.lru_cache on modern Python versions.
- Whether the package is actively maintained or if functools.lru_cache has since addressed method caching.
What it is and what it does
methodtools extends Python's standard functools module to handle caching on methods, classmethods, and staticmethods—scenarios where functools.lru_cache does not work as expected. The core feature is lru_cache, a decorator that caches function results but respects the lifetime semantics of different callable types: instance methods cache per object, classmethods and staticmethods cache per class, and regular functions cache globally.
The package solves a real problem: functools.lru_cache treats bound methods as distinct on each access, defeating the cache. methodtools detects the callable type and manages cache storage accordingly. It supports Python 2.7 through 3.11 and has no runtime dependencies, making it a lightweight drop-in replacement for functools when you need method caching.
Use it for
- Cache expensive computations in instance methods where results depend on object state but should persist across calls.
- Cache class-level computations (e.g., configuration parsing) that should be shared across all instances.
- Cache pure utility functions defined as staticmethods without creating spurious cache misses on each call.
- Migrate code from functools.lru_cache to methodtools when you discover caching is not working on bound methods.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need method caching and are not on Python 3.9+.
For recent Python versions, verify first whether functools.lru_cache has addressed method caching natively; if not, methodtools is a straightforward, dependency-free solution. Dormant maintenance is acceptable for a stable, narrow-scope utility with no known vulnerabilities.
Install
methodtools on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Dormant maintenance (last release 2023-02-05, last commit 2024-08-23) but repository remains active and unarchived.
License in practice
BSD 2-Clause License (permissive) — you may use, modify, and distribute freely with minimal restrictions; suitable for both open and closed projects.
Quickstart
pip install methodtools
from methodtools import lru_cache
class A:
@lru_cache()
def cached_method(self, x):
return x * 2
Verify before relying
- Whether functools32 is still required or recommended for Python 2 support in modern environments.
- Performance characteristics compared to functools.lru_cache on modern Python versions.
- Whether the package is actively maintained or if functools.lru_cache has since addressed method caching.
Package facts
| License | BSD 2-Clause License permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 1,286 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 11,178,756 / month, #1,412 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: methodtools-0.4.7-py2.py3-none-any.whl
Tags
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 › “lru cache for methods”
- methodtoolsProvides LRU caching for methods, classmethods, and staticmethods…
- async-lruAn LRU cache decorator for async functions that deduplicates…
- pylruProvides a pure-Python LRU (least recently used) cache with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
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.
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.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
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.
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.
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.
See also backports.functools-lru-cache · cachetools · cached_method · memoization · asyncache · cachetools-async · functools32 · klepto · pytest-antilru · fan-tools