Skip to main content

A tiny tool using script as schema to schedule one day and remind you to do something during a day.

Project description

Schemdule

Downloads

Schemdule is a tiny tool using script as schema to schedule one day and remind you to do something during a day.

  • Platform
  • Python

Install

$ pip install schemdule

Usage

Write a Schema

It's a pure python script, so you can use any python statement in it.

Schemdule provide at, cycle, load and ext functions for registering events, and a PrompterConfiger variable named prompter to config prompter.

These functions and variable can be accessed and modified in the variable env, a dict for these items provided by Schemdule. You can change the env variable to change the execute environment for load function.

# raw_time can be {hh:mm} or {hh:mm:ss} or a datetime.time object

def at(raw_time: Union[str, time], message: str = "", payload: Any = None):
    # register an event at time with message
    ...

def cycle(raw_start: Union[str, time], raw_end: Union[str, time], raw_work_duration: Union[str, time], raw_rest_duration: Union[str, time], message: str = "", payload: Any = None):
    # register a series of events in cycle during start to end
    # the duration of one cycle = work_duration + rest_duration
    # For each cycle, register 2 event: cycle starting, cycle resting
    ...

def load(source: str) -> None:
    # load from a schema source code
    ...

def ext(name: str) -> None:
    # use an extension
    # provided by packages `schemdule-extensions-{extension name}`
    ...

# the class of the variable `prompter`

class PrompterConfiger:
    def use(self, prompter: Prompter) -> "PrompterConfiger": ...

    def useBroadcaster(self, final: bool = False) -> "PrompterConfiger": ...

    def useSwitcher(self, final: bool = False) -> "PrompterConfiger": ...

    def useConsole(self, final: bool = False) -> "PrompterConfiger": ...

    def useCallable(self, final: bool = False) -> "PrompterConfiger": ...

    def useTkinterMessageBox(self, final: bool = False) -> "PrompterConfiger": ...

    def clear(self) -> "PrompterConfiger": ...

# the default value of the variable `prompter`

def default_prompter_configer() -> PrompterConfiger:
    prompter = PrompterConfiger()
    prompter.useSwitcher().useConsole().useCallable(True).useTkinterMessageBox()
    return prompter

An example schema.

# Type annotions
from typing import Callable, Union, Any, Dict
from datetime import time
from schemdule.prompters.configer import PrompterConfiger
from schemdule.prompters import Prompter, PrompterHub
at: Callable[[Union[str, time], str, Any], None]
cycle: Callable[[Union[str, time], Union[str, time], Union[str, time], Union[str, time], str, Any], None]
load: Callable[[str], None]
ext: Callable[[str], None]
prompter: PrompterConfiger
env: Dict[str, Any]

# Schema
at("6:30", "Get up")
cycle("8:00", "12:00", "00:30:00", "00:10:00", "Working")
# Import other schema by `load` function
# with open("other_schema.py", encoding="utf8") as f:
    # load(f.read())

prompter.useTkinterMessageBox()
# use multiple prompter:
# ext("simplegui") # use simplegui extension (package schemdule-extensions-simplegui)
# prompter.useBroadcaster().useConsole().useMessageBox(True)

The built timetable is like the following one.

Get up @ 06:30:00
Working (cycle 1 starting) @ 08:00:00
Working (cycle 1 resting starting) @ 08:30:00
Working (cycle 2 starting) @ 08:40:00
Working (cycle 2 resting starting) @ 09:10:00
Working (cycle 3 starting) @ 09:20:00
Working (cycle 3 resting starting) @ 09:50:00
Working (cycle 4 starting) @ 10:00:00
Working (cycle 4 resting starting) @ 10:30:00
Working (cycle 5 starting) @ 10:40:00
Working (cycle 5 resting starting) @ 11:10:00
Working (cycle 6 starting) @ 11:20:00
Working (cycle 6 resting starting) @ 11:50:00

Run

# load and run from the schema
schemdule run schema.py
# or use python
# python -m schemdule run schema.py

# preview the built timetable
schemdule run schema.py --preview

# try the builtin demo (just for testing)
schemdule demo

Extensions

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

schemdule-0.0.5.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

schemdule-0.0.5-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

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