Settings and files
runs = m.setting("runs", default=0)A choice, a list, a date. Never raises.
- Needs in machine.yaml
- Nothing
- Returns
- What was saved under
key, ordefault.
m.save_setting("runs", int(m.setting("runs", default=0) or 0) + 1)Up to 64 KB as JSON, and 200 settings in all. A settings field the owner fills on the machine's page is saved here too, under the field's key.
- Needs in machine.yaml
- Nothing
import sqlite3
db = sqlite3.connect(m.data_dir() / "quotes.db")
db.execute("CREATE TABLE IF NOT EXISTS quotes (id TEXT PRIMARY KEY, sent_at TEXT)")
db.close()Its SQLite file and its files. The only place it can write that outlives a restart.
- Needs in machine.yaml
- Nothing
- Returns
- A
pathlib.Path.