{"id":15559602,"url":"https://github.com/youknowone/methodtools","last_synced_at":"2025-04-05T09:07:20.096Z","repository":{"id":48335747,"uuid":"185008190","full_name":"youknowone/methodtools","owner":"youknowone","description":"Expand functools features(lru_cache) to class - methods, classmethods, staticmethods and even for (unofficial) hybrid methods.","archived":false,"fork":false,"pushed_at":"2024-08-23T10:02:33.000Z","size":27,"stargazers_count":75,"open_issues_count":10,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-13T09:07:10.810Z","etag":null,"topics":["class","classmethod","functools","lru-cache","method","ring","staticmethod","wirerope"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/methodtools/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/youknowone.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-05T09:15:06.000Z","updated_at":"2024-08-24T20:37:17.000Z","dependencies_parsed_at":"2023-02-18T23:45:57.176Z","dependency_job_id":"2d65bf9f-5ecd-4153-ab85-38a5d93659d2","html_url":"https://github.com/youknowone/methodtools","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.07999999999999996,"last_synced_commit":"a2fb8d320fb445bea178194310f2bd58d36b5ff9"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youknowone%2Fmethodtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youknowone%2Fmethodtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youknowone%2Fmethodtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youknowone%2Fmethodtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youknowone","download_url":"https://codeload.github.com/youknowone/methodtools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312078,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class","classmethod","functools","lru-cache","method","ring","staticmethod","wirerope"],"created_at":"2024-10-02T15:53:24.054Z","updated_at":"2025-04-05T09:07:20.049Z","avatar_url":"https://github.com/youknowone.png","language":"Python","readme":"methodtools\n===========\n\n.. image:: https://github.com/youknowone/methodtools/actions/workflows/python-package.yml/badge.svg\n.. image:: https://codecov.io/gh/youknowone/methodtools/graph/badge.svg\n    :target: https://codecov.io/gh/youknowone/methodtools\n\nExpand functools features to methods, classmethods, staticmethods and even for\n(unofficial) hybrid methods.\n\nFor now, methodtools only provides `methodtools.lru_cache`.\n\nUse `methodtools` module instead of `functools` module. Than it will work as\nyou expected.\n\n.. code:: python\n\n    from methodtools import lru_cache\n\n    class A(object):\n\n        # cached method. the storage lifetime follows `self` object\n        @lru_cache()\n        def cached_method(self, args):\n            ...\n\n        # cached classmethod. the storage lifetime follows `A` class\n        @lru_cache()  # the order is important!\n        @classmethod  # always lru_cache on top of classmethod\n        def cached_classmethod(self, args):\n            ...\n\n        # cached staticmethod. the storage lifetime follows `A` class\n        @lru_cache()  # the order is important!\n        @staticmethod  # always lru_cache on top of staticmethod\n        def cached_staticmethod(self, args):\n            ...\n\n    @lru_cache()  # just same as functools.lru_cache\n    def cached_function():\n        ...\n\n\nInstallation\n------------\n\nPyPI is the recommended way.\n\n.. sourcecode:: shell\n\n    $ pip install methodtools\n\nTo browse versions and tarballs, visit:\n    `\u003chttps://pypi.python.org/pypi/methodtools/\u003e`_\n\n.. note::\n    If you are working on Python 2, install also `functools32`.\n\n\nSee also\n--------\n\n- `Documentation \u003chttps://methodtools.readthedocs.io/en/latest/\u003e`_\n- This project is derived from `Ring \u003chttps://github.com/youknowone/ring/\u003e`_,\n  a rich cache interface using the same method handling technique.\n- To learn more about bound method dispatching, see also\n  `wirerope \u003chttps://github.com/youknowone/wirerope\u003e`_.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouknowone%2Fmethodtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouknowone%2Fmethodtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouknowone%2Fmethodtools/lists"}