mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Chore: Backend dependencies update (#5676)
This commit is contained in:
parent
c508be6ecd
commit
b60e16fe33
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -16,7 +16,7 @@ on:
|
||||
env:
|
||||
# This is the version of pipenv all the steps will use
|
||||
# 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
|
||||
DEFAULT_PYTHON_VERSION: "3.10"
|
||||
|
||||
|
@ -47,11 +47,11 @@ repos:
|
||||
exclude: "(^Pipfile\\.lock$)"
|
||||
# Python hooks
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 'v0.1.11'
|
||||
rev: 'v0.2.1'
|
||||
hooks:
|
||||
- id: ruff
|
||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||
rev: 23.12.1
|
||||
rev: 24.1.1
|
||||
hooks:
|
||||
- id: black
|
||||
# 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/rules/
|
||||
[lint]
|
||||
extend-select = [
|
||||
"W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
|
||||
"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
|
||||
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"]
|
||||
"docker/wait-for-redis.py" = ["INP001", "T201"]
|
||||
"*/tests/*.py" = ["E501", "SIM117"]
|
||||
@ -41,5 +43,5 @@ show-fixes = true
|
||||
"src/paperless_tesseract/tests/test_parser.py" = ["RUF001"]
|
||||
"src/documents/models.py" = ["SIM115"]
|
||||
|
||||
[isort]
|
||||
[lint.isort]
|
||||
force-single-line = true
|
||||
|
@ -29,7 +29,7 @@ COPY Pipfile* ./
|
||||
|
||||
RUN set -eux \
|
||||
&& 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" \
|
||||
&& pipenv requirements > requirements.txt
|
||||
|
||||
|
6
Pipfile
6
Pipfile
@ -7,7 +7,7 @@ name = "pypi"
|
||||
dateparser = "~=1.2"
|
||||
# WARNING: django does not use semver.
|
||||
# Only patch versions are guaranteed to not introduce breaking changes.
|
||||
django = "~=4.2.9"
|
||||
django = "~=4.2.10"
|
||||
django-allauth = "*"
|
||||
django-auditlog = "*"
|
||||
django-celery-results = "*"
|
||||
@ -46,11 +46,11 @@ python-magic = "*"
|
||||
pyzbar = "*"
|
||||
rapidfuzz = "*"
|
||||
redis = {extras = ["hiredis"], version = "*"}
|
||||
scikit-learn = "~=1.3"
|
||||
scikit-learn = "~=1.4"
|
||||
setproctitle = "*"
|
||||
tika-client = "*"
|
||||
tqdm = "*"
|
||||
uvicorn = {extras = ["standard"], version = "*"}
|
||||
uvicorn = {extras = ["standard"], version = "==0.25.0"}
|
||||
watchdog = "~=3.0"
|
||||
whitenoise = "~=6.6"
|
||||
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):
|
||||
# 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 = (
|
||||
data["owner"]
|
||||
if "owner" in data
|
||||
else self.user
|
||||
if hasattr(self, "user")
|
||||
else None
|
||||
else self.user if hasattr(self, "user") 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(
|
||||
@ -261,7 +262,7 @@ class OwnedObjectSerializer(serializers.ModelSerializer, SetPermissionsMixin):
|
||||
if "set_permissions" in validated_data:
|
||||
self._set_permissions(validated_data["set_permissions"], instance)
|
||||
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 = (
|
||||
self.Meta.model.objects.exclude(pk=instance.pk)
|
||||
.filter(owner=validated_data["owner"], name=name)
|
||||
@ -443,7 +444,10 @@ class CustomFieldSerializer(serializers.ModelSerializer):
|
||||
|
||||
def validate(self, attrs):
|
||||
# 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(
|
||||
name=name,
|
||||
).exists():
|
||||
@ -697,10 +701,7 @@ class DocumentSerializer(
|
||||
custom_field_instance.field,
|
||||
doc_id,
|
||||
)
|
||||
if (
|
||||
"remove_inbox_tags" in validated_data
|
||||
and validated_data["remove_inbox_tags"]
|
||||
):
|
||||
if validated_data.get("remove_inbox_tags"):
|
||||
tag_ids_being_added = (
|
||||
[
|
||||
tag.id
|
||||
@ -1352,7 +1353,7 @@ class BulkEditObjectPermissionsSerializer(serializers.Serializer, SetPermissions
|
||||
def validate(self, attrs):
|
||||
object_type = attrs["object_type"]
|
||||
objects = attrs["objects"]
|
||||
permissions = attrs["permissions"] if "permissions" in attrs else None
|
||||
permissions = attrs.get("permissions")
|
||||
|
||||
self._validate_objects(objects, object_type)
|
||||
if permissions is not None:
|
||||
@ -1514,7 +1515,7 @@ class WorkflowSerializer(serializers.ModelSerializer):
|
||||
for trigger in triggers:
|
||||
filter_has_tags = trigger.pop("filter_has_tags", None)
|
||||
trigger_instance, _ = WorkflowTrigger.objects.update_or_create(
|
||||
id=trigger["id"] if "id" in trigger else None,
|
||||
id=trigger.get("id"),
|
||||
defaults=trigger,
|
||||
)
|
||||
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_custom_fields = action.pop("assign_custom_fields", None)
|
||||
action_instance, _ = WorkflowAction.objects.update_or_create(
|
||||
id=action["id"] if "id" in action else None,
|
||||
id=action.get("id"),
|
||||
defaults=action,
|
||||
)
|
||||
if assign_tags is not None:
|
||||
|
@ -559,15 +559,21 @@ def run_workflow(
|
||||
try:
|
||||
document.title = parse_doc_title_w_placeholders(
|
||||
action.assign_title,
|
||||
document.correspondent.name
|
||||
if document.correspondent is not None
|
||||
else "",
|
||||
document.document_type.name
|
||||
if document.document_type is not None
|
||||
else "",
|
||||
document.owner.username
|
||||
if document.owner is not None
|
||||
else "",
|
||||
(
|
||||
document.correspondent.name
|
||||
if document.correspondent is not None
|
||||
else ""
|
||||
),
|
||||
(
|
||||
document.document_type.name
|
||||
if document.document_type is not None
|
||||
else ""
|
||||
),
|
||||
(
|
||||
document.owner.username
|
||||
if document.owner is not None
|
||||
else ""
|
||||
),
|
||||
timezone.localtime(document.added),
|
||||
document.original_filename,
|
||||
timezone.localtime(document.created),
|
||||
|
@ -175,16 +175,16 @@ class IndexView(TemplateView):
|
||||
context["full_name"] = self.request.user.get_full_name()
|
||||
context["styles_css"] = f"frontend/{self.get_frontend_language()}/styles.css"
|
||||
context["runtime_js"] = f"frontend/{self.get_frontend_language()}/runtime.js"
|
||||
context[
|
||||
"polyfills_js"
|
||||
] = f"frontend/{self.get_frontend_language()}/polyfills.js"
|
||||
context["polyfills_js"] = (
|
||||
f"frontend/{self.get_frontend_language()}/polyfills.js"
|
||||
)
|
||||
context["main_js"] = f"frontend/{self.get_frontend_language()}/main.js"
|
||||
context[
|
||||
"webmanifest"
|
||||
] = f"frontend/{self.get_frontend_language()}/manifest.webmanifest"
|
||||
context[
|
||||
"apple_touch_icon"
|
||||
] = f"frontend/{self.get_frontend_language()}/apple-touch-icon.png"
|
||||
context["webmanifest"] = (
|
||||
f"frontend/{self.get_frontend_language()}/manifest.webmanifest"
|
||||
)
|
||||
context["apple_touch_icon"] = (
|
||||
f"frontend/{self.get_frontend_language()}/apple-touch-icon.png"
|
||||
)
|
||||
return context
|
||||
|
||||
|
||||
@ -722,9 +722,9 @@ class SearchResultSerializer(DocumentSerializer, PassUserMixin):
|
||||
r["__search_hit__"] = {
|
||||
"score": instance.score,
|
||||
"highlights": instance.highlights("content", text=doc.content),
|
||||
"note_highlights": instance.highlights("notes", text=notes)
|
||||
if doc
|
||||
else None,
|
||||
"note_highlights": (
|
||||
instance.highlights("notes", text=notes) if doc else None
|
||||
),
|
||||
"rank": instance.rank,
|
||||
}
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ def _get_nltk_language_setting(ocr_lang: str) -> Optional[str]:
|
||||
"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")
|
||||
|
@ -6,6 +6,7 @@ It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
@ -9,11 +9,9 @@ from paperless_mail.models import ProcessedMail
|
||||
|
||||
|
||||
class MailAccountAdminForm(forms.ModelForm):
|
||||
|
||||
"""Metadata classes used by Django admin to display the form."""
|
||||
|
||||
class Meta:
|
||||
|
||||
"""Metadata class used by Django admin to display the form."""
|
||||
|
||||
model = MailAccount
|
||||
|
@ -739,9 +739,11 @@ class MailAccountHandler(LoggingMixin):
|
||||
correspondent_id=correspondent.id if correspondent else None,
|
||||
document_type_id=doc_type.id if doc_type else None,
|
||||
tag_ids=tag_ids,
|
||||
owner_id=rule.owner.id
|
||||
if (rule.assign_owner_from_rule and rule.owner)
|
||||
else None,
|
||||
owner_id=(
|
||||
rule.owner.id
|
||||
if (rule.assign_owner_from_rule and rule.owner)
|
||||
else None
|
||||
),
|
||||
)
|
||||
|
||||
consume_task = consume_file.s(
|
||||
|
@ -205,9 +205,9 @@ class RasterisedDocumentParser(DocumentParser):
|
||||
}
|
||||
|
||||
if "pdfa" in ocrmypdf_args["output_type"]:
|
||||
ocrmypdf_args[
|
||||
"color_conversion_strategy"
|
||||
] = self.settings.color_conversion_strategy
|
||||
ocrmypdf_args["color_conversion_strategy"] = (
|
||||
self.settings.color_conversion_strategy
|
||||
)
|
||||
|
||||
if self.settings.mode == ModeChoices.FORCE or safe_fallback:
|
||||
ocrmypdf_args["force_ocr"] = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user