From db1e4ce43227d955180946268e6605b2b7e4d5c0 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Thu, 5 Mar 2026 15:05:15 -0800 Subject: [PATCH] Refactor: add explicit supports_progress_bar and supports_multiprocessing to all PaperlessCommand subclasses Each management command now explicitly declares both class attributes rather than relying on defaults, making intent unambiguous at a glance. Co-Authored-By: Claude Sonnet 4.6 --- src/documents/management/commands/document_archiver.py | 1 + src/documents/management/commands/document_exporter.py | 1 + src/documents/management/commands/document_fuzzy_match.py | 1 + src/documents/management/commands/document_importer.py | 1 + src/documents/management/commands/document_index.py | 3 +++ src/documents/management/commands/document_llmindex.py | 3 +++ src/documents/management/commands/document_renamer.py | 3 +++ src/documents/management/commands/document_retagger.py | 3 +++ src/documents/management/commands/document_sanity_checker.py | 3 +++ src/documents/management/commands/document_thumbnails.py | 1 + src/documents/management/commands/prune_audit_logs.py | 3 +++ 11 files changed, 23 insertions(+) diff --git a/src/documents/management/commands/document_archiver.py b/src/documents/management/commands/document_archiver.py index 5926319f4..bd3484321 100644 --- a/src/documents/management/commands/document_archiver.py +++ b/src/documents/management/commands/document_archiver.py @@ -17,6 +17,7 @@ class Command(PaperlessCommand): "modified) after their initial import." ) + supports_progress_bar = True supports_multiprocessing = True def add_arguments(self, parser): diff --git a/src/documents/management/commands/document_exporter.py b/src/documents/management/commands/document_exporter.py index f53feb0e3..a95c1565d 100644 --- a/src/documents/management/commands/document_exporter.py +++ b/src/documents/management/commands/document_exporter.py @@ -88,6 +88,7 @@ class Command(CryptMixin, PaperlessCommand): ) supports_progress_bar = True + supports_multiprocessing = False def add_arguments(self, parser) -> None: super().add_arguments(parser) diff --git a/src/documents/management/commands/document_fuzzy_match.py b/src/documents/management/commands/document_fuzzy_match.py index 5d10d8008..60d00f9cc 100644 --- a/src/documents/management/commands/document_fuzzy_match.py +++ b/src/documents/management/commands/document_fuzzy_match.py @@ -40,6 +40,7 @@ def _process_and_match(work: _WorkPackage) -> _WorkResult: class Command(PaperlessCommand): help = "Searches for documents where the content almost matches" + supports_progress_bar = True supports_multiprocessing = True def add_arguments(self, parser): diff --git a/src/documents/management/commands/document_importer.py b/src/documents/management/commands/document_importer.py index 68ff49430..cd3cb7afc 100644 --- a/src/documents/management/commands/document_importer.py +++ b/src/documents/management/commands/document_importer.py @@ -63,6 +63,7 @@ class Command(CryptMixin, PaperlessCommand): ) supports_progress_bar = True + supports_multiprocessing = False def add_arguments(self, parser) -> None: super().add_arguments(parser) diff --git a/src/documents/management/commands/document_index.py b/src/documents/management/commands/document_index.py index 05efe870c..742922010 100644 --- a/src/documents/management/commands/document_index.py +++ b/src/documents/management/commands/document_index.py @@ -8,6 +8,9 @@ from documents.tasks import index_reindex class Command(PaperlessCommand): help = "Manages the document index." + supports_progress_bar = True + supports_multiprocessing = False + def add_arguments(self, parser): super().add_arguments(parser) parser.add_argument("command", choices=["reindex", "optimize"]) diff --git a/src/documents/management/commands/document_llmindex.py b/src/documents/management/commands/document_llmindex.py index 6af1c7c9f..3b9e3440b 100644 --- a/src/documents/management/commands/document_llmindex.py +++ b/src/documents/management/commands/document_llmindex.py @@ -7,6 +7,9 @@ from documents.tasks import llmindex_index class Command(PaperlessCommand): help = "Manages the LLM-based vector index for Paperless." + supports_progress_bar = True + supports_multiprocessing = False + def add_arguments(self, parser: Any) -> None: super().add_arguments(parser) parser.add_argument("command", choices=["rebuild", "update"]) diff --git a/src/documents/management/commands/document_renamer.py b/src/documents/management/commands/document_renamer.py index 05f0224bb..0e16f5cce 100644 --- a/src/documents/management/commands/document_renamer.py +++ b/src/documents/management/commands/document_renamer.py @@ -7,6 +7,9 @@ from documents.models import Document class Command(PaperlessCommand): help = "Rename all documents" + supports_progress_bar = True + supports_multiprocessing = False + def handle(self, *args, **options): for document in self.track(Document.objects.all(), description="Renaming..."): post_save.send(Document, instance=document, created=False) diff --git a/src/documents/management/commands/document_retagger.py b/src/documents/management/commands/document_retagger.py index 9dadc803f..fc2e52e86 100644 --- a/src/documents/management/commands/document_retagger.py +++ b/src/documents/management/commands/document_retagger.py @@ -180,6 +180,9 @@ class Command(PaperlessCommand): "modified) after their initial import." ) + supports_progress_bar = True + supports_multiprocessing = False + def add_arguments(self, parser) -> None: super().add_arguments(parser) parser.add_argument("-c", "--correspondent", default=False, action="store_true") diff --git a/src/documents/management/commands/document_sanity_checker.py b/src/documents/management/commands/document_sanity_checker.py index df5a3e4bf..598ddf7bb 100644 --- a/src/documents/management/commands/document_sanity_checker.py +++ b/src/documents/management/commands/document_sanity_checker.py @@ -24,6 +24,9 @@ _LEVEL_STYLE: dict[int, tuple[str, str]] = { class Command(PaperlessCommand): help = "This command checks your document archive for issues." + supports_progress_bar = True + supports_multiprocessing = False + def _render_results(self, messages: SanityCheckMessages) -> None: """Render sanity check results as a Rich table.""" diff --git a/src/documents/management/commands/document_thumbnails.py b/src/documents/management/commands/document_thumbnails.py index 994b801bd..2d8609588 100644 --- a/src/documents/management/commands/document_thumbnails.py +++ b/src/documents/management/commands/document_thumbnails.py @@ -36,6 +36,7 @@ def _process_document(doc_id: int) -> None: class Command(PaperlessCommand): help = "This will regenerate the thumbnails for all documents." + supports_progress_bar = True supports_multiprocessing = True def add_arguments(self, parser) -> None: diff --git a/src/documents/management/commands/prune_audit_logs.py b/src/documents/management/commands/prune_audit_logs.py index eac690757..1a54332cd 100644 --- a/src/documents/management/commands/prune_audit_logs.py +++ b/src/documents/management/commands/prune_audit_logs.py @@ -9,6 +9,9 @@ class Command(PaperlessCommand): help = "Prunes the audit logs of objects that no longer exist." + supports_progress_bar = True + supports_multiprocessing = False + def handle(self, *args, **options): with transaction.atomic(): for log_entry in self.track(