From 47c48abf836f5918120c0550c57d4eda32d3f10e Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 3 Dec 2024 17:52:52 -0500 Subject: Convert Biz/Storybook.py to Ludic This is basically a full rewrite. I ripped out Flask and rearchitected the whole thing to use fully RESTful resources and endpoints using Ludic. The UI was completely redone to use Ludic's components. I added tests for everything that I reasonably could. This is almost ready for an alpha launch. Before shipping it I still need to: 1. generate images using image n-1 applied to `openai.images.create_variation()` 2. write a nix service, get it on a VM somewhere, I'll probably provision a new VM for this 3. replace the `db` thing with a real sqlite database I only need the first one done to show it to Lia and see if she likes it, that should be completed in a day or two. Then the nix service and deployment won't take long at all. Setting up a sqlite database will be annoying, but that I can't see that actually taking more than 2 days. So max 5 days out from launching this to friends and family. --- Omni/Bild/Deps/Python.nix | 14 +++++++++++++- Omni/Log.py | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'Omni') diff --git a/Omni/Bild/Deps/Python.nix b/Omni/Bild/Deps/Python.nix index e36896a..9af4630 100644 --- a/Omni/Bild/Deps/Python.nix +++ b/Omni/Bild/Deps/Python.nix @@ -1 +1,13 @@ -[ "cryptography" "llm" "mypy" "nltk" "slixmpp" "flask" "openai" "ludic" ] +[ + "cryptography" + "flask" + "llm" + "ludic" + "mypy" + "nltk" + "openai" + "slixmpp" + "sqids" + "starlette" + "uvicorn" +] diff --git a/Omni/Log.py b/Omni/Log.py index 2fbd007..e644a1a 100644 --- a/Omni/Log.py +++ b/Omni/Log.py @@ -1,6 +1,5 @@ """Setup logging like Omni/Log.hs.""" -# noqa: builtin-attribute-shadowing import logging import typing @@ -14,10 +13,10 @@ class LowerFormatter(logging.Formatter): return super(logging.Formatter, self).format(record) # type: ignore[misc] -def setup() -> None: +def setup(level: int = logging.INFO) -> logging.Logger: """Run this in your __main__ function.""" logging.basicConfig( - level=logging.DEBUG, + level=level, format="%(levelname)s: %(name)s: %(message)s", ) logging.addLevelName(logging.DEBUG, "dbug") @@ -28,6 +27,7 @@ def setup() -> None: handler = logging.StreamHandler() handler.setFormatter(formatter) logger.addHandler(handler) + return logger if __name__ == "__main__": -- cgit v1.2.3