{"id":2370,"library":"about-time","title":"about-time","description":"Easily measure timing and throughput of code blocks, with beautiful human friendly representations. It offers highly readable output for durations and counts, supporting various units from nanoseconds to days, and is particularly useful for profiling iterable operations like generators. The current version is 4.2.2, with active development indicated by frequent releases.","status":"active","version":"4.2.2","language":"en","source_language":"en","source_url":"https://github.com/rsalmei/about-time","tags":["timing","profiling","performance","human-readable","context-manager","iterator","generator"],"install":[{"cmd":"pip install about-time","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"about_time","correct":"from about_time import about_time"}],"quickstart":{"code":"import time\nfrom about_time import about_time\n\n# Example 1: Basic timing with a context manager\nwith about_time('Doing some work'):\n    time.sleep(0.123)\n    _ = [x * x for x in range(1000000)]\n\n# Example 2: Timing an iterable (e.g., a generator)\ndef my_generator(n):\n    for i in range(n):\n        time.sleep(0.001)\n        yield i\n\nwith about_time('Processing generator items') as t:\n    total_sum = sum(my_generator(10))\n    print(f'Total sum: {total_sum}')\n\n# Accessing detailed results after the block\nprint(f\"Duration: {t.duration_human}\")\nprint(f\"Throughput: {t.throughput_human}\")","lang":"python","description":"Demonstrates basic usage with a context manager and advanced usage for profiling iterables/generators, showing human-readable output and direct attribute access."},"warnings":[{"fix":"Upgrade to Python 3.8+ or pin `about-time` to a version <4.2.2 if Python 3.7 is required.","message":"Version 4.2.2 dropped support for Python 3.7. Ensure your environment is Python 3.8 or newer for compatibility.","severity":"breaking","affected_versions":">=4.2.2"},{"fix":"Refer to the official documentation for migration guidelines if upgrading from versions prior to 4.0.0.","message":"Version 4.0.0 introduced significant changes to the API and output, including new global features, new objects for each operation, and simpler human-friendly representations. Code written for pre-4.0 versions may require adaptation.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade to version 4.2.2 or higher to ensure the `precision` parameter behaves as expected.","message":"Prior to version 4.2.2, the `precision` parameter for output formatting was not truly optional, potentially causing unexpected behavior. This was fixed in 4.2.2.","severity":"gotcha","affected_versions":"<4.2.2"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}