Explorar o código

add rich support for logging and ruff for formatting

Nick Sweeting hai 1 ano
pai
achega
a190745f36
Modificáronse 2 ficheiros con 14 adicións e 0 borrados
  1. 7 0
      archivebox/monkey_patches.py
  2. 7 0
      pyproject.toml

+ 7 - 0
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)

+ 7 - 0
pyproject.toml

@@ -48,6 +48,7 @@ dependencies = [
     "pocket@git+https://github.com/tapanpandita/[email protected]",
     "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" ]