mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 18:18:08 +00:00
refactor: rename the application package to docsgpt
The backend import package is now docsgpt, the name it will carry on PyPI; application was far too generic to install into anyone's site-packages. git mv plus a mechanical rewrite of every import, dotted string and path reference: 734 Python files, the compose files, Dockerfile, workflows, docs, setup scripts, devcontainer, k8s manifests, vscode config, pytest and coverage config, .gitignore. Behaviour is unchanged. Kept for one release: - A top-level application package whose meta-path finder resolves application.x.y to the already-imported docsgpt.x.y object, so old imports and entry points (celery -A application.app.celery, uvicorn application.asgi:asgi_app) keep working with a FutureWarning. - Celery registers every application.* task name as an alias of its docsgpt.* task on start-up, so messages queued by the previous release still run. The redbeat key prefix moves to redbeat:docsgpt:v2: so schedule entries the previous release wrote are left unread instead of firing twice. The backend image builds from the repository root (docker build -f docsgpt/Dockerfile .) so it can ship the alias package; a root .dockerignore allow-lists docsgpt/ and application/ and keeps caches, local data, .env files, the sample index files and the Dockerfile out. Compose and the image workflows point at the new context.
This commit is contained in:
1 parent
3e7f1f91b4
commit
574f96341e
984 files changed
+9847
-9682
No files matched your search
@@ -13,7 +13,7 @@ the fast path must only appear when a caller explicitly asks for it.
|
||||
|
||||
import pytest
|
||||
|
||||
from application.parser.file.base_parser import BaseParser, DocumentParseError
|
||||
from docsgpt.parser.file.base_parser import BaseParser, DocumentParseError
|
||||
|
||||
pypdfium2 = pytest.importorskip("pypdfium2")
|
||||
|
||||
@@ -66,7 +66,7 @@ class _RecordingFallback(BaseParser):
|
||||
|
||||
@pytest.fixture
|
||||
def parser_cls():
|
||||
from application.parser.file.pdfium_parser import PdfiumTextParser
|
||||
from docsgpt.parser.file.pdfium_parser import PdfiumTextParser
|
||||
|
||||
return PdfiumTextParser
|
||||
|
||||
@@ -162,7 +162,7 @@ def docling_engine(monkeypatch):
|
||||
# (docling is an optional extra) the engine degrades to the legacy
|
||||
# parsers and these tests do not apply.
|
||||
pytest.importorskip("docling")
|
||||
from application.core.settings import settings
|
||||
from docsgpt.core.settings import settings
|
||||
|
||||
monkeypatch.setattr(settings, "DOC_PARSER_ENGINE", "docling")
|
||||
# A developer .env with OCR on (and OCR_BACKEND=native) would otherwise
|
||||
@@ -172,7 +172,7 @@ def docling_engine(monkeypatch):
|
||||
|
||||
def test_extractor_defaults_to_docling_for_pdf(docling_engine):
|
||||
"""Sources must be unaffected: no fast path unless explicitly requested."""
|
||||
from application.parser.file.bulk import get_default_file_extractor
|
||||
from docsgpt.parser.file.bulk import get_default_file_extractor
|
||||
|
||||
pdf_parser = get_default_file_extractor()[".pdf"]
|
||||
|
||||
@@ -180,8 +180,8 @@ def test_extractor_defaults_to_docling_for_pdf(docling_engine):
|
||||
|
||||
|
||||
def test_extractor_uses_fast_path_when_requested(docling_engine):
|
||||
from application.parser.file.bulk import get_default_file_extractor
|
||||
from application.parser.file.pdfium_parser import PdfiumTextParser
|
||||
from docsgpt.parser.file.bulk import get_default_file_extractor
|
||||
from docsgpt.parser.file.pdfium_parser import PdfiumTextParser
|
||||
|
||||
pdf_parser = get_default_file_extractor(pdf_text_fast_path=True)[".pdf"]
|
||||
|
||||
@@ -192,8 +192,8 @@ def test_extractor_uses_fast_path_when_requested(docling_engine):
|
||||
def test_anydoc_engine_ignores_fast_path(monkeypatch):
|
||||
"""anydoc already reads the text layer in milliseconds and keeps structure."""
|
||||
pytest.importorskip("anydoc")
|
||||
from application.core.settings import settings
|
||||
from application.parser.file.bulk import get_default_file_extractor
|
||||
from docsgpt.core.settings import settings
|
||||
from docsgpt.parser.file.bulk import get_default_file_extractor
|
||||
|
||||
monkeypatch.setattr(settings, "DOC_PARSER_ENGINE", "anydoc")
|
||||
|
||||
@@ -203,7 +203,7 @@ def test_anydoc_engine_ignores_fast_path(monkeypatch):
|
||||
|
||||
|
||||
def test_fast_path_does_not_change_non_pdf_parsers(docling_engine):
|
||||
from application.parser.file.bulk import get_default_file_extractor
|
||||
from docsgpt.parser.file.bulk import get_default_file_extractor
|
||||
|
||||
plain = get_default_file_extractor()
|
||||
fast = get_default_file_extractor(pdf_text_fast_path=True)
|
||||
|
||||
Reference in new issue
Block a user