Lightweight collection of small Python utilities used across projects: a configurable exception handler, a colored terminal printing helper, and a simple Git update manager.
Last updated: 2026-01-17
ExceptionHandler/— Friendly, configurable exception formatting and handling. SeeExceptionHandler/README.mdfor details and examples.TerminalPrint/— Console printing helper with color schemes, log-to-file and timestamp support. SeeTerminalPrint/README.md.UpdateManager/— Small helper to fetch and merge updates from a remote Git branch for a local repo path. SeeUpdateManager/README.md.
Install requirements (if any):
pip install -r requirements.txtA short example using the three modules together:
from TerminalPrint import TPrint
from ExceptionHandler import Handler
from UpdateManager import GitUpdateManager
# Create a terminal printer
printer = TPrint(debug_mode=True, use_timestamps=True)
# Create an exception handler that uses the TPrint critical function
handler = Handler(show_line=True, trace=True, use_timestamp=True, print_function=printer.critical)
handler.formatter(main_color=printer.color_scheme['error'])
# Attempt an update with handling
try:
manager = GitUpdateManager(repo_path="../UpdateManager/", branch="main")
manager.update()
except Exception:
handler.exception(exit_script=False)Example scripts live under example/:
example/TPrint.py— demo forTerminalPrint.example/ExceptionHandle.py— demo forExceptionHandler.example/Update.py— demo forUpdateManager.
UpdateManagercalls the systemgitCLI and willsys.exit()on failures or when uncommitted changes are detected — ensure you have a clean working tree before runningupdate().ExceptionHandlermay callsys.exit()whenexit_scriptis enabled; preferreturn_string_rather_than_printfor library usage.- Terminal coloring uses ANSI escape codes; results may vary on non-ANSI terminals (Windows terminals recent versions and WSL work well).
Contributions welcome — open a pull request and include tests/examples where appropriate.
See the LICENSE file in the repository root.