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

Use pip:

pip install schemdule

Or use pipx:

# Install pipx
pip install --user pipx
pipx ensurepath

# Install Schemdule
pipx install schemdule

# Install extension
pipx inject schemdule schemdule-extensions-{extension name}

# Upgrade
pipx upgrade schemdule --include-injected

Usage

Write a Schema

An example schema.

# Schema
at("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 command schemdule 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 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

Schema Specification

Schema is 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 PrompterBuilder 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(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
    ...

def cycle(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, 
    ...


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

def load(file: str, encoding: str = "utf8") -> None:
    # load from a schema source code file
    ...

def ext(name: Optional[str] = None) -> None:
    # use an extension or use all installed extensions (if name is None)
    # provided by packages `schemdule-extensions-{extension name}`
    ...

def payloads() -> PayloadBuilder:
    # create a payload builder
    ...

def prompters() -> PrompterBuilder:
    # create a prompter builder
    ...

# the class PayloadBuilder

class PayloadBuilder:
    def use(self, payload: Any) -> "PayloadBuilder": ...

# the class of the variable `prompter`

class PrompterBuilder:
    def use(self, prompter: Union[Prompter, "PrompterBuilder"]) -> "PrompterBuilder":

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

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

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

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

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

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

# the default value of the variable `prompter`

def default_prompter_builder() -> PrompterBuilder:
    prompter = PrompterBuilder()
    prompter.useSwitcher().useConsole().useCallable(True).useTkinterMessageBox()
    return prompter

Here are the type annotions for schema.

# Type annotions
from typing import Callable, Union, Any, Dict, Optional
from datetime import time, timedelta
from schemdule.prompters.builders import PrompterBuilder, PayloadBuilder
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, 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: PrompterBuilder
env: Dict[str, Any]

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.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

schemdule-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file schemdule-0.1.0.tar.gz.

File metadata

  • Download URL: schemdule-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.14

File hashes

Hashes for schemdule-0.1.0.tar.gz
Algorithm Hash digest
SHA256 25124df4744d5ee27768bad97830f26c97082977fbfce8fe6ce5e0e5275367d6
MD5 75acbd2c41d27874dc2714e61d76ea39
BLAKE2b-256 9459ed45f5eb586c5e3b60b579524ccba3bd6fc6039a62b3df9c7c9640597be8

See more details on using hashes here.

File details

Details for the file schemdule-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: schemdule-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.14

File hashes

Hashes for schemdule-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 928616d85c1ddd4c6c97b2378ebc970bd76e4d9fafce3d1046d1db88117a34d6
MD5 a4180de118ad27e0181be867a88b6cd6
BLAKE2b-256 c233810448500d04529c04b9ccd86c01d092d7d02f50041aabd35b134e83098d

See more details on using hashes here.

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