Skip to content

Commit 825bb95

Browse files
committed
Add Import Linter contract
It's about time!
1 parent b5a132d commit 825bb95

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.importlinter

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[importlinter]
2+
root_package = grimp
3+
4+
[importlinter:contract:1]
5+
name=Layered architecture
6+
type=layers
7+
containers =
8+
grimp
9+
layers=
10+
main
11+
adaptors
12+
application
13+
domain
14+
exceptions
15+
exhaustive = true
16+
ignore_imports =
17+
; Grimp doesn't understand extension modules: it thinks grimp._rustgrimp
18+
; is an object within grimp, rather than a module in its own right,
19+
; so we ignore these imports here.
20+
grimp.adaptors.graph -> grimp
21+
grimp.adaptors.importscanner -> grimp
22+
grimp.adaptors.filesystem -> grimp

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ basepython = py313
5151
deps =
5252
black==23.9.1
5353
flake8==7.1.1
54+
import-linter==2.3
5455
mypy==1.11.2
5556
pytest-stub==1.1.0
5657
types-pyyaml==6.0.12.20240917
@@ -59,6 +60,7 @@ commands =
5960
black --check src tests
6061
flake8 src tests
6162
mypy src/grimp tests
63+
lint-imports
6264

6365
[testenv:benchmark]
6466
basepython = py313

0 commit comments

Comments
 (0)