Rename the package roledesk to app
The boilerplate's rule: the deploy kit's Dockerfile, the APP_CONFIG, APP_PASSWORD and APP_DATA variables and its commands all assume a package called app, so a project renames its display title and nothing else. The console script is `app`, and the launch entry runs `uv run app serve --port 8790`. The domain noun stays `role`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
248ea1636d
commit
7a63311714
32 files changed
+102
-98
No files matched your search
+11
-11
@@ -1,15 +1,15 @@
|
||||
"""The package boundaries, held as a test rather than as a convention.
|
||||
|
||||
Adapted from news/tests/test_architecture.py. One tree of our own, `roledesk`,
|
||||
Adapted from news/tests/test_architecture.py. One tree of our own, `app`,
|
||||
and two external ones, `desk` and `pipeline`, imported from ../news.
|
||||
|
||||
1. **Direction.** Within `roledesk`, a package imports only from packages below
|
||||
1. **Direction.** Within `app`, a package imports only from packages below
|
||||
it in `LAYERS`. `desk` and `pipeline` may be imported by any of them.
|
||||
2. **Doors.** From outside a package, only `<tree>.<package>` is imported, and
|
||||
only names it lists in `__all__`. `desk.tools` has no door of its own, so
|
||||
there the door is the tool: `desk.tools.<tool>`, one level, no deeper.
|
||||
3. **Plugins.** A file under `plugins/` imports `desk` and nothing else from
|
||||
these trees. A plugin is app-agnostic; it never sees `roledesk`.
|
||||
these trees. A plugin is app-agnostic; it never sees `app`.
|
||||
|
||||
Tests are held to none of this.
|
||||
"""
|
||||
@@ -27,7 +27,7 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
#: Bottom to top. `cli` is the entry point and may reach anything.
|
||||
LAYERS = ["models", "config", "storage", "jobs", "web", "cli"]
|
||||
APP = "roledesk"
|
||||
APP = "app"
|
||||
EXTERNAL = {"desk", "pipeline"}
|
||||
TREES = {APP} | EXTERNAL
|
||||
|
||||
@@ -73,7 +73,7 @@ def _door_violation(module: str, names: list[str]) -> str | None:
|
||||
|
||||
|
||||
def _package(path: Path) -> str:
|
||||
"""`roledesk/storage/store.py` -> "storage"; `roledesk/cli.py` -> "cli";
|
||||
"""`app/storage/store.py` -> "storage"; `app/cli.py` -> "cli";
|
||||
the tree's own `__init__.py` -> "" (a door, exempt from direction)."""
|
||||
rel = path.relative_to(ROOT).parts
|
||||
name = rel[1].removesuffix(".py") if len(rel) > 1 else ""
|
||||
@@ -100,7 +100,7 @@ def direction_violations(here: str, source: str) -> list[str]:
|
||||
if parts[0] != APP or not here or len(parts) < 2 or parts[1] not in LAYERS:
|
||||
continue
|
||||
if LAYERS.index(parts[1]) >= LAYERS.index(here):
|
||||
wrong.append(f"line {line}: {module} is not below roledesk.{here}")
|
||||
wrong.append(f"line {line}: {module} is not below app.{here}")
|
||||
return wrong
|
||||
|
||||
|
||||
@@ -137,17 +137,17 @@ def test_a_plugin_knows_only_desk(path: Path) -> None:
|
||||
|
||||
def test_the_rules_catch_what_they_are_for() -> None:
|
||||
"""The checker itself, on sources that break each rule."""
|
||||
assert plugin_violations("from roledesk.storage import Store")
|
||||
assert plugin_violations("from app.storage import Store")
|
||||
assert plugin_violations("from pipeline import job")
|
||||
assert plugin_violations("from desk.sources.base import Source")
|
||||
assert not plugin_violations("from desk.sources import Source, Item")
|
||||
|
||||
assert direction_violations("storage", "from roledesk.web import create_app")
|
||||
assert direction_violations("storage", "from roledesk import jobs")
|
||||
assert not direction_violations("jobs", "from roledesk.storage import Store")
|
||||
assert direction_violations("storage", "from app.web import create_app")
|
||||
assert direction_violations("storage", "from app import jobs")
|
||||
assert not direction_violations("jobs", "from app.storage import Store")
|
||||
assert not direction_violations("models", "from pipeline import job")
|
||||
|
||||
assert _door_violation("roledesk.storage.store", ["Store"])
|
||||
assert _door_violation("app.storage.store", ["Store"])
|
||||
assert _door_violation("desk.tools.video.marks", [])
|
||||
assert _door_violation("pipeline", ["not_exported_name"])
|
||||
assert not _door_violation("pipeline.web", ["connect"])
|
||||
@@ -12,9 +12,9 @@ import pytest
|
||||
from desk import modeltask
|
||||
from desk.models import Item
|
||||
from desk.tools import agent
|
||||
from roledesk.config import Config
|
||||
from roledesk.jobs import extract
|
||||
from roledesk.storage import Store
|
||||
from app.config import Config
|
||||
from app.jobs import extract
|
||||
from app.storage import Store
|
||||
|
||||
|
||||
def posting(source_id: str, title: str = "Backend Engineer", **raw: object) -> Item:
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ if str(ROOT) not in sys.path:
|
||||
|
||||
from desk.models import Item # noqa: E402
|
||||
from plugins.ats import ATSSource # noqa: E402
|
||||
from roledesk.jobs import pull # noqa: E402
|
||||
from roledesk.storage import Store # noqa: E402
|
||||
from app.jobs import pull # noqa: E402
|
||||
from app.storage import Store # noqa: E402
|
||||
|
||||
|
||||
class FakeConfig:
|
||||
|
||||
+5
-5
@@ -19,10 +19,10 @@ if str(ROOT) not in sys.path:
|
||||
from desk.models import Item # noqa: E402
|
||||
from pipeline import FINAL, TASKS, JobQueue, Jobs, RunContext # noqa: E402
|
||||
from plugins.ats import ATSSource # noqa: E402
|
||||
from roledesk.config import AgentSeed, Config # noqa: E402
|
||||
from roledesk.jobs import cascade, embed, score # noqa: E402
|
||||
from roledesk.models import Candidate, Gate, Weights # noqa: E402
|
||||
from roledesk.storage import Store # noqa: E402
|
||||
from app.config import AgentSeed, Config # noqa: E402
|
||||
from app.jobs import cascade, embed, score # noqa: E402
|
||||
from app.models import Candidate, Gate, Weights # noqa: E402
|
||||
from app.storage import Store # noqa: E402
|
||||
|
||||
NOW = datetime(2026, 9, 23, 9, 0, tzinfo=UTC)
|
||||
|
||||
@@ -264,7 +264,7 @@ def test_starter_agents_are_imported_once(store: Store, tmp_path: Path) -> None:
|
||||
|
||||
|
||||
def test_the_shipped_starter_agents_validate() -> None:
|
||||
from roledesk import config as config_mod
|
||||
from app import config as config_mod
|
||||
|
||||
names = [a.name for a in config_mod.load(ROOT / "roles.yaml").agents]
|
||||
assert names == ["Berlin backend", "Remote EU stretch"]
|
||||
|
||||
@@ -11,8 +11,8 @@ import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from desk.models import Item
|
||||
from roledesk.models import Application, company_key, place_key, title_key
|
||||
from roledesk.storage import LATEST, Store
|
||||
from app.models import Application, company_key, place_key, title_key
|
||||
from app.storage import LATEST, Store
|
||||
|
||||
|
||||
class Clock:
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from desk.models import Item
|
||||
from roledesk.storage import Store
|
||||
from roledesk.web.app import create_app
|
||||
from app.storage import Store
|
||||
from app.web.app import create_app
|
||||
|
||||
|
||||
class Clock:
|
||||
|
||||
Reference in new issue
Block a user