Package: scriptime
scriptimePython library to notify when a script has finished running and providing insights such as run time, CPU and RAM usage, and more.scriptimeAboutGetting StartedUsing scriptimerOutputLinksAboutThis project will send you an email or text message notifying you when a script has completed running. Configurable thorugh a config file, environment variables, or hardcoding the email credentials, this project has little overhead to get started.Getting StartedThe first step to using scriptime is setting up the email that will be sending the notifications. scriptime uses the built-in Python SMTP to send emails which requires an email address, said email's password, and an SMTP SSL server and port. Therfore,Choose how you will pass your email credential into scriptime:JSON config fileTo set up, create a .json file with the following contents:{
    "scriptime_email": "example@email.com",
    "scriptime_password": "superSecure1",
    "scriptime_server": "smtp.email.com"
    "scriptime_port": 123>
}Environment variablesRecommended -- if you plan to use scriptime more than once this will be the simplest method over time.Set the following environment variales:SCRIPTIME_EMAIL=example@email.comSCRIPTIME_PASSWORD=superSecure1SCRIPTIME_SERVER=smtp.email.comSCRIPTIME_PORT=123Hard codingIf you choose to go the hard code route, when creating theTimerobject, you will need to pass in extra arguments. Your constructor call should look something like:timer=Timer(method="hardcode",email="example@email.com",password="superSecure1",server="smtp.email.com",port=123)Note that if you are using Gmail, you may have to create anapp password. Your normal password will likely not work. Other email services may have similar catches.Using scriptimerThe use of scriptimer is very straightforward:In a terminal,pip install scriptimeIn a Python (.py) or Jupyter Notebook (.ipynb) file, addfromscriptimeimportTimerto your imports.Create an instance of a timer, which could be done in three ways dependant on what you did inGetting Started:JSON config filetimer=Timer(method="json",config_file="path/to/config.json")Environment variablestimer=Timer(method="env")Hard coding(This may look famiiliar):timer=Timer(method="hardcode",email="example@email.com",password="superSecure1",server="smtp.email.com",port=123)Start the timertimer.start()Then, at the end of the script (or wherever you would like a notification), add one of or both of the following:Email notificationTo get an email notification, simply call the send_email function:timer.send_email("receiver@email.com")You can also send a text using your carrier's email-to-SMS address. You can find your carrier at:list of carrier SMS emailstimer.send_email("0123456789@text.att.net")Multiple email addresses, phone numbers, or any combination thereof can be passed in as a list:timer.send_email(["receiver@email.com","0123456789@text.att.net"])Lastly, if you would like to see the output of the body in order to have the statistics persistent or just because you're curious, simply use theprint_bodyflag:timer.send_email("receiver@email.com",print_body=True)Play soundIf you would like an audible notification that your script has finished, simply:timer.play_sound()If the time measurement aspect of this program is important to you, be sure to run the play sound after sending the email (if you are sending the email at the end of the script) as it takes ~5 seconds to play the sound.OutputThe subject of the email will be:[MM-DD-YYYY HH:MM:SS] <name of file> FinishedThe email/text body will look like the following:Your script has finished.

Elapsed Time: 00:00:01

Max RAM Usage: 74.00%
Max CPU Usage: 40.90%
Remaining RAM Available: 2.08 GB

System information: Darwin
Processor: arm
Python Version: 3.11.4

Packages Used:
Package: numpy, Version: 1.24.2
Package: scikit-learn, Version: 1.2.2
...LinksSource code:https://github.com/straslerj/scriptimePyPI:https://pypi.org/project/scriptime/