executiontime


Nameexecutiontime JSON
Version 0.3.6 PyPI version JSON
download
home_page
SummaryA simple function decorator to display its execution time on the console or in the logs.
upload_time2024-02-23 15:16:35
maintainer
docs_urlNone
authorTimokasse
requires_python>=3.9,<4.0
licenseMIT
keywords testing logging time performance execution
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # executiontime

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Timokasse/executiontim/blob/master/LICENSE)

This module provides a simple function decorator to display its execution time on the console or in the logs.

## Installation

Simply install the package with `pip`:

```bash
pip install executiontime
```

## Usage

You simply need to decorate the function and specify a message template.

```python
from executiontime import printexecutiontime

@printexecutiontime("My function's execution took {0}")
def my_function():
    pass

if __name__ == '__main__':
    my_function()
```

By default, the message will be displayed on the console. But it is also possible to specify a log function, for example.

```python
from logging import info, INFO, basicConfig
from executiontime import printexecutiontime

@printexecutiontime("My function's execution took {0}", display=info)
def my_function():
    pass

if __name__ == '__main__':
    basicConfig(level=INFO)
    my_function()

```

It is also easy to add a little bit of color:

```python
from executiontime import printexecutiontime, LIGHTBLUE

@printexecutiontime("My function's execution took {0}", color=LIGHTBLUE)
def my_function():
    pass

if __name__ == '__main__':
    my_function()
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "executiontime",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "testing,logging,time,performance,execution",
    "author": "Timokasse",
    "author_email": "Timokasse@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/49/62/88ac91a53d02a21c214e2a3b2e849cc8fb026e5fc6175a71eb576d065ae9/executiontime-0.3.6.tar.gz",
    "platform": null,
    "description": "# executiontime\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Timokasse/executiontim/blob/master/LICENSE)\n\nThis module provides a simple function decorator to display its execution time on the console or in the logs.\n\n## Installation\n\nSimply install the package with `pip`:\n\n```bash\npip install executiontime\n```\n\n## Usage\n\nYou simply need to decorate the function and specify a message template.\n\n```python\nfrom executiontime import printexecutiontime\n\n@printexecutiontime(\"My function's execution took {0}\")\ndef my_function():\n    pass\n\nif __name__ == '__main__':\n    my_function()\n```\n\nBy default, the message will be displayed on the console. But it is also possible to specify a log function, for example.\n\n```python\nfrom logging import info, INFO, basicConfig\nfrom executiontime import printexecutiontime\n\n@printexecutiontime(\"My function's execution took {0}\", display=info)\ndef my_function():\n    pass\n\nif __name__ == '__main__':\n    basicConfig(level=INFO)\n    my_function()\n\n```\n\nIt is also easy to add a little bit of color:\n\n```python\nfrom executiontime import printexecutiontime, LIGHTBLUE\n\n@printexecutiontime(\"My function's execution took {0}\", color=LIGHTBLUE)\ndef my_function():\n    pass\n\nif __name__ == '__main__':\n    my_function()\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple function decorator to display its execution time on the console or in the logs.",
    "version": "0.3.6",
    "project_urls": null,
    "split_keywords": [
        "testing",
        "logging",
        "time",
        "performance",
        "execution"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86ac05db226d831d664e8e08191a412b3e4b159d14584a17e2aad042db702bde",
                "md5": "0fbc7141312d28f145255ce13b99e8e7",
                "sha256": "482e533fcdbe4ba0486ddd527bb2b29652b927a3067e4ced828a75a200912dab"
            },
            "downloads": -1,
            "filename": "executiontime-0.3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0fbc7141312d28f145255ce13b99e8e7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 3440,
            "upload_time": "2024-02-23T15:16:34",
            "upload_time_iso_8601": "2024-02-23T15:16:34.496288Z",
            "url": "https://files.pythonhosted.org/packages/86/ac/05db226d831d664e8e08191a412b3e4b159d14584a17e2aad042db702bde/executiontime-0.3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "496288ac91a53d02a21c214e2a3b2e849cc8fb026e5fc6175a71eb576d065ae9",
                "md5": "8ed183601a3bf3f9f7cb7e7945ba98dd",
                "sha256": "897906e2be96c1ecb7acafb9b9dab011a8e547597ae7e5b104855efd5bf9ef5b"
            },
            "downloads": -1,
            "filename": "executiontime-0.3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "8ed183601a3bf3f9f7cb7e7945ba98dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 2993,
            "upload_time": "2024-02-23T15:16:35",
            "upload_time_iso_8601": "2024-02-23T15:16:35.579229Z",
            "url": "https://files.pythonhosted.org/packages/49/62/88ac91a53d02a21c214e2a3b2e849cc8fb026e5fc6175a71eb576d065ae9/executiontime-0.3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-23 15:16:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "executiontime"
}
        
Elapsed time: 2.71116s