/FuncNotify

Decorator for python that automatically notifies you of start and completion using environment variables

Primary LanguagePythonMIT LicenseMIT

FuncNotify ⏰

Get notified when your functions run

Build Deploy LCommit release License wheel

Premise:

Sometimes, functions take a long time. I wanted to create something that automatically notifies you when they're completed without risking exposing your phone number.

Installation use pip or equivalent

$ pip install FuncNotify

Quick Guide

# Add more as projects grow!
from FuncNotify import time_func, time_text, time_slack


@time_func(NotifyMethod="Text", use_env=True, env_path".env", update_env=True, cellphone="8001234567")
def wait_func():
    """This function will use the text method and pull env varaibles from
    `.env`, it will update the already determined env variables too!"""
    do_something()


@time_text()
def wait_func2():
    """All parameters are optional and each method has a personal decorator, even the 
    function call is optional see below"""
    do_something()

@time_text
def wait_func3():
    """Auto pull from `.env` is enabled by default with Method specific time decorators"""
    do_something()

if __name__ == "__main__":
    """You don't even need to use the timer as a decorator, use it as a normal function
    This is how we do testing :) """
    time_func(function=wait_func4)(*func4_args, **func4_kwargs)

Click above for instructions on how to contribute

Supported Notify Methods

Platform
Console Print
Email
Text
Slack
Microsoft Teams

TODO:

Personal stuff to organize and show what's currently accocmplished in the project
Project TODOs

Admin stuff/documentation

  • Complete ReadMe
  • Remove my environment variables
  • Document environment variables
  • Write some tests

Code stuff

  • Add support for texts
  • Add support for slack
  • Add Default notify
  • Add ENV variable support
  • Use user email to search for slackID
  • Add generic decorator support
  • Add arguments to decorator support so you can specify keyword arguments like "(email={email}, token={token})"
  • Add .env support
  • Write Tests
  • Add logger support
  • Dropped support for 2.7, too annoying to mantain as metaclass was different
  • Made super easy to add to (automated imports, define the decorator at the same time).
  • Separate tests
  • GitHub action auto deployment
  • Add email
  • Add whatsapp
  • Add wechat
  • Add Microsoft teams
  • Add Some other

Create .env in current working directory and fill out information that you wanna use
.env Strongly encourage copying this template