mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-18 16:13:19 +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
@@ -1,4 +1,4 @@
|
||||
"""Smoke tests for ``application.worker.remote_worker`` and ``sync_worker``.
|
||||
"""Smoke tests for ``docsgpt.worker.remote_worker`` and ``sync_worker``.
|
||||
|
||||
``remote_worker`` in ``sync`` mode does one PG write: it bumps
|
||||
``sources.date`` on the referenced source row to ``now()``. That's the
|
||||
@@ -19,14 +19,14 @@ from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from application.parser.schema.base import Document
|
||||
from application.storage.db.repositories.sources import SourcesRepository
|
||||
from docsgpt.parser.schema.base import Document
|
||||
from docsgpt.storage.db.repositories.sources import SourcesRepository
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def _mock_remote_pipeline(monkeypatch):
|
||||
"""Stub out the non-PG boundaries used by ``remote_worker``."""
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
fake_loader = MagicMock(name="remote_loader")
|
||||
fake_loader.load_data.return_value = [
|
||||
@@ -59,7 +59,7 @@ class TestRemoteWorkerSyncUpdatesDate:
|
||||
monkeypatch,
|
||||
_mock_remote_pipeline,
|
||||
):
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
# Seed a source with a known old ``date`` we can compare against.
|
||||
import datetime as dt
|
||||
@@ -111,7 +111,7 @@ class TestSyncWorker:
|
||||
each to ``sync``. We assert the seeded row is discovered and
|
||||
forwarded with the right doc_id — the nested ``sync`` call is
|
||||
stubbed so we don't re-run the whole remote pipeline here."""
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
src = SourcesRepository(pg_conn).create(
|
||||
"weekly-feed",
|
||||
@@ -157,7 +157,7 @@ class TestSyncWorker:
|
||||
):
|
||||
"""connector:* sources have no RemoteCreator loader — sync_worker
|
||||
must skip them, not dispatch them into sync()."""
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
SourcesRepository(pg_conn).create(
|
||||
"drive-folder",
|
||||
@@ -194,7 +194,7 @@ class TestSyncWorker:
|
||||
):
|
||||
"""Regression: remote_data reads back as a dict; sync_worker must
|
||||
hand the loader the URL string, not the raw dict."""
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
SourcesRepository(pg_conn).create(
|
||||
"docs-crawl",
|
||||
@@ -249,7 +249,7 @@ class TestSyncWorker:
|
||||
):
|
||||
"""A URL source whose remote_data dict has no URL key normalizes
|
||||
to None — sync_worker must skip it, not dispatch a doomed sync()."""
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
SourcesRepository(pg_conn).create(
|
||||
"broken-feed",
|
||||
@@ -292,7 +292,7 @@ class TestRemoteWorkerPathTraversal:
|
||||
monkeypatch,
|
||||
_mock_remote_pipeline,
|
||||
):
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
created_paths: list[str] = []
|
||||
deleted_paths: list[str] = []
|
||||
@@ -350,7 +350,7 @@ class TestRemoteWorkerDeterministicSourceId:
|
||||
monkeypatch,
|
||||
_mock_remote_pipeline,
|
||||
):
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
captured: list[dict] = []
|
||||
monkeypatch.setattr(
|
||||
@@ -382,7 +382,7 @@ class TestRemoteWorkerDeterministicSourceId:
|
||||
monkeypatch,
|
||||
_mock_remote_pipeline,
|
||||
):
|
||||
from application import worker
|
||||
from docsgpt import worker
|
||||
|
||||
captured: list[dict] = []
|
||||
monkeypatch.setattr(
|
||||
|
||||
Reference in new issue
Block a user