-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 630afef
Showing
7 changed files
with
577 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Publish Python 🐍 distributions 📦 to PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install pypa/setuptools | ||
run: >- | ||
python -m | ||
pip install setuptools wheel | ||
- name: Extract tag name | ||
id: tag | ||
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) | ||
- name: Update version in setup.py | ||
run: >- | ||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py | ||
- name: Build a binary wheel | ||
run: >- | ||
python setup.py sdist bdist_wheel | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__pycache__ | ||
*.pyc | ||
dist/ | ||
build/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
MIT License (Modified) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to make derivative works based on the Software, provided that any substantial changes to the Software are clearly distinguished from the original work and are distributed under a different name. | ||
|
||
The original copyright notice and disclaimer must be retained in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# FuncProfiler | ||
![Python Version](https://img.shields.io/badge/python-3.12-blue.svg) | ||
[![Code Size](https://img.shields.io/github/languages/code-size/infinitode/funcprofiler)](https://github.com/infinitode/funcprofiler) | ||
![Downloads](https://pepy.tech/badge/funcprofiler) | ||
![License Compliance](https://img.shields.io/badge/license-compliance-brightgreen.svg) | ||
![PyPI Version](https://img.shields.io/pypi/v/funcprofiler) | ||
|
||
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. | ||
|
||
## Installation | ||
|
||
You can install FuncProfiler using pip: | ||
|
||
```bash | ||
pip install funcprofiler | ||
``` | ||
|
||
## Supported Python Versions | ||
|
||
FuncProfiler supports the following Python versions: | ||
|
||
- Python 3.6 | ||
- Python 3.7 | ||
- Python 3.8 | ||
- Python 3.9 | ||
- Python 3.10 | ||
- Python 3.11 and later (preferred) | ||
|
||
Please ensure that you have one of these Python versions installed. FuncProfiler may not function as expected on earlier versions. | ||
|
||
## Features | ||
|
||
- **Function Profiling**: Monitor a function's memory usage and execution time to identify performance issues. | ||
- **Line-by-Line Profiling**: Return execution time and memory usage for each line of any given function. | ||
- **Shared Logging**: Log outputs of functions triggered by the line-by-line and function profilers, storing results in a `.txt` file. | ||
- **File Exports**: Export profiling data from functions in `csv`, `json`, or `html` formats. | ||
> [!NOTE] | ||
> View more export types in the [official documentation](https://infinitode-docs.gitbook.io/documentation/package-documentation/funcprofiler-package-documentation). | ||
## Usage | ||
|
||
### Function Profiling | ||
|
||
```python | ||
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 | ||
|
||
```python | ||
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) | ||
``` | ||
|
||
> [!NOTE] | ||
> FuncProfiler can be added to any function using the callable format: `@funcprofiler_function_name(expected_arguments)`. | ||
## Contributing | ||
|
||
Contributions are welcome! If you encounter issues, have suggestions, or wish to contribute to FuncProfiler, please open an issue or submit a pull request on [GitHub](https://github.com/infinitode/funcprofiler). | ||
|
||
## License | ||
|
||
FuncProfiler is released under the terms of the **MIT License (Modified)**. Please see the [LICENSE](https://github.com/infinitode/funcprofiler/blob/main/LICENSE) file for the full text. | ||
|
||
**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. |
Oops, something went wrong.