mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-20 02:16:39 +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,7 +1,7 @@
|
||||
"""Tests for setup_logging — in particular the OTEL log-handler hand-off.
|
||||
|
||||
`opentelemetry-instrument` attaches an OTEL `LoggingHandler` to the root
|
||||
logger before our module-level `setup_logging()` runs in `application/app.py`.
|
||||
logger before our module-level `setup_logging()` runs in `docsgpt/app.py`.
|
||||
The default `dictConfig` call replaces `root.handlers`, which would silently
|
||||
drop the OTEL handler. setup_logging snapshots and re-attaches OTEL handlers
|
||||
when OTLP log export is enabled.
|
||||
@@ -17,7 +17,7 @@ from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from application.core.logging_config import setup_logging
|
||||
from docsgpt.core.logging_config import setup_logging
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@@ -125,7 +125,7 @@ class TestAlembicDoesNotSilenceApplicationLoggers:
|
||||
import ast
|
||||
import pathlib
|
||||
|
||||
source = pathlib.Path("application/alembic/env.py").read_text()
|
||||
source = pathlib.Path("docsgpt/alembic/env.py").read_text()
|
||||
calls = [
|
||||
node
|
||||
for node in ast.walk(ast.parse(source))
|
||||
@@ -152,12 +152,12 @@ class TestAlembicDoesNotSilenceApplicationLoggers:
|
||||
probe.write_text(
|
||||
"import logging\n"
|
||||
"from logging.config import fileConfig\n"
|
||||
"log = logging.getLogger('application.api.answer.routes.stream')\n"
|
||||
"fileConfig('application/alembic.ini', disable_existing_loggers=True)\n"
|
||||
"kept = logging.getLogger('application.api.answer.routes.stream')\n"
|
||||
"log = logging.getLogger('docsgpt.api.answer.routes.stream')\n"
|
||||
"fileConfig('docsgpt/alembic.ini', disable_existing_loggers=True)\n"
|
||||
"kept = logging.getLogger('docsgpt.api.answer.routes.stream')\n"
|
||||
"print('default_disables', kept.disabled)\n"
|
||||
"kept.disabled = False\n"
|
||||
"fileConfig('application/alembic.ini', disable_existing_loggers=False)\n"
|
||||
"fileConfig('docsgpt/alembic.ini', disable_existing_loggers=False)\n"
|
||||
"print('flag_preserves', not kept.disabled)\n"
|
||||
)
|
||||
out = subprocess.run(
|
||||
@@ -184,7 +184,7 @@ class TestMigrationsDoNotClobberAppLogging:
|
||||
def test_bootstrap_tells_env_py_to_leave_logging_alone(self, monkeypatch):
|
||||
from logging.config import fileConfig
|
||||
|
||||
from application.storage.db import bootstrap
|
||||
from docsgpt.storage.db import bootstrap
|
||||
|
||||
# Skip the best-effort revision precheck; it needs a live DB. It is
|
||||
# wrapped in try/except, so raising here lands on the "upgrade anyway"
|
||||
@@ -217,13 +217,13 @@ class TestMigrationsDoNotClobberAppLogging:
|
||||
assert seen["configure_logger"] is False
|
||||
assert root.level == before_level
|
||||
assert marker in root.handlers
|
||||
assert logging.getLogger("application.probe").isEnabledFor(logging.INFO)
|
||||
assert logging.getLogger("docsgpt.probe").isEnabledFor(logging.INFO)
|
||||
|
||||
def test_env_py_honours_the_opt_out(self):
|
||||
"""The other half of the contract lives in env.py's module-level guard."""
|
||||
env_py = (
|
||||
pathlib.Path(__file__).resolve().parents[2]
|
||||
/ "application"
|
||||
/ "docsgpt"
|
||||
/ "alembic"
|
||||
/ "env.py"
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user