{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"PyMAAP","text":"<p>Monitor and benchmark Python functions with performance logging, error tracking, and analysis tools.</p> <p>Available on PyPI: <code>uv pip install pymaap</code></p> <p>PyMAAP provides two tools: - <code>monitoring.py</code>: Track performance, log errors, and export metrics. - <code>analysis.py</code>: Analyze logs and generate plots from performance data.  </p> <p>Explore the Quickstart to get started.</p>"},{"location":"quickstart/","title":"Quickstart","text":""},{"location":"quickstart/#getting-started-with-pymaap","title":"\ud83d\ude80 Getting Started with PyMAAP","text":"<p>PyMAAP helps you monitor, log, and analyze the performance and behavior of your Python functions. It includes two main tools:</p> <ul> <li><code>monitoring.py</code>: Decorators and tools to track performance, log errors, and save metrics.</li> <li><code>analysis.py</code>: CLI script to analyze log files and generate insightful plots.</li> </ul>"},{"location":"quickstart/#installation","title":"\ud83d\udce6 Installation","text":"<pre><code>uv pip install pymaap\n</code></pre>"},{"location":"quickstart/#1-monitoring-functions","title":"\ud83d\udd0d 1. Monitoring Functions","text":"<p>Import the decorators and wrap your functions:</p> <pre><code>from pymaap.monitoring import Timer, ErrorCatcher, sanitizer\n\ntimer = Timer(results_format=\"csv\", max_arg_length=200, sanitize_func=sanitizer)\nerror_handler = ErrorCatcher(results_format=\"csv\", sanitize_func=sanitizer)\n\n@error_handler\n@timer\ndef my_function(x, y):\n    return x + y\n</code></pre>"},{"location":"quickstart/#options","title":"\u2705 Options","text":"<ul> <li><code>results_format</code>: <code>\"csv\"</code> or <code>\"parquet\"</code></li> <li><code>sanitize_func</code>: Custom sanitizer for sensitive args/logs</li> <li><code>log_to_console</code>: Print logs to console (default <code>True</code>)</li> <li><code>use_multiprocessing</code>: Use locks/log queues in multi-process apps</li> </ul> <p>This creates: - <code>logs/timing_results.csv</code> or <code>.parquet</code> - <code>logs/error_results.csv</code> or <code>.parquet</code> - <code>logs/timing.log</code> - <code>logs/error.log</code></p>"},{"location":"quickstart/#manual-metrics","title":"\ud83d\udccf Manual Metrics","text":"<p>You can also log timing manually using:</p> <pre><code>from pymaap.monitoring import get_metrics_start, get_metrics_end\n\nstart_metrics = get_metrics_start(\"my_custom_block\")\n# ... your code ...\nend_metrics = get_metrics_end(start_metrics)\n</code></pre>"},{"location":"quickstart/#2-analyzing-logs","title":"\ud83d\udcca 2. Analyzing Logs","text":"<p>Once you\u2019ve collected logs, analyze them via CLI:</p> <pre><code>python -m pymaap.analysis \\\n  --logdir logs \\\n  --subtitle \"Post-deployment test\" \\\n  --tag run1\n</code></pre>"},{"location":"quickstart/#cli-options","title":"CLI Options","text":"<ul> <li><code>--logdir</code>: Folder with <code>timing.log</code> files</li> <li><code>--subtitle</code>: Subtitle for all plots (or <code>\"none\"</code> to disable)</li> <li><code>--tag</code>: Folder name suffix for outputs (default: <code>\"run\"</code>)</li> <li><code>--start-time</code> / <code>--end-time</code>: Optional override of time window</li> </ul> <p>Outputs go to <code>figs/YYYY-MM-DD_HH-MM-SS_run1/</code>: - Execution plots - Histograms - Aggregate CSVs - Metadata</p>"},{"location":"quickstart/#example-output-structure","title":"\ud83d\udcc1 Example Output Structure","text":"<pre><code>figs/\n\u2514\u2500\u2500 2025-04-01_14-00-01_run1/\n    \u251c\u2500\u2500 execution_time_per_function.png\n    \u251c\u2500\u2500 function_calls_over_time.png\n    \u251c\u2500\u2500 memory_change_per_function_call.png\n    \u251c\u2500\u2500 top10_functions_by_total_time.png\n    \u251c\u2500\u2500 hist_*.png\n    \u251c\u2500\u2500 results.csv\n    \u251c\u2500\u2500 results_aggregate.csv\n    \u2514\u2500\u2500 README.txt\n</code></pre>"},{"location":"reference/","title":"API Reference","text":"<p>Documentation for decorators and utility functions.</p>"},{"location":"reference/#monitoringpy","title":"monitoring.py","text":"<ul> <li><code>Timer</code></li> <li><code>ErrorCatcher</code></li> <li><code>get_metrics_start</code></li> <li><code>get_metrics_end</code></li> </ul>"},{"location":"reference/#analysispy","title":"analysis.py","text":"<ul> <li><code>analysis(args)</code></li> <li><code>generate_plots(df, output_dir, subtitle)</code></li> </ul>"}]}