Compare commits

..

17 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
c736799a2a Initial plan 2026-02-03 19:59:12 +00:00
Trenton H
c57a14299d Merge branch 'dev' into feature-date-parse-plugin 2026-02-03 10:30:35 -08:00
Trenton H
460da8a4d5 Merge branch 'dev' into feature-date-parse-plugin 2026-02-02 20:27:10 -08:00
Trenton H
bb6ad8aef6 Restores using OcrConfig for the moment 2026-02-02 13:32:12 -08:00
Trenton H
ddf1d0c3ae Defines the public interface better 2026-02-02 13:26:24 -08:00
Trenton H
3c7cb73d32 Draft up documentation on how to create a plugin 2026-02-02 13:26:24 -08:00
Trenton H
f17090c9c6 One more tuple here 2026-02-02 13:26:24 -08:00
Trenton H
481e518445 Resolves Sonarr issues 2026-02-02 13:26:24 -08:00
Trenton H
c4a730baaa To enable cleanup, use as a context manager 2026-02-02 13:26:24 -08:00
Trenton H
1cc38a45ad Restores environment 2026-02-02 13:26:24 -08:00
Trenton H
a2c3bf4c29 Adds example type checking configuration, with a default broard ignore and a tight scoped check 2026-02-02 13:26:24 -08:00
Trenton H
332d0b0a41 Two more missed 2026-02-02 13:26:24 -08:00
Trenton H
666113ad96 Got to update the tests too 2026-02-02 13:26:24 -08:00
Trenton H
e7ac73135b Change the contract, just take the actual filename, not the file path 2026-02-02 13:26:24 -08:00
Trenton H
c55ad50b52 Forgot the marker again 2026-02-02 13:26:24 -08:00
Trenton H
27c793c55e Hooks up the class and fixes up the old testing. Includes ocr to date parser conversion we now do 2026-02-02 13:26:22 -08:00
Trenton H
9c334c4deb Copy over the code and tests, to see if this even works 2026-02-02 13:25:59 -08:00
7 changed files with 50 additions and 2584 deletions

View File

