wraptimer


Namewraptimer JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://mugendi.github.io/wraptimer/
SummaryAn amazing alternative to Python's builtin timeit module that allows for high resolution timing of functions as well as in-depth line-by-line timing. It also exposes convenient classes to measure execution time for any arbitrary code.
upload_time2023-06-19 15:03:27
maintainer
docs_urlNone
authorAnthony Mugendi
requires_python>=3.9,<4.0
licenseMIT
keywords function time duration trace timer timeit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
 Copyright (c) 2023 Anthony Mugendi
 
 This software is released under the MIT License.
 https://opensource.org/licenses/MIT
-->

# wraptimer
An amazing alternative to Python's builtin `timeit` module that allows for high resolution timing of functions as well as in-depth line-by-line timing. It also exposes convenient classes to measure execution time for any arbitrary code.

### Sync function example
```python
# imports
import time
from wraptimer import TimeIt
# Init
timeit = TimeIt()

# decorate
@timeit.byline
def test_by_line():
    a = 10
    b = 20
    time.sleep(0.8)
    c = a + b

    return [a, b, c]

# run
test_by_line()
```
![](docs/images/sync-screenshot.png) ![](images/sync-screenshot.png)



### Async function example
```python
# Imports
import asyncio
from wraptimer import TimeIt
# Init
timeit = TimeIt()

# decorate
@timeit.byline
async def test_by_line_async():
    a = 10
    b = 20
    await asyncio.sleep(1.25)

    return [a, b]

# run
asyncio.run(test_by_line_async()) 
```
![](docs/images/async-screenshot.png) ![](images/async-screenshot.png)


## Don't need Line-by-line tracing?

Use `@timeit.func` if you do not want to print **line-by-line** durations.

```python
...
@timeit.func
async def test_by_line_async():
    a = 10
    b = 20
    await asyncio.sleep(1.25)

    return [a, b]
```

![](docs/images/func-screenshot.png) ![](images/func-screenshot.png)


## Read the documentation
For more about wraptimer, [Read The Documentation](https://mugendi.github.io/wraptimer/)






            

Raw data

            {
    "_id": null,
    "home_page": "https://mugendi.github.io/wraptimer/",
    "name": "wraptimer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "function,time,duration,trace,timer,timeit",
    "author": "Anthony Mugendi",
    "author_email": "ngurumugz@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/72/c4/ad8bd17174fccdc51a9eef6dc6d944ed535cc5be251148089d49b84c00c9/wraptimer-0.1.2.tar.gz",
    "platform": null,
    "description": "<!--\n Copyright (c) 2023 Anthony Mugendi\n \n This software is released under the MIT License.\n https://opensource.org/licenses/MIT\n-->\n\n# wraptimer\nAn amazing alternative to Python's builtin `timeit` module that allows for high resolution timing of functions as well as in-depth line-by-line timing. It also exposes convenient classes to measure execution time for any arbitrary code.\n\n### Sync function example\n```python\n# imports\nimport time\nfrom wraptimer import TimeIt\n# Init\ntimeit = TimeIt()\n\n# decorate\n@timeit.byline\ndef test_by_line():\n    a = 10\n    b = 20\n    time.sleep(0.8)\n    c = a + b\n\n    return [a, b, c]\n\n# run\ntest_by_line()\n```\n![](docs/images/sync-screenshot.png) ![](images/sync-screenshot.png)\n\n\n\n### Async function example\n```python\n# Imports\nimport asyncio\nfrom wraptimer import TimeIt\n# Init\ntimeit = TimeIt()\n\n# decorate\n@timeit.byline\nasync def test_by_line_async():\n    a = 10\n    b = 20\n    await asyncio.sleep(1.25)\n\n    return [a, b]\n\n# run\nasyncio.run(test_by_line_async()) \n```\n![](docs/images/async-screenshot.png) ![](images/async-screenshot.png)\n\n\n## Don't need Line-by-line tracing?\n\nUse `@timeit.func` if you do not want to print **line-by-line** durations.\n\n```python\n...\n@timeit.func\nasync def test_by_line_async():\n    a = 10\n    b = 20\n    await asyncio.sleep(1.25)\n\n    return [a, b]\n```\n\n![](docs/images/func-screenshot.png) ![](images/func-screenshot.png)\n\n\n## Read the documentation\nFor more about wraptimer, [Read The Documentation](https://mugendi.github.io/wraptimer/)\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An amazing alternative to Python's builtin timeit module that allows for high resolution timing of functions as well as in-depth line-by-line timing. It also exposes convenient classes to measure execution time for any arbitrary code.",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://mugendi.github.io/wraptimer/",
        "Repository": "https://github.com/mugendi/wraptimer"
    },
    "split_keywords": [
        "function",
        "time",
        "duration",
        "trace",
        "timer",
        "timeit"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a205cb3d57249437326b743d130dd3fc7c47d91e1b4c74f68e27eae188ad50c",
                "md5": "edd9c054fd3e77a405587fe7700484d2",
                "sha256": "dc07867e8deb791ad92814fb275a199d22932941b7f14b3721f52a9d58db8efa"
            },
            "downloads": -1,
            "filename": "wraptimer-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "edd9c054fd3e77a405587fe7700484d2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 6136,
            "upload_time": "2023-06-19T15:03:24",
            "upload_time_iso_8601": "2023-06-19T15:03:24.711581Z",
            "url": "https://files.pythonhosted.org/packages/2a/20/5cb3d57249437326b743d130dd3fc7c47d91e1b4c74f68e27eae188ad50c/wraptimer-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72c4ad8bd17174fccdc51a9eef6dc6d944ed535cc5be251148089d49b84c00c9",
                "md5": "ac5d6e1ebb8838c7fbc19babd350bca4",
                "sha256": "678b4f0048675aa5bc7aa589ca174f216d930872b657148584e75e6bdc010af2"
            },
            "downloads": -1,
            "filename": "wraptimer-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ac5d6e1ebb8838c7fbc19babd350bca4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 5198,
            "upload_time": "2023-06-19T15:03:27",
            "upload_time_iso_8601": "2023-06-19T15:03:27.257935Z",
            "url": "https://files.pythonhosted.org/packages/72/c4/ad8bd17174fccdc51a9eef6dc6d944ed535cc5be251148089d49b84c00c9/wraptimer-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-19 15:03:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mugendi",
    "github_project": "wraptimer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "wraptimer"
}
        
Elapsed time: 0.09475s