feat(check): make check fails when a service imports another service's sdk at startup
This commit is contained in:
1 parent
97fdafa092
commit
c19cdc4e11
4 files changed
+69
-2
No files matched your search
@@ -5,3 +5,9 @@ ruff format
|
||||
ruff check --fix
|
||||
ty check
|
||||
```
|
||||
|
||||
## Imports
|
||||
Every service imports only what it needs to start. `make check` runs `scripts/check_imports.py`, which fails when a service loads a heavy package it is not allowed; `SERVICES` there is the contract, extend it on purpose.
|
||||
- Package `__init__` files don't re-export clients or SDKs.
|
||||
- An SDK used by one function is imported inside it. On an async path load it first with `await preload("<module>")` from `utils.imports`, so the event loop never waits on the import.
|
||||
- Types used in Dishka provider signatures and `FromDishka[...]` stay real top-level imports.
|
||||
Reference in new issue
Block a user