{"id":24118077,"url":"https://github.com/m-pektas/pysimpler","last_synced_at":"2026-01-25T17:01:47.037Z","repository":{"id":189491533,"uuid":"680525845","full_name":"m-pektas/pysimpler","owner":"m-pektas","description":"This package simplifies the measuring duration of python functions.","archived":false,"fork":false,"pushed_at":"2024-10-06T09:40:37.000Z","size":135,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-15T01:18:11.492Z","etag":null,"topics":["cache","decorators","python","reporting","software-engineering","timer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m-pektas.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-19T14:29:25.000Z","updated_at":"2024-10-06T09:40:41.000Z","dependencies_parsed_at":"2023-12-30T11:29:37.864Z","dependency_job_id":"5ccba0d1-db80-4f1f-9e7f-3485c0e555dc","html_url":"https://github.com/m-pektas/pysimpler","commit_stats":null,"previous_names":["m-pektas/pysimpler"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/m-pektas/pysimpler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-pektas%2Fpysimpler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-pektas%2Fpysimpler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-pektas%2Fpysimpler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-pektas%2Fpysimpler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-pektas","download_url":"https://codeload.github.com/m-pektas/pysimpler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-pektas%2Fpysimpler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cache","decorators","python","reporting","software-engineering","timer"],"created_at":"2025-01-11T08:17:53.261Z","updated_at":"2026-01-25T17:01:47.018Z","avatar_url":"https://github.com/m-pektas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pysimpler\n\n![version](https://img.shields.io/badge/version-0.0.7-blue)\n\nThis package simplifies the fundamental software engineering practices such as bottleneck analysis, exception handling, logging etc.\n\n\n## Installation\n\n```\npip install pysimpler\n```\n\n## Environment Variables\n\nYou have to set PYSIMPLER environment variable as 1 to activate pysimpler. If you want to deactivate it, you should set as 0.\n\n```\n#activate\nexport PYSIMPLER=1\n\n#deactivate\nexport PYSIMPLER=0\n```\n\n##  Report\n\nYou can add the following command at the end of your code for reporting.\n\n```python\npysimpler.reporter.report()\n```\n\nIf you want to set specific values for reporting metrics, you can use following lines. Default values are TIME_UNITS.SECONDS and 5 digits.\n\n```python\nimport pysimpler\npysimpler.reporter.set_time_unit(pysimpler.TIME_UNITS.MILLISECONDS)\npysimpler.reporter.set_digits(10)\n```\n\n\u003cimg src=\"assets/function_average_time-min.png\" width=\"600\"  /\u003e  \u003cimg src=\"assets/function_frequency-min.png\" width=\"600\"  /\u003e\n\n\n## Features\n\n### 1. Time Logger\n\n\nThis feature aims to log duration of the execution time of method. We use **timer** keyword for using this feature. It help you analysing your bottlenecks in function level.\n\n\n**Example:**\n\n```python\nimport pysimpler\n\n@pysimpler.timer.time()\ndef counter(count):\n    x = 1\n    for i in range(count):\n        y = x*i\n\nif __name__ == '__main__':\n\n    print(\"Process 1\")\n    result = counter(10)\n    print(\"Process 3\")\n\npysimpler.reporter.report()\n\n# output\n# ------------------------------\n# Process 1\n# 2023-12-25T11:55:38.474173+0300 | INFO | File: app.py | Function : counter | Duration : 0.0005151670000032027 sec\n# Process 3\n```\n\n\n\n### 2. Cache Cleaner\n\n\n```python\nimport pysimpler\nimport gc\n\n@pysimpler.cache.clear()\ndef memory(count):\n    mem = []\n    for i in range(count):\n        mem.append(\"data\")\n\nif __name__ == '__main__':\n    # print(gc.get_count()) lines are only for printing of the memory state.\n    # You can remove it.\n\n    print(\"Process 1\")\n    print(\"Process 2\")\n    print(gc.get_count())\n    result = memory(1000)\n    print(gc.get_count())\n    print(\"Process 4\")\n\n# output\n#------------------------------\n# Process 1\n# Process 2\n# (351, 10, 1)\n# (0, 0, 0)\n# Process 4\n```\n\n\n\n\n```python\nimport pysimpler\nimport gc\n\n@pysimpler.cache.clear(pysimpler.MLFrameworks.PYTORCH)\ndef memory_pytorch(device = \"cuda\"):\n    print(\"=\u003e memory_pytorch\")\n    var = torch.ones(1,3,1024,1024)\n    if torch.cuda.is_available():\n        var = var.to(device)\n\nif __name__ == '__main__':\n    print(\"Process 1\")\n    print(\"Process 2\")\n    result = memory_pytorch()\n    print(\"Process 4\")\n\n# output\n# ------------------------------\n# Process 1\n# Process 2\n# =\u003e memory_pytorch\n# Process 4\n```\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-pektas%2Fpysimpler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-pektas%2Fpysimpler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-pektas%2Fpysimpler/lists"}