{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/2"}],"enrichment":{"capability":"Provides LRU caching for methods, classmethods, and staticmethods with proper lifetime management tied to instances or classes, extending functools.lru_cache to work correctly on class-bound callables.","skillfed_tags":["caching","functools-extension"],"use_cases":["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."],"what_it_does":"methodtools extends Python's standard functools module to handle caching on methods, classmethods, and staticmethods\u2014scenarios 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.\n\nThe 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.","worth_installing":"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."},"id":"methodtools","links":{"html":"https://skillfed.io/packages/methodtools","md":"https://skillfed.io/packages/methodtools.md","pypi":"https://pypi.org/project/methodtools/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2023-02-05","license_spdx":null,"license_treatment":"permissive","name":"methodtools","python_support":"unspecified","summary":"Expand standard functools to methods"},"popularity":{"monthly_downloads":11178756,"position":1412,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"0.4.7"}
