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:
WolfandClaude Opus 5.5 committed 2026-09-23 12:30:10 +02:00
1 parent 248ea1636d
commit 7a63311714
32 files changed
+102 -98

No files matched your search

+11 -11
View File
@@ -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"])