{"id":21296373,"url":"https://github.com/j0fin/utile","last_synced_at":"2025-06-10T19:04:12.927Z","repository":{"id":37179528,"uuid":"275342531","full_name":"j0fiN/utile","owner":"j0fiN","description":"The python package which eases your \u003ccodeflow\u003e using decorators :sparkle:.","archived":false,"fork":false,"pushed_at":"2022-07-08T08:12:08.000Z","size":268,"stargazers_count":16,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-12T19:24:31.822Z","etag":null,"topics":["concurrent-programming","decorators","package","python3","rust","rust-bindings","utility"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/utile/1.1/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j0fiN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-27T09:48:23.000Z","updated_at":"2022-07-08T08:10:50.000Z","dependencies_parsed_at":"2022-08-18T00:15:27.323Z","dependency_job_id":null,"html_url":"https://github.com/j0fiN/utile","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0fiN%2Futile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0fiN%2Futile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0fiN%2Futile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j0fiN%2Futile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j0fiN","download_url":"https://codeload.github.com/j0fiN/utile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225743977,"owners_count":17517396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrent-programming","decorators","package","python3","rust","rust-bindings","utility"],"created_at":"2024-11-21T14:26:05.238Z","updated_at":"2024-11-21T14:26:06.147Z","avatar_url":"https://github.com/j0fiN.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# utile\n![utile-Logo](https://github.com/j0fiN/Server_Utility/blob/master/docs/utile_logo2.png)\n---\n*The python package which eases your ```\u003ccodeflow\u003e``` using `@decorators`.*  \n### Now integrated with rust!  (docs updated)\n---\n[![Read the Docs](https://img.shields.io/readthedocs/utile?color=informational\u0026logo=Read%20the%20Docs\u0026style=flat-square)](https://utile.readthedocs.io/)\n[![CircleCI](https://img.shields.io/circleci/build/github/j0fiN/utile/master?logo=circleCI\u0026style=flat-square)](https://app.circleci.com/pipelines/github/j0fiN/utile)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/j0fiN/utile/CI-utile?logo=github\u0026style=flat-square)](https://github.com/j0fiN/utile/actions?query=workflow%3ACI-utile)\n[![GitHub](https://img.shields.io/github/license/j0fiN/utile?color=informational\u0026style=flat-square)](https://github.com/j0fiN/utile/blob/master/LICENSE)\n[![Codecov](https://img.shields.io/codecov/c/github/j0fiN/utile?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/j0fiN/utile/commits)\n[![PyPI](https://img.shields.io/pypi/v/utile?logo=Pypi\u0026style=flat-square)](https://pypi.org/project/utile/1.0/)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/utile?logo=pypi\u0026style=flat-square)\n[![git](https://img.shields.io/badge/make%20it%20better-Contribute-blue?style=flat-square\u0026logo=git)](#)\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.python.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/For%20the%20love%20of%20code-Python-blue?style=for-the-badge\u0026logo=Python\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.rust-lang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/For%20the%20love%20of%20code-Rust-brown?style=for-the-badge\u0026logo=Rust\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n## Installation\n```Powershell\npip install utile\n```  \n---\n***If you dont have rust compiler installed***  \n```bash\npip install utile==1.0\n```\n## The art of using decorators\nDecorators is one of the many concepts which makes Python programming amazing. The key usage \nof decorators is to modify the functionality or state (behavior) of a function. This package brings out a relatively \nnew concept of\n**Function Foundation**.  \nFunction Foundation is a style of programming where a function tends to do nothing and acts like a robust base (or \nfoundation) for decorators and these decorators can be made to do sophisticated processes over the idle function.\nThis (according to us) eases intricate function designing.\n## Getting Started\n#### @timer() decorator\nTo compute execution time of a function:\n```python\nfrom utile.Timer import timer\nimport time\n\n@timer()\ndef foo():\n    time.sleep(1)\nfoo()\n```\nThis will show the execution time (in seconds) irrespective of any print statements.\n\n### Key features of utile\n\n#### @threader() decorator\nProvides an easy way to run multiple I/O bound tasks with no hassle of thread pools.\nEverything is done for you!\n```python\nimport requests\nfrom utile.Threader import threader\n\n\ndef get_requester(endpoint):\n    return requests.get(f\"https://localhost:5000/api/{endpoint}\").text # sample GET request\n\n@threader({get_requester: [[\"user/1\"], [\"user/1/followers\"]]})\ndef foo(): pass\nfoo()\n``` \nThe ``@threader()`` decorator takes in a frame-determined structure of all your functions along with its arguments\nand returns the list of all the return values of the tasks.\n\n#### @processor decorator\nProvides an easy way to run multiple CPU bound tasks with no hassle of Process pools.  \nAgain, Everything is done for you!  \n```python\nfrom utile.Processor import processor\n\n\ndef power(a, b):\n    return pow(a, b)        # a sample method for computational task\n\n\nif __name__ == \"__main__\":  # important to ensure this.\n    @processor({power: [[123, 321] for _ in range(10000)]})\n    def foo(): pass\n    print(foo())\n```\nThe ``@processor()`` decorator takes in a frame-determined structure of all your functions along with its arguments\nand returns the list of all the return values of the tasks.\n\n\u003e It's that simple! We take care of all your Pooling processes and you do your work!\n\nFor more information, see [Documentation](https://utile.readthedocs.io/en/latest/documentation/).\n\n## Disclaimer\n- Rust compiler must be installed in your machine for the binding to work. So use v1.0 if dont dont have rust compiler installed.\n\n## Contribution\nWe encourage anyone who comes up with new ideas using decorators  \nto [contribute](https://github.com/j0fiN/utile) and collaborate (do star the repo if you like it !).\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0fin%2Futile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj0fin%2Futile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0fin%2Futile/lists"}