functrace


Namefunctrace JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
SummaryPython library for tracing function calls and performance
upload_time2024-08-16 11:17:18
maintainerNone
docs_urlNone
authorIdan Hazan
requires_python>=3.10
licenseMIT
keywords trace tracer tracing track tracker tracking
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ```plaintext
  _____                    __
_/ ____\_ __  ____   _____/  |_____________    ____  ____
\   __\  |  \/    \_/ ___\   __\_  __ \__  \ _/ ___\/ __ \
 |  | |  |  /   |  \  \___|  |  |  | \// __ \\  \__\  ___/
 |__| |____/|___|  /\___  >__|  |__|  (____  /\___  >___  >
                 \/     \/                 \/     \/    \/
```

**functrace** is a Python library for detailed function call tracing.
It provides logging and performance tracking to help monitor execution, measure timing, and debug effectively.

## Getting Started

To begin using `functrace`, you'll first need to install it. This can be easily done using `pip`.
Simply run the following command to install the package:

```sh
pip install functrace
```

## Quick Start

Get up and running with `functrace` quickly by following this simple example.
Below is a basic usage scenario to help you integrate `functrace` into your project and start tracing function calls.

```python
from functrace import TraceResult, trace

def trace_callback(result: TraceResult) -> None:
    function_call = result.function_call.format()
    elapsed_time = result.elapsed_time.format()
    returned_value = repr(result.returned_value)
    exception = repr(result.exception)
    parts = [function_call]
    if result.is_started:
        parts.extend(['Started'])
    if result.is_completed:
        parts.extend(['Completed', elapsed_time, returned_value])
    if result.is_failed:
        parts.extend(['Failed', elapsed_time, exception])
    message = ' | '.join(parts)
    print(message)

@trace(callback=trace_callback)
def func(a, b, c):
    return a, b, c

if __name__ == '__main__':
    func(1, 2, 3)
    # func(a=1, b=2, c=3) | Started
    # func(a=1, b=2, c=3) | Completed | 1.25 microseconds | (1, 2, 3)
```

## Summary

You can find `functrace` on [PyPI](https://pypi.org/project/functrace) for installation and package details. For comprehensive documentation and usage guides, visit [Read the Docs](https://functrace.readthedocs.io). For source code and contributions, check out the [GitHub](https://github.com/idanhazan/functrace) repository.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "functrace",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "trace, tracer, tracing, track, tracker, tracking",
    "author": "Idan Hazan",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/15/0f/3698f588cd65e6c2dca92bcffc1d08e595cf8fd65adb3711489015f06eb7/functrace-0.0.5.tar.gz",
    "platform": null,
    "description": "```plaintext\n  _____                    __\n_/ ____\\_ __  ____   _____/  |_____________    ____  ____\n\\   __\\  |  \\/    \\_/ ___\\   __\\_  __ \\__  \\ _/ ___\\/ __ \\\n |  | |  |  /   |  \\  \\___|  |  |  | \\// __ \\\\  \\__\\  ___/\n |__| |____/|___|  /\\___  >__|  |__|  (____  /\\___  >___  >\n                 \\/     \\/                 \\/     \\/    \\/\n```\n\n**functrace** is a Python library for detailed function call tracing.\nIt provides logging and performance tracking to help monitor execution, measure timing, and debug effectively.\n\n## Getting Started\n\nTo begin using `functrace`, you'll first need to install it. This can be easily done using `pip`.\nSimply run the following command to install the package:\n\n```sh\npip install functrace\n```\n\n## Quick Start\n\nGet up and running with `functrace` quickly by following this simple example.\nBelow is a basic usage scenario to help you integrate `functrace` into your project and start tracing function calls.\n\n```python\nfrom functrace import TraceResult, trace\n\ndef trace_callback(result: TraceResult) -> None:\n    function_call = result.function_call.format()\n    elapsed_time = result.elapsed_time.format()\n    returned_value = repr(result.returned_value)\n    exception = repr(result.exception)\n    parts = [function_call]\n    if result.is_started:\n        parts.extend(['Started'])\n    if result.is_completed:\n        parts.extend(['Completed', elapsed_time, returned_value])\n    if result.is_failed:\n        parts.extend(['Failed', elapsed_time, exception])\n    message = ' | '.join(parts)\n    print(message)\n\n@trace(callback=trace_callback)\ndef func(a, b, c):\n    return a, b, c\n\nif __name__ == '__main__':\n    func(1, 2, 3)\n    # func(a=1, b=2, c=3) | Started\n    # func(a=1, b=2, c=3) | Completed | 1.25 microseconds | (1, 2, 3)\n```\n\n## Summary\n\nYou can find `functrace` on [PyPI](https://pypi.org/project/functrace) for installation and package details. For comprehensive documentation and usage guides, visit [Read the Docs](https://functrace.readthedocs.io). For source code and contributions, check out the [GitHub](https://github.com/idanhazan/functrace) repository.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python library for tracing function calls and performance",
    "version": "0.0.5",
    "project_urls": {
        "documentation": "https://functrace.readthedocs.io",
        "homepage": "https://pypi.org/project/functrace",
        "repository": "https://github.com/idanhazan/functrace"
    },
    "split_keywords": [
        "trace",
        " tracer",
        " tracing",
        " track",
        " tracker",
        " tracking"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7d193db3b1ae12b5b53ec895d91908c25b723011da181ce94000224617dc0358",
                "md5": "f1c78c4301eb43292e5ac63fae60840f",
                "sha256": "9038dd34165b9c48ec251c13484aa88fb83eef74c43329ee6cab9abb0989f832"
            },
            "downloads": -1,
            "filename": "functrace-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1c78c4301eb43292e5ac63fae60840f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 12586,
            "upload_time": "2024-08-16T11:17:17",
            "upload_time_iso_8601": "2024-08-16T11:17:17.358936Z",
            "url": "https://files.pythonhosted.org/packages/7d/19/3db3b1ae12b5b53ec895d91908c25b723011da181ce94000224617dc0358/functrace-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "150f3698f588cd65e6c2dca92bcffc1d08e595cf8fd65adb3711489015f06eb7",
                "md5": "8820992cf814bfe0ec400f0dbd16cab4",
                "sha256": "08d80efdc4ff3414172c101927aadfe4e25140ad7750bcfa9b0d05f47815e27c"
            },
            "downloads": -1,
            "filename": "functrace-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "8820992cf814bfe0ec400f0dbd16cab4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 17479,
            "upload_time": "2024-08-16T11:17:18",
            "upload_time_iso_8601": "2024-08-16T11:17:18.828005Z",
            "url": "https://files.pythonhosted.org/packages/15/0f/3698f588cd65e6c2dca92bcffc1d08e595cf8fd65adb3711489015f06eb7/functrace-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-16 11:17:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "idanhazan",
    "github_project": "functrace",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "functrace"
}
        
Elapsed time: 0.54969s