funcprofiler 1.0.2__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/PKG-INFO +42 -34
- funcprofiler-1.2.0/README.md +95 -0
- funcprofiler-1.2.0/funcprofiler/__init__.py +508 -0
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/funcprofiler.egg-info/PKG-INFO +42 -34
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/setup.py +1 -1
- funcprofiler-1.0.2/README.md +0 -88
- funcprofiler-1.0.2/funcprofiler/__init__.py +0 -374
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/LICENSE +0 -0
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/funcprofiler.egg-info/SOURCES.txt +0 -0
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/funcprofiler.egg-info/dependency_links.txt +0 -0
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/funcprofiler.egg-info/top_level.txt +0 -0
- {funcprofiler-1.0.2 → funcprofiler-1.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: funcprofiler
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: An open-source Python library for finding bottlenecks in code. Includes function profiling, data exports, logging, and even line-by-line profiling, for more control.
|
|
5
5
|
Home-page: https://github.com/infinitode/funcprofiler
|
|
6
6
|
Author: Infinitode Pty Ltd
|
|
@@ -25,6 +25,7 @@ Dynamic: classifier
|
|
|
25
25
|
Dynamic: description
|
|
26
26
|
Dynamic: description-content-type
|
|
27
27
|
Dynamic: home-page
|
|
28
|
+
Dynamic: license-file
|
|
28
29
|
Dynamic: requires-python
|
|
29
30
|
Dynamic: summary
|
|
30
31
|
|
|
@@ -37,8 +38,19 @@ Dynamic: summary
|
|
|
37
38
|
|
|
38
39
|
An open-source Python library for identifying bottlenecks in code. It includes function profiling, data exports, logging, and line-by-line profiling for more granular control.
|
|
39
40
|
|
|
40
|
-
## Changelog (v.1.0
|
|
41
|
-
-
|
|
41
|
+
## Changelog (v.1.2.0):
|
|
42
|
+
- Significant performance improvements for both function and line-by-line profiling.
|
|
43
|
+
- Cached function metadata at decoration time to reduce overhead during execution.
|
|
44
|
+
- Optimized line-by-line tracing using code object identity comparison.
|
|
45
|
+
- Implemented buffered logging for shared logs to minimize frequent file I/O.
|
|
46
|
+
- Improved trace accuracy by properly capturing the final line's execution time.
|
|
47
|
+
- Refactored export logic for more efficient report generation.
|
|
48
|
+
|
|
49
|
+
## Changelog (v.1.1.0):
|
|
50
|
+
- Added support for 2 new export formats: `yaml` and `toml`.
|
|
51
|
+
- Exports now include more information: peak memory usage, timestamp, arguments, return value, filepath, line number, and docstring.
|
|
52
|
+
- Added `enabled` and `log_level` options to the decorators.
|
|
53
|
+
- Improved export formats for better readability.
|
|
42
54
|
|
|
43
55
|
## Installation
|
|
44
56
|
|
|
@@ -50,25 +62,30 @@ pip install funcprofiler
|
|
|
50
62
|
|
|
51
63
|
## Supported Python Versions
|
|
52
64
|
|
|
53
|
-
FuncProfiler supports
|
|
54
|
-
|
|
55
|
-
- Python 3.6
|
|
56
|
-
- Python 3.7
|
|
57
|
-
- Python 3.8
|
|
58
|
-
- Python 3.9
|
|
59
|
-
- Python 3.10
|
|
60
|
-
- Python 3.11 and later (preferred)
|
|
61
|
-
|
|
62
|
-
Please ensure that you have one of these Python versions installed. FuncProfiler may not function as expected on earlier versions.
|
|
65
|
+
FuncProfiler supports Python 3.6 and later.
|
|
63
66
|
|
|
64
67
|
## Features
|
|
65
68
|
|
|
66
|
-
- **Function Profiling**: Monitor a function's memory usage and execution time
|
|
67
|
-
- **Line-by-Line Profiling**:
|
|
68
|
-
- **Shared Logging**: Log outputs
|
|
69
|
-
- **File Exports**: Export profiling data
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
- **Function Profiling**: Monitor a function's memory usage and execution time.
|
|
70
|
+
- **Line-by-Line Profiling**: Get execution time and memory usage for each line of a function.
|
|
71
|
+
- **Shared Logging**: Log profiler outputs to a `.txt` file.
|
|
72
|
+
- **File Exports**: Export profiling data in various formats.
|
|
73
|
+
- **New Options**:
|
|
74
|
+
- `enabled`: A boolean to enable or disable profiling.
|
|
75
|
+
- `log_level`: Set the logging level to "info" or "debug".
|
|
76
|
+
|
|
77
|
+
## Export Formats
|
|
78
|
+
|
|
79
|
+
| Format | `function_profile` | `line_by_line_profile` |
|
|
80
|
+
|--------|--------------------|------------------------|
|
|
81
|
+
| `txt` | ✅ | ❌ |
|
|
82
|
+
| `json` | ✅ | ✅ |
|
|
83
|
+
| `csv` | ✅ | ✅ |
|
|
84
|
+
| `html` | ✅ | ✅ |
|
|
85
|
+
| `xml` | ✅ | ✅ |
|
|
86
|
+
| `md` | ✅ | ✅ |
|
|
87
|
+
| `yaml` | ✅ | ✅ |
|
|
88
|
+
| `toml` | ✅ | ✅ |
|
|
72
89
|
|
|
73
90
|
## Usage
|
|
74
91
|
|
|
@@ -77,12 +94,10 @@ Please ensure that you have one of these Python versions installed. FuncProfiler
|
|
|
77
94
|
```python
|
|
78
95
|
from funcprofiler import function_profile
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
@function_profile(export_format="html", shared_log=True)
|
|
97
|
+
@function_profile(export_format="html", shared_log=True, log_level="debug")
|
|
82
98
|
def some_function():
|
|
83
99
|
return "Hello World."
|
|
84
100
|
|
|
85
|
-
# Call the function
|
|
86
101
|
message = some_function()
|
|
87
102
|
```
|
|
88
103
|
|
|
@@ -91,28 +106,21 @@ message = some_function()
|
|
|
91
106
|
```python
|
|
92
107
|
from funcprofiler import line_by_line_profile
|
|
93
108
|
|
|
94
|
-
|
|
95
|
-
@line_by_line_profile(shared_log=True)
|
|
109
|
+
@line_by_line_profile(shared_log=True, enabled=True)
|
|
96
110
|
def some_complicated_function(n):
|
|
97
111
|
total = 0
|
|
98
112
|
for i in range(n):
|
|
99
113
|
for j in range(i):
|
|
100
|
-
total += (i * j) ** 0.5
|
|
114
|
+
total += (i * j) ** 0.5
|
|
101
115
|
return total
|
|
102
116
|
|
|
103
|
-
# Call the function
|
|
104
117
|
total = some_complicated_function(1000)
|
|
105
118
|
```
|
|
106
119
|
|
|
107
|
-
> [!NOTE]
|
|
108
|
-
> FuncProfiler can be added to any function using the callable format: `@funcprofiler_function_name(expected_arguments)`.
|
|
109
|
-
|
|
110
120
|
## Contributing
|
|
111
121
|
|
|
112
|
-
Contributions are welcome!
|
|
122
|
+
Contributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/infinitode/funcprofiler).
|
|
113
123
|
|
|
114
124
|
## License
|
|
115
125
|
|
|
116
|
-
FuncProfiler is released under the
|
|
117
|
-
|
|
118
|
-
**Modified License Clause**: The modified license clause allows users to create derivative works based on the FuncProfiler software. However, it requires that any substantial changes to the software be clearly distinguished from the original work and distributed under a different name.
|
|
126
|
+
FuncProfiler is released under the **MIT License (Modified)**. See the [LICENSE](https://github.com/infinitode/funcprofiler/blob/main/LICENSE) file for details.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# FuncProfiler
|
|
2
|
+

|
|
3
|
+
[](https://github.com/infinitode/funcprofiler)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
An open-source Python library for identifying bottlenecks in code. It includes function profiling, data exports, logging, and line-by-line profiling for more granular control.
|
|
9
|
+
|
|
10
|
+
## Changelog (v.1.2.0):
|
|
11
|
+
- Significant performance improvements for both function and line-by-line profiling.
|
|
12
|
+
- Cached function metadata at decoration time to reduce overhead during execution.
|
|
13
|
+
- Optimized line-by-line tracing using code object identity comparison.
|
|
14
|
+
- Implemented buffered logging for shared logs to minimize frequent file I/O.
|
|
15
|
+
- Improved trace accuracy by properly capturing the final line's execution time.
|
|
16
|
+
- Refactored export logic for more efficient report generation.
|
|
17
|
+
|
|
18
|
+
## Changelog (v.1.1.0):
|
|
19
|
+
- Added support for 2 new export formats: `yaml` and `toml`.
|
|
20
|
+
- Exports now include more information: peak memory usage, timestamp, arguments, return value, filepath, line number, and docstring.
|
|
21
|
+
- Added `enabled` and `log_level` options to the decorators.
|
|
22
|
+
- Improved export formats for better readability.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
You can install FuncProfiler using pip:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install funcprofiler
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Supported Python Versions
|
|
33
|
+
|
|
34
|
+
FuncProfiler supports Python 3.6 and later.
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **Function Profiling**: Monitor a function's memory usage and execution time.
|
|
39
|
+
- **Line-by-Line Profiling**: Get execution time and memory usage for each line of a function.
|
|
40
|
+
- **Shared Logging**: Log profiler outputs to a `.txt` file.
|
|
41
|
+
- **File Exports**: Export profiling data in various formats.
|
|
42
|
+
- **New Options**:
|
|
43
|
+
- `enabled`: A boolean to enable or disable profiling.
|
|
44
|
+
- `log_level`: Set the logging level to "info" or "debug".
|
|
45
|
+
|
|
46
|
+
## Export Formats
|
|
47
|
+
|
|
48
|
+
| Format | `function_profile` | `line_by_line_profile` |
|
|
49
|
+
|--------|--------------------|------------------------|
|
|
50
|
+
| `txt` | ✅ | ❌ |
|
|
51
|
+
| `json` | ✅ | ✅ |
|
|
52
|
+
| `csv` | ✅ | ✅ |
|
|
53
|
+
| `html` | ✅ | ✅ |
|
|
54
|
+
| `xml` | ✅ | ✅ |
|
|
55
|
+
| `md` | ✅ | ✅ |
|
|
56
|
+
| `yaml` | ✅ | ✅ |
|
|
57
|
+
| `toml` | ✅ | ✅ |
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
### Function Profiling
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from funcprofiler import function_profile
|
|
65
|
+
|
|
66
|
+
@function_profile(export_format="html", shared_log=True, log_level="debug")
|
|
67
|
+
def some_function():
|
|
68
|
+
return "Hello World."
|
|
69
|
+
|
|
70
|
+
message = some_function()
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Line-by-Line Profiling
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from funcprofiler import line_by_line_profile
|
|
77
|
+
|
|
78
|
+
@line_by_line_profile(shared_log=True, enabled=True)
|
|
79
|
+
def some_complicated_function(n):
|
|
80
|
+
total = 0
|
|
81
|
+
for i in range(n):
|
|
82
|
+
for j in range(i):
|
|
83
|
+
total += (i * j) ** 0.5
|
|
84
|
+
return total
|
|
85
|
+
|
|
86
|
+
total = some_complicated_function(1000)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
Contributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/infinitode/funcprofiler).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
FuncProfiler is released under the **MIT License (Modified)**. See the [LICENSE](https://github.com/infinitode/funcprofiler/blob/main/LICENSE) file for details.
|