@@ -28,4 +28,3 @@
./resources
# Other stuff
**/*.drawio.png
.mypy_baseline

View File

@@ -99,47 +99,3 @@ jobs:
run: |
docker compose --file docker/compose/docker-compose.ci-test.yml logs
docker compose --file docker/compose/docker-compose.ci-test.yml down
typing:
name: Check project typing
runs-on: ubuntu-24.04
env:
DEFAULT_PYTHON: "3.12"
steps:
- name: Checkout
uses: actions/checkout@v6.0.1
- name: Set up Python
id: setup-python
uses: actions/setup-python@v6.2.0
with:
python-version: "${{ env.DEFAULT_PYTHON }}"
- name: Install uv
uses: astral-sh/setup-uv@v7.2.1
with:
version: ${{ env.DEFAULT_UV_VERSION }}
enable-cache: true
python-version: ${{ steps.setup-python.outputs.python-version }}
- name: Install Python dependencies
run: |
uv sync \
--python ${{ steps.setup-python.outputs.python-version }} \
--group testing \
--group typing \
--frozen
- name: List installed Python dependencies
run: |
uv pip list
- name: Cache Mypy
uses: actions/cache@v5.0.3
with:
path: .mypy_cache
# Keyed by OS, Python version, and dependency hashes
key: ${{ runner.os }}-mypy-py${{ env.DEFAULT_PYTHON }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}
restore-keys: |
${{ runner.os }}-mypy-py${{ env.DEFAULT_PYTHON }}-
${{ runner.os }}-mypy-
- name: Check typing
run: |
uv run mypy \
--show-error-codes \
--warn-unused-configs \
src/ | uv run mypy-baseline filter

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@ dependencies = [
# WARNING: django does not use semver.
# Only patch versions are guaranteed to not introduce breaking changes.
"django~=5.2.10",
"django-allauth[mfa,socialaccount]~=65.14.0",
"django-allauth[mfa,socialaccount]~=65.13.1",
"django-auditlog~=3.4.1",
"django-cachalot~=2.8.0",
"django-celery-results~=2.6.0",
@@ -138,9 +138,7 @@ typing = [
"django-stubs[compatible-mypy]",
"djangorestframework-stubs[compatible-mypy]",
"lxml-stubs",
"microsoft-python-type-stubs @ git+https://github.com/microsoft/python-type-stubs.git",
"mypy",
"mypy-baseline",
"types-bleach",
"types-colorama",
"types-dateparser",
@@ -335,6 +333,10 @@ exclude_also = [
[tool.mypy]
mypy_path = "src"
files = [
"src/documents/plugins/date_parsing",
"src/documents/tests/date_parsing",
]
plugins = [
"mypy_django_plugin.main",
"mypy_drf_plugin.main",
@@ -346,9 +348,28 @@ disallow_untyped_defs = true
warn_redundant_casts = true
warn_unused_ignores = true
# This prevents errors from imports, but allows type-checking logic to work
follow_imports = "silent"
[[tool.mypy.overrides]]
module = [
"documents.*",
"paperless.*",
"paperless_ai.*",
"paperless_mail.*",
"paperless_tesseract.*",
"paperless_remote.*",
"paperless_text.*",
"paperless_tika.*",
]
ignore_errors = true
[[tool.mypy.overrides]]
module = [
"documents.plugins.date_parsing.*",
"documents.tests.date_parsing.*",
]
ignore_errors = false
[tool.django-stubs]
django_settings_module = "paperless.settings"
[tool.mypy-baseline]
baseline_path = ".mypy-baseline.txt"
sort_baseline = true

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: paperless-ngx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-02-03 20:10+0000\n"
"POT-Creation-Date: 2026-02-03 17:32+0000\n"
"PO-Revision-Date: 2022-02-17 04:17\n"
"Last-Translator: \n"
"Language-Team: English\n"
@@ -1323,7 +1323,7 @@ msgstr ""
msgid "Duplicate document identifiers are not allowed."
msgstr ""
#: documents/serialisers.py:2330 documents/views.py:2839
#: documents/serialisers.py:2330 documents/views.py:2838
#, python-format
msgid "Documents not found: %(ids)s"
msgstr ""
@@ -1587,20 +1587,20 @@ msgstr ""
msgid "Unable to parse URI {value}"
msgstr ""
#: documents/views.py:2851
#: documents/views.py:2850
#, python-format
msgid "Insufficient permissions to share document %(id)s."
msgstr ""
#: documents/views.py:2894
#: documents/views.py:2893
msgid "Bundle is already being processed."
msgstr ""
#: documents/views.py:2951
#: documents/views.py:2950
msgid "The share link bundle is still being prepared. Please try again later."
msgstr ""
#: documents/views.py:2961
#: documents/views.py:2960
msgid "The share link bundle is unavailable."
msgstr ""

View File

@@ -1,5 +1,6 @@
import dataclasses
import email.contentmanager
import random
import time
import uuid
from collections import namedtuple
@@ -147,7 +148,11 @@ class BogusMailBox(AbstractContextManager):
if "TO" in criteria:
to_ = criteria[criteria.index("TO") + 1].strip('"')
msg = filter(lambda m: any(to_ in to_addr for to_addr in m.to), msg)
msg = []
for m in self.messages:
for to_addrs in m.to:
if to_ in to_addrs:
msg.append(m)
if "UNFLAGGED" in criteria:
msg = filter(lambda m: not m.flagged, msg)
@@ -199,7 +204,7 @@ def fake_magic_from_buffer(buffer, *, mime=False):
class MessageBuilder:
def __init__(self) -> None:
self._next_uid = 1
self._used_uids = set()
def create_message(
self,
@@ -252,8 +257,10 @@ class MessageBuilder:
# TODO: Unsure how to add a uid to the actual EmailMessage. This hacks it in,
# based on how imap_tools uses regex to extract it.
# This should be a large enough pool
uid = self._next_uid
self._next_uid += 1
uid = random.randint(1, 10000)
while uid in self._used_uids:
uid = random.randint(1, 10000)
self._used_uids.add(uid)
imap_msg._raw_uid_data = f"UID {uid}".encode()

28
uv.lock generated
View File

@@ -1010,15 +1010,15 @@ wheels = [
[[package]]
name = "django-allauth"
version = "65.14.0"
version = "65.13.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "asgiref", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "django", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/23/9b/061a6ac65c602eb721b13fbf9c665b20fb900f113a03ec8521b5fcf16b83/django_allauth-65.14.0.tar.gz", hash = "sha256:5529227aba2b1377d900e9274a3f24496c645e65400fbae3cad5789944bc4d0b", size = 1991909, upload-time = "2026-01-17T18:43:12.928Z" }
sdist = { url = "https://files.pythonhosted.org/packages/e0/b7/42a048ba1dedbb6b553f5376a6126b1c753c10c70d1edab8f94c560c8066/django_allauth-65.13.1.tar.gz", hash = "sha256:2af0d07812f8c1a8e3732feaabe6a9db5ecf3fad6b45b6a0f7fd825f656c5a15", size = 1983857, upload-time = "2025-11-20T16:34:40.811Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ce/c8/2f959ff8466913d95ba72eb4a29bd7998d28a559786033a97b5bbdda2b81/django_allauth-65.14.0-py3-none-any.whl", hash = "sha256:448f5f7877f95fcbe1657256510fe7822d7871f202521a29e23ef937f3325a97", size = 1793052, upload-time = "2026-01-17T18:43:08.954Z" },
{ url = "https://files.pythonhosted.org/packages/d8/98/9d44ae1468abfdb521d651fb67f914165c7812dfdd97be16190c9b1cc246/django_allauth-65.13.1-py3-none-any.whl", hash = "sha256:2887294beedfd108b4b52ebd182e0ed373deaeb927fc5a22f77bbde3174704a6", size = 1787349, upload-time = "2025-11-20T16:34:37.354Z" },
]
[package.optional-dependencies]
@@ -1305,7 +1305,7 @@ name = "exceptiongroup"
version = "1.3.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "typing-extensions", marker = "(python_full_version < '3.11' and sys_platform == 'darwin') or (python_full_version < '3.11' and sys_platform == 'linux')" },
{ name = "typing-extensions", marker = "(python_full_version < '3.13' and platform_machine != 'aarch64' and platform_machine != 'x86_64' and sys_platform == 'linux') or (python_full_version < '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux') or (python_full_version < '3.12' and platform_machine == 'x86_64' and sys_platform == 'linux') or (python_full_version < '3.13' and sys_platform == 'darwin')" },
]
sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" }
wheels = [
@@ -2584,11 +2584,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/2c/19/04f9b178c2d8a15b076c8b5140708fa6ffc5601fb6f1e975537072df5b2a/mergedeep-1.3.4-py3-none-any.whl", hash = "sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307", size = 6354, upload-time = "2021-02-05T18:55:29.583Z" },
]
[[package]]
name = "microsoft-python-type-stubs"
version = "0"
source = { git = "https://github.com/microsoft/python-type-stubs.git#692c37c3969d22612b295ddf7e7af5907204a386" }
[[package]]
name = "mkdocs"
version = "1.6.1"
@@ -2880,15 +2875,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8d/f4/4ce9a05ce5ded1de3ec1c1d96cf9f9504a04e54ce0ed55cfa38619a32b8d/mypy-1.19.1-py3-none-any.whl", hash = "sha256:f1235f5ea01b7db5468d53ece6aaddf1ad0b88d9e7462b86ef96fe04995d7247", size = 2471239, upload-time = "2025-12-15T05:03:07.248Z" },
]
[[package]]
name = "mypy-baseline"
version = "0.7.3"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/65/2a/03288dab6d5f24d187ba0c223f6b3035d9a29de3dd31a3e105a0d4f1b5da/mypy_baseline-0.7.3.tar.gz", hash = "sha256:325f0695310eb8f5c0f10fa7af36ee1b3785a9d26b886a61c07b4a8eddb28d29", size = 319108, upload-time = "2025-05-30T08:43:00.629Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/1f/93/7780302b206a8e8e767ce763ef06159725d1323acbe55e46a1cd1ffd109d/mypy_baseline-0.7.3-py3-none-any.whl", hash = "sha256:bd7fa899e687d75af2e3f392a9d6d1790e65dae3d31fe12525cc14f26d866b74", size = 17868, upload-time = "2025-05-30T08:42:58.262Z" },
]
[[package]]
name = "mypy-extensions"
version = "1.1.0"
@@ -3307,9 +3293,7 @@ typing = [
{ name = "django-stubs", extra = ["compatible-mypy"], marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "djangorestframework-stubs", extra = ["compatible-mypy"], marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "lxml-stubs", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "microsoft-python-type-stubs", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "mypy", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "mypy-baseline", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "types-bleach", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "types-colorama", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
{ name = "types-dateparser", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },
@@ -3333,7 +3317,7 @@ requires-dist = [
{ name = "concurrent-log-handler", specifier = "~=0.9.25" },
{ name = "dateparser", specifier = "~=1.2" },
{ name = "django", specifier = "~=5.2.10" },
{ name = "django-allauth", extras = ["mfa", "socialaccount"], specifier = "~=65.14.0" },
{ name = "django-allauth", extras = ["mfa", "socialaccount"], specifier = "~=65.13.1" },
{ name = "django-auditlog", specifier = "~=3.4.1" },
{ name = "django-cachalot", specifier = "~=2.8.0" },
{ name = "django-celery-results", specifier = "~=2.6.0" },
@@ -3449,9 +3433,7 @@ typing = [
{ name = "django-stubs", extras = ["compatible-mypy"] },
{ name = "djangorestframework-stubs", extras = ["compatible-mypy"] },
{ name = "lxml-stubs" },
{ name = "microsoft-python-type-stubs", git = "https://github.com/microsoft/python-type-stubs.git" },
{ name = "mypy" },
{ name = "mypy-baseline" },
{ name = "types-bleach" },
{ name = "types-colorama" },
{ name = "types-dateparser" },