fix: suppress CLI warnings for cleaner output

Suppress DeprecationWarning from aiosqlite and LogfireNotConfiguredWarning
that were cluttering CLI output.

The key fix is applying warnings.filterwarnings("ignore") AFTER all imports
in main.py, because authlib (imported via cloud commands) adds a
DeprecationWarning filter that overrides earlier suppressions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
phernandez
2025-12-24 12:21:14 -06:00
parent 63b98491be
commit d71c6e8568
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -1,3 +1,8 @@
# Suppress Logfire "not configured" warning - we only use Logfire in cloud/server contexts
import os
os.environ.setdefault("LOGFIRE_IGNORE_NO_CONFIG", "1")
# Remove loguru's default handler IMMEDIATELY, before any other imports.
# This prevents DEBUG logs from appearing on stdout during module-level
# initialization (e.g., template_loader.TemplateLoader() logs at DEBUG level).
+6
View File
@@ -16,6 +16,12 @@ from basic_memory.cli.commands import ( # noqa: F401 # pragma: no cover
tool,
)
# Re-apply warning filter AFTER all imports
# (authlib adds a DeprecationWarning filter that overrides ours)
import warnings # pragma: no cover
warnings.filterwarnings("ignore") # pragma: no cover
if __name__ == "__main__": # pragma: no cover
# start the app
app()