tos library / Main page
tos
tos (the tos framework library) is a small Python module that provides convenience helpers for applications running on top of TrashOS Reborn. It exposes a per-application data directory, a cross-platform terminal helper, a root-mode check, and a version string.
Note: tos is designed to be imported by apps located in the tosapps/ folder of a TrashOS installation. It can also be imported standalone from any Python 3 script.
Overview
| Member | Kind | Purpose |
|---|---|---|
tos.appdata | object | Resolve per-app data directories under ./appdata/. |
tos.term | object | Cross-platform terminal helpers (clear screen, etc.). |
tos.is_root() | function | Returns whether the current shell is in root mode. |
tos.version | string | Library version constant. |
Quick example
import tos
# Get a writable folder for your app
data_dir = tos.appdata.path("mynotes")
# Clear the terminal
tos.term.cls()
# Detect root mode
if tos.is_root():
print("Running as root")
print("tos version", tos.version)
Where to go next
- Getting started — install the library and write your first tosapp.
- API reference — full documentation of every member.
- Examples — copy-paste recipes.
- TrashOS Reborn — the host operating system tos is built for.