FuncProfiler Package Documentation

Package documentation for FuncProfiler, a Python library for identifying bottlenecks in code. It includes function profiling, data exports, logging, and line-by-line profiling for more control.

Changelog

  • 1.0.2 (Latest): Created 2 new export formats: xml, md for both function profiling and line-by-line profiling.

  • 1.0.1: Updated PYPI project description.

  • 1.0.0: Initial release.

Installation

You can install FuncProfiler using PyPi, please make sure that you are using Python 3.6 or later before installing FuncProfiler:

pip install funcprofiler

Example Usage

Function Profiling

from funcprofiler import function_profile

# Exporting as `html` with logging enabled
@function_profile(export_format="html", shared_log=True)
def some_function():
    return "Hello World."

# Call the function
message = some_function()

Line-by-Line Profiling

from funcprofiler import line_by_line_profile

# Logging enabled without exports
@line_by_line_profile(shared_log=True)
def some_complicated_function(n):
    total = 0
    for i in range(n):
        for j in range(i):
            total += (i * j) ** 0.5  # Square root calculation
    return total

# Call the function
total = some_complicated_function(1000)

FuncProfiler can be added to any function using the callable format: @funcprofiler_function_name(expected_arguments).

Last updated

Was this helpful?