From a190745f36871d2e6e336400826173f9b054535e Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 5 Sep 2024 21:44:18 -0700 Subject: [PATCH] add rich support for logging and ruff for formatting --- archivebox/monkey_patches.py | 7 +++++++ pyproject.toml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/archivebox/monkey_patches.py b/archivebox/monkey_patches.py index 0dcfa082..8f19f915 100644 --- a/archivebox/monkey_patches.py +++ b/archivebox/monkey_patches.py @@ -14,3 +14,10 @@ timezone.utc = datetime.timezone.utc # monkey patch django-signals-webhooks to change how it shows up in Admin UI # from signal_webhooks.apps import DjangoSignalWebhooksConfig # DjangoSignalWebhooksConfig.verbose_name = 'API' + + +# Install rich for pretty tracebacks in console logs +# https://rich.readthedocs.io/en/stable/traceback.html#traceback-handler +from rich.traceback import install + +install(show_locals=True) diff --git a/pyproject.toml b/pyproject.toml index 6d3f8521..58dee8da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ dependencies = [ "pocket@git+https://github.com/tapanpandita/pocket.git@v0.3.7", "django-taggit==1.3.0", "base32-crockford==0.3.0", + "rich>=13.8.0", ] homepage = "https://github.com/ArchiveBox/ArchiveBox" @@ -113,6 +114,12 @@ build-backend = "pdm.backend" archivebox = "archivebox.cli:main" +[tool.ruff] +line-length = 140 +target-version = "py310" +src = ["archivebox"] +exclude = ["*.pyi", "typings/", "migrations/", "vendor/"] + [tool.pytest.ini_options] testpaths = [ "tests" ]