Forbid layer imports in the root package
CI / checks (pull_request) Successful in 45s

The layers contract does not check chemenu/__init__.py itself, so an import
there would load a layer for every importer without any check failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
torbenandClaude Opus 5.5 committed 2026-12-02 21:49:48 +01:00
1 parent fcdce6d63b
commit f2882511f4
3 files changed
+20 -1

No files matched your search

+9
View File
@@ -72,3 +72,12 @@ layers = [
"domain",
]
exhaustive = true
# The root package is the container of the layers and not checked as one of them.
[[tool.importlinter.contracts]]
id = "root"
name = "Root package imports no layer"
type = "forbidden"
source_modules = ["chemenu"]
forbidden_modules = ["chemenu.**"]
as_packages = false