mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Chore: Backend dependencies update (#5676)
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @@ -16,7 +16,7 @@ on: | |||||||
| env: | env: | ||||||
|   # This is the version of pipenv all the steps will use |   # This is the version of pipenv all the steps will use | ||||||
|   # If changing this, change Dockerfile |   # If changing this, change Dockerfile | ||||||
|   DEFAULT_PIP_ENV_VERSION: "2023.11.15" |   DEFAULT_PIP_ENV_VERSION: "2023.12.1" | ||||||
|   # This is the default version of Python to use in most steps which aren't specific |   # This is the default version of Python to use in most steps which aren't specific | ||||||
|   DEFAULT_PYTHON_VERSION: "3.10" |   DEFAULT_PYTHON_VERSION: "3.10" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -47,11 +47,11 @@ repos: | |||||||
|         exclude: "(^Pipfile\\.lock$)" |         exclude: "(^Pipfile\\.lock$)" | ||||||
|   # Python hooks |   # Python hooks | ||||||
|   - repo: https://github.com/astral-sh/ruff-pre-commit |   - repo: https://github.com/astral-sh/ruff-pre-commit | ||||||
|     rev: 'v0.1.11' |     rev: 'v0.2.1' | ||||||
|     hooks: |     hooks: | ||||||
|       - id: ruff |       - id: ruff | ||||||
|   - repo: https://github.com/psf/black-pre-commit-mirror |   - repo: https://github.com/psf/black-pre-commit-mirror | ||||||
|     rev: 23.12.1 |     rev: 24.1.1 | ||||||
|     hooks: |     hooks: | ||||||
|       - id: black |       - id: black | ||||||
|   # Dockerfile hooks |   # Dockerfile hooks | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								.ruff.toml
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								.ruff.toml
									
									
									
									
									
								
							| @@ -1,5 +1,14 @@ | |||||||
|  | fix = true | ||||||
|  | line-length = 88 | ||||||
|  | respect-gitignore = true | ||||||
|  | src = ["src"] | ||||||
|  | target-version = "py39" | ||||||
|  | output-format = "grouped" | ||||||
|  | show-fixes = true | ||||||
|  |  | ||||||
| # https://docs.astral.sh/ruff/settings/ | # https://docs.astral.sh/ruff/settings/ | ||||||
| # https://docs.astral.sh/ruff/rules/ | # https://docs.astral.sh/ruff/rules/ | ||||||
|  | [lint] | ||||||
| extend-select = [ | extend-select = [ | ||||||
|   "W",     # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w |   "W",     # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w | ||||||
|   "I",     # https://docs.astral.sh/ruff/rules/#isort-i |   "I",     # https://docs.astral.sh/ruff/rules/#isort-i | ||||||
| @@ -25,15 +34,8 @@ extend-select = [ | |||||||
| ] | ] | ||||||
| # TODO PTH https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth | # TODO PTH https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth | ||||||
| ignore = ["DJ001", "SIM105", "RUF012"] | ignore = ["DJ001", "SIM105", "RUF012"] | ||||||
| fix = true |  | ||||||
| line-length = 88 |  | ||||||
| respect-gitignore = true |  | ||||||
| src = ["src"] |  | ||||||
| target-version = "py39" |  | ||||||
| output-format = "grouped" |  | ||||||
| show-fixes = true |  | ||||||
|  |  | ||||||
| [per-file-ignores] | [lint.per-file-ignores] | ||||||
| ".github/scripts/*.py" = ["E501", "INP001", "SIM117"] | ".github/scripts/*.py" = ["E501", "INP001", "SIM117"] | ||||||
| "docker/wait-for-redis.py" = ["INP001", "T201"] | "docker/wait-for-redis.py" = ["INP001", "T201"] | ||||||
| "*/tests/*.py" = ["E501", "SIM117"] | "*/tests/*.py" = ["E501", "SIM117"] | ||||||
| @@ -41,5 +43,5 @@ show-fixes = true | |||||||
| "src/paperless_tesseract/tests/test_parser.py" = ["RUF001"] | "src/paperless_tesseract/tests/test_parser.py" = ["RUF001"] | ||||||
| "src/documents/models.py" = ["SIM115"] | "src/documents/models.py" = ["SIM115"] | ||||||
|  |  | ||||||
| [isort] | [lint.isort] | ||||||
| force-single-line = true | force-single-line = true | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ COPY Pipfile* ./ | |||||||
|  |  | ||||||
| RUN set -eux \ | RUN set -eux \ | ||||||
|   && echo "Installing pipenv" \ |   && echo "Installing pipenv" \ | ||||||
|     && python3 -m pip install --no-cache-dir --upgrade pipenv==2023.11.15 \ |     && python3 -m pip install --no-cache-dir --upgrade pipenv==2023.12.1 \ | ||||||
|   && echo "Generating requirement.txt" \ |   && echo "Generating requirement.txt" \ | ||||||
|     && pipenv requirements > requirements.txt |     && pipenv requirements > requirements.txt | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								Pipfile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Pipfile
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ name = "pypi" | |||||||
| dateparser = "~=1.2" | dateparser = "~=1.2" | ||||||
| # WARNING: django does not use semver. | # WARNING: django does not use semver. | ||||||
| #          Only patch versions are guaranteed to not introduce breaking changes. | #          Only patch versions are guaranteed to not introduce breaking changes. | ||||||
| django = "~=4.2.9" | django = "~=4.2.10" | ||||||
| django-allauth = "*" | django-allauth = "*" | ||||||
| django-auditlog = "*" | django-auditlog = "*" | ||||||
| django-celery-results = "*" | django-celery-results = "*" | ||||||
| @@ -46,11 +46,11 @@ python-magic = "*" | |||||||
| pyzbar = "*" | pyzbar = "*" | ||||||
| rapidfuzz = "*" | rapidfuzz = "*" | ||||||
| redis = {extras = ["hiredis"], version = "*"} | redis = {extras = ["hiredis"], version = "*"} | ||||||
| scikit-learn = "~=1.3" | scikit-learn = "~=1.4" | ||||||
| setproctitle = "*" | setproctitle = "*" | ||||||
| tika-client = "*" | tika-client = "*" | ||||||
| tqdm = "*" | tqdm = "*" | ||||||
| uvicorn = {extras = ["standard"], version = "*"} | uvicorn = {extras = ["standard"], version = "==0.25.0"} | ||||||
| watchdog = "~=3.0" | watchdog = "~=3.0" | ||||||
| whitenoise = "~=6.6" | whitenoise = "~=6.6" | ||||||
| whoosh="~=2.7" | whoosh="~=2.7" | ||||||
|   | |||||||
							
								
								
									
										1192
									
								
								Pipfile.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1192
									
								
								Pipfile.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -82,13 +82,14 @@ class MatchingModelSerializer(serializers.ModelSerializer): | |||||||
|  |  | ||||||
|     def validate(self, data): |     def validate(self, data): | ||||||
|         # TODO: remove pending https://github.com/encode/django-rest-framework/issues/7173 |         # TODO: remove pending https://github.com/encode/django-rest-framework/issues/7173 | ||||||
|         name = data["name"] if "name" in data else self.instance.name |         name = data.get( | ||||||
|  |             "name", | ||||||
|  |             self.instance.name if hasattr(self.instance, "name") else None, | ||||||
|  |         ) | ||||||
|         owner = ( |         owner = ( | ||||||
|             data["owner"] |             data["owner"] | ||||||
|             if "owner" in data |             if "owner" in data | ||||||
|             else self.user |             else self.user if hasattr(self, "user") else None | ||||||
|             if hasattr(self, "user") |  | ||||||
|             else None |  | ||||||
|         ) |         ) | ||||||
|         pk = self.instance.pk if hasattr(self.instance, "pk") else None |         pk = self.instance.pk if hasattr(self.instance, "pk") else None | ||||||
|         if ("name" in data or "owner" in data) and self.Meta.model.objects.filter( |         if ("name" in data or "owner" in data) and self.Meta.model.objects.filter( | ||||||
| @@ -261,7 +262,7 @@ class OwnedObjectSerializer(serializers.ModelSerializer, SetPermissionsMixin): | |||||||
|         if "set_permissions" in validated_data: |         if "set_permissions" in validated_data: | ||||||
|             self._set_permissions(validated_data["set_permissions"], instance) |             self._set_permissions(validated_data["set_permissions"], instance) | ||||||
|         if "owner" in validated_data and "name" in self.Meta.fields: |         if "owner" in validated_data and "name" in self.Meta.fields: | ||||||
|             name = validated_data["name"] if "name" in validated_data else instance.name |             name = validated_data.get("name", instance.name) | ||||||
|             not_unique = ( |             not_unique = ( | ||||||
|                 self.Meta.model.objects.exclude(pk=instance.pk) |                 self.Meta.model.objects.exclude(pk=instance.pk) | ||||||
|                 .filter(owner=validated_data["owner"], name=name) |                 .filter(owner=validated_data["owner"], name=name) | ||||||
| @@ -443,7 +444,10 @@ class CustomFieldSerializer(serializers.ModelSerializer): | |||||||
|  |  | ||||||
|     def validate(self, attrs): |     def validate(self, attrs): | ||||||
|         # TODO: remove pending https://github.com/encode/django-rest-framework/issues/7173 |         # TODO: remove pending https://github.com/encode/django-rest-framework/issues/7173 | ||||||
|         name = attrs["name"] if "name" in attrs else self.instance.name |         name = attrs.get( | ||||||
|  |             "name", | ||||||
|  |             self.instance.name if hasattr(self.instance, "name") else None, | ||||||
|  |         ) | ||||||
|         if ("name" in attrs) and self.Meta.model.objects.filter( |         if ("name" in attrs) and self.Meta.model.objects.filter( | ||||||
|             name=name, |             name=name, | ||||||
|         ).exists(): |         ).exists(): | ||||||
| @@ -697,10 +701,7 @@ class DocumentSerializer( | |||||||
|                             custom_field_instance.field, |                             custom_field_instance.field, | ||||||
|                             doc_id, |                             doc_id, | ||||||
|                         ) |                         ) | ||||||
|         if ( |         if validated_data.get("remove_inbox_tags"): | ||||||
|             "remove_inbox_tags" in validated_data |  | ||||||
|             and validated_data["remove_inbox_tags"] |  | ||||||
|         ): |  | ||||||
|             tag_ids_being_added = ( |             tag_ids_being_added = ( | ||||||
|                 [ |                 [ | ||||||
|                     tag.id |                     tag.id | ||||||
| @@ -1352,7 +1353,7 @@ class BulkEditObjectPermissionsSerializer(serializers.Serializer, SetPermissions | |||||||
|     def validate(self, attrs): |     def validate(self, attrs): | ||||||
|         object_type = attrs["object_type"] |         object_type = attrs["object_type"] | ||||||
|         objects = attrs["objects"] |         objects = attrs["objects"] | ||||||
|         permissions = attrs["permissions"] if "permissions" in attrs else None |         permissions = attrs.get("permissions") | ||||||
|  |  | ||||||
|         self._validate_objects(objects, object_type) |         self._validate_objects(objects, object_type) | ||||||
|         if permissions is not None: |         if permissions is not None: | ||||||
| @@ -1514,7 +1515,7 @@ class WorkflowSerializer(serializers.ModelSerializer): | |||||||
|             for trigger in triggers: |             for trigger in triggers: | ||||||
|                 filter_has_tags = trigger.pop("filter_has_tags", None) |                 filter_has_tags = trigger.pop("filter_has_tags", None) | ||||||
|                 trigger_instance, _ = WorkflowTrigger.objects.update_or_create( |                 trigger_instance, _ = WorkflowTrigger.objects.update_or_create( | ||||||
|                     id=trigger["id"] if "id" in trigger else None, |                     id=trigger.get("id"), | ||||||
|                     defaults=trigger, |                     defaults=trigger, | ||||||
|                 ) |                 ) | ||||||
|                 if filter_has_tags is not None: |                 if filter_has_tags is not None: | ||||||
| @@ -1530,7 +1531,7 @@ class WorkflowSerializer(serializers.ModelSerializer): | |||||||
|                 assign_change_groups = action.pop("assign_change_groups", None) |                 assign_change_groups = action.pop("assign_change_groups", None) | ||||||
|                 assign_custom_fields = action.pop("assign_custom_fields", None) |                 assign_custom_fields = action.pop("assign_custom_fields", None) | ||||||
|                 action_instance, _ = WorkflowAction.objects.update_or_create( |                 action_instance, _ = WorkflowAction.objects.update_or_create( | ||||||
|                     id=action["id"] if "id" in action else None, |                     id=action.get("id"), | ||||||
|                     defaults=action, |                     defaults=action, | ||||||
|                 ) |                 ) | ||||||
|                 if assign_tags is not None: |                 if assign_tags is not None: | ||||||
|   | |||||||
| @@ -559,15 +559,21 @@ def run_workflow( | |||||||
|                     try: |                     try: | ||||||
|                         document.title = parse_doc_title_w_placeholders( |                         document.title = parse_doc_title_w_placeholders( | ||||||
|                             action.assign_title, |                             action.assign_title, | ||||||
|  |                             ( | ||||||
|                                 document.correspondent.name |                                 document.correspondent.name | ||||||
|                                 if document.correspondent is not None |                                 if document.correspondent is not None | ||||||
|                             else "", |                                 else "" | ||||||
|  |                             ), | ||||||
|  |                             ( | ||||||
|                                 document.document_type.name |                                 document.document_type.name | ||||||
|                                 if document.document_type is not None |                                 if document.document_type is not None | ||||||
|                             else "", |                                 else "" | ||||||
|  |                             ), | ||||||
|  |                             ( | ||||||
|                                 document.owner.username |                                 document.owner.username | ||||||
|                                 if document.owner is not None |                                 if document.owner is not None | ||||||
|                             else "", |                                 else "" | ||||||
|  |                             ), | ||||||
|                             timezone.localtime(document.added), |                             timezone.localtime(document.added), | ||||||
|                             document.original_filename, |                             document.original_filename, | ||||||
|                             timezone.localtime(document.created), |                             timezone.localtime(document.created), | ||||||
|   | |||||||
| @@ -175,16 +175,16 @@ class IndexView(TemplateView): | |||||||
|         context["full_name"] = self.request.user.get_full_name() |         context["full_name"] = self.request.user.get_full_name() | ||||||
|         context["styles_css"] = f"frontend/{self.get_frontend_language()}/styles.css" |         context["styles_css"] = f"frontend/{self.get_frontend_language()}/styles.css" | ||||||
|         context["runtime_js"] = f"frontend/{self.get_frontend_language()}/runtime.js" |         context["runtime_js"] = f"frontend/{self.get_frontend_language()}/runtime.js" | ||||||
|         context[ |         context["polyfills_js"] = ( | ||||||
|             "polyfills_js" |             f"frontend/{self.get_frontend_language()}/polyfills.js" | ||||||
|         ] = f"frontend/{self.get_frontend_language()}/polyfills.js" |         ) | ||||||
|         context["main_js"] = f"frontend/{self.get_frontend_language()}/main.js" |         context["main_js"] = f"frontend/{self.get_frontend_language()}/main.js" | ||||||
|         context[ |         context["webmanifest"] = ( | ||||||
|             "webmanifest" |             f"frontend/{self.get_frontend_language()}/manifest.webmanifest" | ||||||
|         ] = f"frontend/{self.get_frontend_language()}/manifest.webmanifest" |         ) | ||||||
|         context[ |         context["apple_touch_icon"] = ( | ||||||
|             "apple_touch_icon" |             f"frontend/{self.get_frontend_language()}/apple-touch-icon.png" | ||||||
|         ] = f"frontend/{self.get_frontend_language()}/apple-touch-icon.png" |         ) | ||||||
|         return context |         return context | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -722,9 +722,9 @@ class SearchResultSerializer(DocumentSerializer, PassUserMixin): | |||||||
|         r["__search_hit__"] = { |         r["__search_hit__"] = { | ||||||
|             "score": instance.score, |             "score": instance.score, | ||||||
|             "highlights": instance.highlights("content", text=doc.content), |             "highlights": instance.highlights("content", text=doc.content), | ||||||
|             "note_highlights": instance.highlights("notes", text=notes) |             "note_highlights": ( | ||||||
|             if doc |                 instance.highlights("notes", text=notes) if doc else None | ||||||
|             else None, |             ), | ||||||
|             "rank": instance.rank, |             "rank": instance.rank, | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1100,7 +1100,7 @@ def _get_nltk_language_setting(ocr_lang: str) -> Optional[str]: | |||||||
|         "tur": "turkish", |         "tur": "turkish", | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return iso_code_to_nltk.get(ocr_lang, None) |     return iso_code_to_nltk.get(ocr_lang) | ||||||
|  |  | ||||||
|  |  | ||||||
| NLTK_ENABLED: Final[bool] = __get_boolean("PAPERLESS_ENABLE_NLTK", "yes") | NLTK_ENABLED: Final[bool] = __get_boolean("PAPERLESS_ENABLE_NLTK", "yes") | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ It exposes the WSGI callable as a module-level variable named ``application``. | |||||||
| For more information on this file, see | For more information on this file, see | ||||||
| https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ | https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ | ||||||
| """ | """ | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  |  | ||||||
| from django.core.wsgi import get_wsgi_application | from django.core.wsgi import get_wsgi_application | ||||||
|   | |||||||
| @@ -9,11 +9,9 @@ from paperless_mail.models import ProcessedMail | |||||||
|  |  | ||||||
|  |  | ||||||
| class MailAccountAdminForm(forms.ModelForm): | class MailAccountAdminForm(forms.ModelForm): | ||||||
|  |  | ||||||
|     """Metadata classes used by Django admin to display the form.""" |     """Metadata classes used by Django admin to display the form.""" | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|  |  | ||||||
|         """Metadata class used by Django admin to display the form.""" |         """Metadata class used by Django admin to display the form.""" | ||||||
|  |  | ||||||
|         model = MailAccount |         model = MailAccount | ||||||
|   | |||||||
| @@ -739,9 +739,11 @@ class MailAccountHandler(LoggingMixin): | |||||||
|                     correspondent_id=correspondent.id if correspondent else None, |                     correspondent_id=correspondent.id if correspondent else None, | ||||||
|                     document_type_id=doc_type.id if doc_type else None, |                     document_type_id=doc_type.id if doc_type else None, | ||||||
|                     tag_ids=tag_ids, |                     tag_ids=tag_ids, | ||||||
|                     owner_id=rule.owner.id |                     owner_id=( | ||||||
|  |                         rule.owner.id | ||||||
|                         if (rule.assign_owner_from_rule and rule.owner) |                         if (rule.assign_owner_from_rule and rule.owner) | ||||||
|                     else None, |                         else None | ||||||
|  |                     ), | ||||||
|                 ) |                 ) | ||||||
|  |  | ||||||
|                 consume_task = consume_file.s( |                 consume_task = consume_file.s( | ||||||
|   | |||||||
| @@ -205,9 +205,9 @@ class RasterisedDocumentParser(DocumentParser): | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if "pdfa" in ocrmypdf_args["output_type"]: |         if "pdfa" in ocrmypdf_args["output_type"]: | ||||||
|             ocrmypdf_args[ |             ocrmypdf_args["color_conversion_strategy"] = ( | ||||||
|                 "color_conversion_strategy" |                 self.settings.color_conversion_strategy | ||||||
|             ] = self.settings.color_conversion_strategy |             ) | ||||||
|  |  | ||||||
|         if self.settings.mode == ModeChoices.FORCE or safe_fallback: |         if self.settings.mode == ModeChoices.FORCE or safe_fallback: | ||||||
|             ocrmypdf_args["force_ocr"] = True |             ocrmypdf_args["force_ocr"] = True | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Trenton H
					Trenton H