{"id":27629993,"url":"https://github.com/nikhillingadhal1999/aipymemtimeprofiler","last_synced_at":"2025-04-23T16:17:07.919Z","repository":{"id":287260884,"uuid":"964145768","full_name":"nikhillingadhal1999/AIPyMemTimeProfiler","owner":"nikhillingadhal1999","description":"AIPyMemTimeProfiler gives you powerful insights into your Python code,no decorators, no setup, no hassle. Instantly track memory usage and execution time for every function in your app. Just run your script and get a clear, JSON-based performance report tailored to your codebase. Zero Code Changes. Maximum Visibility. Ideal for performance tuning.","archived":false,"fork":false,"pushed_at":"2025-04-23T15:13:05.000Z","size":5213,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T16:17:00.843Z","etag":null,"topics":["ai","ai-enabled","enabled","flask","flask-api","flask-application","llm","memory","memory-profiler","memory-profiling","ollama","pip","profile","profiler","profiling","python","python3","time","time-profile","time-profiling"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nikhillingadhal1999.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2025-04-10T18:57:44.000Z","updated_at":"2025-04-23T15:13:09.000Z","dependencies_parsed_at":"2025-04-21T08:53:37.795Z","dependency_job_id":null,"html_url":"https://github.com/nikhillingadhal1999/AIPyMemTimeProfiler","commit_stats":null,"previous_names":["nikhillingadhal1999/pymemtimeprofiler","nikhillingadhal1999/aipymemtimeprofiler"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhillingadhal1999%2FAIPyMemTimeProfiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhillingadhal1999%2FAIPyMemTimeProfiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhillingadhal1999%2FAIPyMemTimeProfiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhillingadhal1999%2FAIPyMemTimeProfiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikhillingadhal1999","download_url":"https://codeload.github.com/nikhillingadhal1999/AIPyMemTimeProfiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250468277,"owners_count":21435453,"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":["ai","ai-enabled","enabled","flask","flask-api","flask-application","llm","memory","memory-profiler","memory-profiling","ollama","pip","profile","profiler","profiling","python","python3","time","time-profile","time-profiling"],"created_at":"2025-04-23T16:17:06.908Z","updated_at":"2025-04-23T16:17:07.911Z","avatar_url":"https://github.com/nikhillingadhal1999.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zero-Hassle AI Enabled Python Profiler for Time \u0026 Memory\n\nAI enabled lightweight time and memory profiler for Python, zero-configuration python profiler that captures function-level performance metrics along with analysis of function implementation with AI Agent with **no code changes**. Ideal for:\n\n- Python scripts  \n- Flask projects  \n- Real-time debugging of performance bottlenecks  \n\n---\n\n## Features\n\n### Zero Code Changes\nJust run your Python script — no decorators, annotations, or modifications needed.\n\n### Time \u0026 Memory Metrics\nAutomatically captures:\n- Max execution time (CPU)\n- Peak memory usage\n- RSS memory growth\n- Return object size\n- Arguments passed\n\n### Project-Aware Analysis\nOnly **your** code is profiled.  \nSystem libraries and external modules are ignored using intelligent project-path detection.\n\n## Profiler Metrics\n\nThe following table describes the metrics collected by the profiler:\n\n| **Metric**               | **Description**                                                                                   | **Key**                           |\n|--------------------------|---------------------------------------------------------------------------------------------------|-----------------------------------|\n| **Function Name**         | The name of the function being profiled.                                                          | `function`                        |\n| **File Path**             | The absolute path to the file where the function is defined.                                      | `file`                            |\n| **Line Number**           | The line number where the function starts in the file.                                            | `line`                            |\n| **Execution Time**        | Maximum time taken by each function in milliseconds (ms).                                         | `max_time_ms`                     |\n| **CPU Time**              | Time spent by the CPU on this function (ms).                                                      | `cpu_time_ms`                     |\n| **Peak Memory Usage**     | Maximum memory usage during function execution in kilobytes (KB).                                 | `max_mem`                         |\n| **RSS Memory Growth**     | Growth in Resident Set Size (RSS) memory in kilobytes (KB), helps spot memory leaks.              | `mem_growth_rss_kb`               |\n| **Arguments**             | The arguments passed to the function being profiled.                                              | `args`                            |\n| **Possible Memory Leak**  | Indicates if a potential memory leak is detected (if any).                                        | `possible_memory_leak`            |\n| **Notes**                 | Any additional notes related to the profiling data.                                               | `note`                            |\n| **Returned Object Size**  | The size of the returned object in bytes.                                                         | `return_obj`                      |\n\n\nOption to select a function for analysis, which is analysed by the Ollama model installed and configured.\nThis is the table providing the options for analysis.\n\n### Available Functions for Analysis\n\n| **Index** | **Function Name**     | **File Path**                    |\n|-----------|------------------------|----------------------------------|\n| 0         | `function_one`         | `/path/to/file_one.py`          |\n| 1         | `function_two`         | `/path/to/file_two.py`          |\n| 2         | `function_three`       | `/path/to/file_three.py`        |\n| 3         | `function_four`        | `/path/to/file_four.py`         |\n| 4         | `function_five`        | `/path/to/file_five.py`         |\n| ...       | ...                    | ...                              |\n| N         | `function_n`           | `/path/to/file_n.py`            |\n| N+1       | `Skip Analysis`        | `-`                              |\n\n\n### Structured JSON Reports\nEach function includes:\n- Function name\n- Source file and line number\n- Time (ms)\n- Memory usage (KB)\n- Return object size\n- Arguments\n- Memory growth \u0026 potential leaks\n\n### Works with Any Project Structure\nHandles **nested folder hierarchies** easily — just point to your project root and go.\n\n---\n\n## Setup Instructions\n\n### 1. Set Environment Variables\n\n```bash\nexport PROFILER_FILE_PATH=\"/absolute/path/to/your_script.py\"\nexport PROFILER_DIR_PATH=\"/absolute/path/to/your/project/root\"\n```\nIf you just want to try, you can test it with sample_project. \n\u003e `export PROFILER_FILE_PATH=\"$(pwd)/sample_project/inside/app.py\"`: The Python file to be profiled  \n\u003e `export PROFILER_DIR_PATH=\"$(pwd)/sample_project/inside\"`: Root of your project for accurate filtering\n\n### 2. Optional: Suppress Console Output\n\nBy default, profiler prints a table to the console. To disable:\n\n```bash\nexport CONSOLE_DISPLAY=False\n```\n## Environment Setup\n\nIf you **already have a virtual environment**, just install the dependencies:\n\n```bash\nmake setup\n```\n\nThis will install the requirements in your env\n\nIf you **don't have a virtual environment**, just install the dependencies:\n\n```bash\nmake setup\n```\n\nThis will create an env and install requirements\n\n## LLM Environment Setup\n\nDownload Ollama from \n[Ollama](https://ollama.com/)\n\n```bash\nollama run \u003cyout_model\u003e\n```\nIf you don't know which model to use. \n\u003e `ollama run deepseek-r1:1.5b`: It is preferable as it is light weight. \n\nSet your model env variable.\n```bash\nexport AGENT_NAME=\"\u003cyour_model\u003e\"\nexport AGENTIC_PROFILER=True\n```\n\n```bash\nmake agent-setup\n```\n\nTo use \n\n## Run profiler\n\n```bash\nmake run\n```\n\n\nThis will:\n- Read the env vars\n- Launch your script\n- Record memory + execution stats\n- Save detailed JSON report\n\n---\n\n## Supported Use Cases\n\n- Pure Python projects\n- Flask APIs and apps\n- Any directory layout\n\n---\n\n## Want More?\n\n- [ ] Console table toggle\n- [ ] HTML report output\n- [ ] Jupyter Notebook integration\n\nPull requests are welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhillingadhal1999%2Faipymemtimeprofiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhillingadhal1999%2Faipymemtimeprofiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhillingadhal1999%2Faipymemtimeprofiler/lists"}