Skip to main content

A pacakge that allows the user to record and print out neatly the runtime of function and also the entire program.

Project description

CI/CD

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.

  1. Fork and Clone the project repository

  2. Install pipenv if not already.

  3. Use pipenv to install all necessary development dependencies. pipenv install --dev

  4. Set up a new virtual environment using Python. python -m venv env

  5. Import the main package and the specific functions you wish to test into your test file (_tests.py located in package/tests).

  6. 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

runtimeponyo-0.0.4.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runtimeponyo-0.0.4-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file runtimeponyo-0.0.4.tar.gz.

File metadata

  • Download URL: runtimeponyo-0.0.4.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

Hashes for runtimeponyo-0.0.4.tar.gz
Algorithm Hash digest
SHA256 0f37d05ccdb087a628fb0018433203b3c1d5151acb0ee7eb1c17d02bc7f6c093
MD5 63e0f4376bacaf73c0d25914b5dbd5c6
BLAKE2b-256 d3e974e529596e8ba94f9682faf96788292fd295b8fee044ecde11e6240ff9cd

See more details on using hashes here.

File details

Details for the file runtimeponyo-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: runtimeponyo-0.0.4-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

Hashes for runtimeponyo-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bf055d46a53f53e823ad1c72486e6f2231472c764a13929627fb0a6919c97b97
MD5 74b298e061829a34bca7c0854978e4e6
BLAKE2b-256 e8a8f196835648574b132c4f21f39b8c25738f3b5a921a83e60a241c351b890d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page