A pacakge that allows the user to record and print out neatly the runtime of function and also the entire program.
Project description
Runtime Ponyo
alexh212- Alex Hmitti
as13909 - Aaron Stein
Rafinator123 - Rafael Nadal-Scala
jk021227 - Jhon Kim
Times the execution of functions while providing users to save and display recorded runtimes.
Installation
Import the provided functions from main.py into your Python script.
from package_main.main import *
Functionalities
@tracker
When this decorator is applied to a function, Runtime Ponyo begins to time that functions execution.
@tracker_print
When this decorator is applied to a function, Runtime Ponyo begins to time that functions execution and displays the runtime upon completion.
'print_all_runtimes()'
All runtimes recorded are displayed.
This only print the runtimes of functions that have been completed and tracked prior to the call of this function.
save_to_file(file.txt)
This function saves the recorded runtimes to a specified file. If the file doesn't exist, it will be created with the given name, and the runtime data will be written to it.
'entire_runtime()'
Calculates and prints the total runtime of the entire program.
Usage
- To use
@tracker_print, apply the decorator to a function.
@tracker
def example_function():
for i in range(1000):
i += 1
- To use
@tracker_print, apply the decorator to a function.
@tracker_print
def example_function():
for i in range(1000):
i += 1
- Insert the
print_all_runtimes()function at the desired location in your program to use it.
analyzed_data = complex_data_analysis(pd.concat(processed_chunks))
print_all_runtimes() # Track and print function runtimes
log_operations(datetime.now())
print(f"Analyzed Data: \n{analyzed_data}")
- Insert the
save_to_file()function at the desired location in your program to use it.
with ThreadPoolExecutor(max_workers=4) as executor:
future_to_chunk = {executor.submit(advanced_data_transformation, chunk): chunk for chunk in chunks}
save_to_file(my_runtimes.txt) # Save recorded runtimes to a specified file
processed_data = [future.result() for future in future_to_chunk]
- Insert the
'entire_runtime()'function at the desired location in your program to use it.
data = np.random.exponential(scale=1.0, size=(1000, 2))
df = pd.DataFrame(data, columns=['id', 'values'])
chunks = np.array_split(df, 4)
entire_runtime() # Print the total runtime of the program
Contributing
Here are the steps you need to take if you would like to contribute to the project.
-
Fork and Clone the project repository
-
Install pipenv if not already.
-
Use
pipenvto install all necessary development dependencies.pipenv install --dev -
Set up a new virtual environment using Python.
python -m venv env -
Import the main package and the specific functions you wish to test into your test file (
_tests.pylocated inpackage/tests). -
Execute your tests using pytest within the pipenv environment
Development Policy
- Python 2/3 compatibility
- PEP8-compliance (with exceptions)
- Tests should be passing
Package Link in PyPI
https://pypi.org/project/runtimeponyo/
A little exercise to create a Python package, build it, test it, distribute it, and use it. See instructions for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runtimeponyo-0.0.3.tar.gz.
File metadata
- Download URL: runtimeponyo-0.0.3.tar.gz
- Upload date:
- Size: 41.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c86d7bbdfef385e4929b4488f920d74c8b3fff82aa214fc00de47424bb57491
|
|
| MD5 |
6f3b6da550705697b25fff0bbac19c82
|
|
| BLAKE2b-256 |
b2ffe3c3a1a7d00ba4098c746effcd5341dbf18585065840de7413b21dc415d5
|
File details
Details for the file runtimeponyo-0.0.3-py3-none-any.whl.
File metadata
- Download URL: runtimeponyo-0.0.3-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a6834487458e6186620b8802c448d09b761545b907725e1c8c2f701f6e704eb
|
|
| MD5 |
7a944f8e04ecb076535e11e195b67f5b
|
|
| BLAKE2b-256 |
a0f41563cbb4eb4bcf1d577d49f3d3b29f58718d02b983d2a417b508a2a8b9d3
|