Package: schemdule
Schemduleis a tiny tool using script as schema to schedule one day and remind you to do something during a day.PlatformPythonInstallUse pip:pipinstallschemduleOr use pipx:# Install pipxpipinstall--userpipx
pipxensurepath# Install Schemdulepipxinstallschemdule# Install extensionpipxinjectschemduleschemdule-extensions-{extensionname}# Upgradepipxupgradeschemdule--include-injectedUsageWrite a SchemaAn example schema.# Schemaat("6:30","Get up")cycle("8:00","12:00","00:30:00","00:10:00","Working")# Import other schema by `load` function# load("other_schema.py")prompter.useTkinterMessageBox()# ext("simplegui") # use simplegui extension (package schemdule-extensions-simplegui)# use multiple prompter:# prompter.useBroadcaster().useConsole().useMessageBox(True)The built timetable is like the following one from the results of the commandschemdule run schema.py --preview.🕡 06:30:00 - 🕗 08:00:00 🔔 Get up
🕗 08:00:00 - 🕣 08:30:00 💼 Working (cycle 1 starting)
🕣 08:30:00 - 🕣 08:40:00 ☕ Working (cycle 1 resting starting)
🕣 08:40:00 - 🕘 09:10:00 💼 Working (cycle 2 starting)
🕘 09:10:00 - 🕘 09:20:00 ☕ Working (cycle 2 resting starting)
🕘 09:20:00 - 🕤 09:50:00 💼 Working (cycle 3 starting)
🕤 09:50:00 - 🕙 10:00:00 ☕ Working (cycle 3 resting starting)
🕙 10:00:00 - 🕥 10:30:00 💼 Working (cycle 4 starting)
🕥 10:30:00 - 🕥 10:40:00 ☕ Working (cycle 4 resting starting)
🕥 10:40:00 - 🕚 11:10:00 💼 Working (cycle 5 starting)
🕚 11:10:00 - 🕚 11:20:00 ☕ Working (cycle 5 resting starting)
🕚 11:20:00 - 🕦 11:50:00 💼 Working (cycle 6 starting)
🕦 11:50:00 - 🕦 11:50:00 ☕ Working (cycle 6 resting starting)Run# load and run from the schemaschemdulerunschema.py# or use python# python -m schemdule run schema.py# preview the built timetableschemdulerunschema.py--preview# try the builtin demo (just for testing)schemduledemoSchema SpecificationSchema is a pure python script, so you can use any python statement in it.Schemdule provideat,cycle,loadandextfunctions for registering events, and aPrompterBuildervariable namedprompterto config prompter.These functions and variable can be accessed and modified in the variableenv, a dict for these items provided by Schemdule. You can change theenvvariable to change the execute environment forloadfunction.# raw_time can be {hh:mm} or {hh:mm:ss} or a datetime.time objectdefat(rawTime:Union[str,time],message:str="",payload:Any=None)->None:# register an event at time with message# if payload is a PayloadBuilder, Schemdule will build the final payload automaticly...defcycle(rawStart:Union[str,time],rawEnd:Union[str,time],rawWorkDuration:Union[str,time,timedelta],rawRestDuration:Union[str,time,timedelta],message:str="",workPayload:Optional[Callable[[int],Any]]=None,restPayload:Optional[Callable[[int],Any]]=None)->None:# register a series of events in cycle during start to end# the duration of one cycle = workDuration + restDuration# For each cycle, register 2 event: cycle starting, cycle resting# workPayload and restPayload is the payload generator such as:#   def generator(index: int) -> Any: ...# if the returened payload is a PayloadBuilder, Schemdule will build the final payload automaticly,...defloadRaw(source:str)->None:# load from a schema source code...defload(file:str,encoding:str="utf8")->None:# load from a schema source code file...defext(name:Optional[str]=None)->None:# use an extension or use all installed extensions (if name is None)# provided by packages `schemdule-extensions-{extension name}`...defpayloads()->PayloadBuilder:# create a payload builder...defprompters()->PrompterBuilder:# create a prompter builder...# the class PayloadBuilderclassPayloadBuilder:defuse(self,payload:Any)->"PayloadBuilder":...# the class of the variable `prompter`classPrompterBuilder:defuse(self,prompter:Union[Prompter,"PrompterBuilder"])->"PrompterBuilder":defuseBroadcaster(self,final:bool=False)->"PrompterBuilder":...defuseSwitcher(self,final:bool=False)->"PrompterBuilder":...defuseConsole(self,final:bool=False)->"PrompterBuilder":...defuseCallable(self,final:bool=False)->"PrompterBuilder":...defuseTkinterMessageBox(self,final:bool=False)->"PrompterBuilder":...defclear(self)->"PrompterBuilder":...# the default value of the variable `prompter`defdefault_prompter_builder()->PrompterBuilder:prompter=PrompterBuilder()prompter.useSwitcher().useConsole().useCallable(True).useTkinterMessageBox()returnprompterHere are the type annotions for schema.# Type annotionsfromtypingimportCallable,Union,Any,Dict,Optionalfromdatetimeimporttime,timedeltafromschemdule.prompters.buildersimportPrompterBuilder,PayloadBuilderfromschemdule.promptersimportPrompter,PrompterHubat:Callable[[Union[str,time],str,Any],None]cycle:Callable[[Union[str,time],Union[str,time],Union[str,time,timedelta],Union[str,time,timedelta],str,Optional[Callable[[int],Any]],Optional[Callable[[int],Any]]],None]loadRaw:Callable[[str],None]load:Callable[[str],None]ext:Callable[[Optional[str]],None]payloads:Callable[[],PayloadBuilder]payloads:Callable[[],PrompterBuilder]prompter:PrompterBuilderenv:Dict[str,Any]ExtensionsSimpleGUIMiaotixingAudioPlayAll extensions on PyPI