Architectural import rules¶
dpone keeps layer boundaries explicit and checks them automatically in tests/CI.
Why this exists¶
The project has several layers with different responsibilities:
dpone.commands/*— CLI orchestrationdpone.cli_render/*— presentation / text renderingdpone.services/*— application services / use-casesdpone.manifest/*— manifest compilation / validation / explaindpone.dag/*— DAG graph / dependency semantics / explaindpone.runtime/*— execution runtime (sources, sinks, ETL, state)dpone.ports/*— abstract boundariesdpone.adapters/*— infrastructure adapters
Without automated checks, architectural drift is easy: commands start calling runtime directly, renderers pull business logic into presentation, or manifest/DAG analysis accidentally becomes dependent on optional runtime SDKs.
Canonical checks¶
Deprecated shims are forbidden in canonical code¶
Outside shim packages themselves, code must not import deprecated paths such as:
dpone.sourcedpone.sinkdpone.etldpone.etl_loggingdpone.credentialsdpone.statedpone.reconciliationdpone.sql_helpersdpone.xmindpone.lib.connectorsdpone.yaml_config_handler
Use canonical paths instead:
dpone.runtime.*dpone.dag.*
Layer matrix¶
| Source layer | Must not import |
|---|---|
dpone.commands.* |
dpone.runtime.*, deprecated shim packages, dpone.cli.legacy |
dpone.services.* |
dpone.commands.*, dpone.cli.*, dpone.cli_render.*, dpone.runtime.*, deprecated shims |
dpone.cli_render.* |
dpone.commands.*, dpone.runtime.*, dpone.cli.legacy, dpone.cli.main, dpone.cli.parser |
dpone.manifest.* |
dpone.runtime.*, deprecated shims, dpone.commands.*, dpone.cli_render.*, dpone.cli.legacy |
dpone.dag.* |
dpone.runtime.*, deprecated shims, dpone.commands.*, dpone.cli_render.*, dpone.cli.legacy |
dpone.runtime.* |
dpone.commands.*, dpone.cli.*, dpone.cli_render.*, dpone.services.*, dpone.app.* |
dpone.ports.* |
dpone.runtime.*, dpone.commands.*, dpone.cli.*, dpone.cli_render.*, dpone.services.*, dpone.adapters.* |
dpone.adapters.* |
dpone.runtime.*, dpone.commands.*, dpone.cli.*, dpone.cli_render.*, dpone.services.*, dpone.manifest.*, dpone.dag.*, dpone.app.* |
These rules are intentionally pragmatic: - they protect the most valuable boundaries now; - they still allow some transitional dependencies while refactoring continues.
How to run the checks¶
Pytest¶
CLI (CI-friendly)¶
JSON output:
Exit codes:
- 0 — no violations
- 2 — one or more violations found
Typical refactoring workflow¶
- Move code to canonical package (
dpone.dag.*,dpone.runtime.*, etc.). - Replace any remaining deprecated shim imports.
- Run:
-
Only then add/expand the rule matrix if the new boundary is stable.
-
runtime-no-core-or-lib: runtime code must use canonical contracts/runtime support modules instead of legacydpone.core/dpone.libhelpers.