{"id":24267,"library":"profilehooks","title":"profilehooks","description":"A collection of decorators for profiling, timing, and tracing individual functions. Current version 1.13.0, requires Python >=3.7. Release cadence is intermittent, with minor updates.","status":"active","version":"1.13.0","language":"python","source_language":"en","source_url":"https://github.com/niccokunzmann/profilehooks","tags":["profiling","timing","decorators","performance"],"install":[{"cmd":"pip install profilehooks","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":null,"symbol":"timecall","correct":"from profilehooks import timecall"},{"note":"","wrong":null,"symbol":"profile","correct":"from profilehooks import profile"},{"note":"","wrong":null,"symbol":"coverage","correct":"from profilehooks import coverage"}],"quickstart":{"code":"from profilehooks import timecall, profile\n\ndef slow_function(n):\n    total = 0\n    for i in range(n):\n        total += i ** 2\n    return total\n\n# Time a single call\n@timecall\ndef timed_slow(n):\n    return slow_function(n)\n\ntimed_slow(100000)\n\n# Profile a function\n@profile\ndef profiled_slow(n):\n    return slow_function(n)\n\nprofiled_slow(100000)","lang":"python","description":"Basic usage of @timecall and @profile decorators."},"warnings":[{"fix":"Import sys and direct output: @timecall(stdout=sys.stdout) or use logging.","message":"When using @timecall, the decorator prints timing output to stderr by default. If you capture stdout only, you'll miss the output.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace @cover with @coverage.","message":"The 'cover' decorator is deprecated. Use 'coverage' instead.","severity":"deprecated","affected_versions":">=1.11.0"},{"fix":"Do not use @profile on async functions; use @timecall or manual profiling.","message":"The @profile decorator does NOT work with async functions. Using it on an async def will raise an error or produce no profiling output.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from profilehooks import coverage' instead of 'cover'.","cause":"The 'cover' function was renamed to 'coverage' in version 1.11.0.","error":"AttributeError: module 'profilehooks' has no attribute 'cover'"},{"fix":"Remove @profile from async functions, or use @timecall with appropriate handling.","cause":"The @profile decorator does not support async functions.","error":"TypeError: 'NoneType' object is not callable when using @profile on async function"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}