Add linting to ensure boundaries of client/server code are respected
the tiled.server and tiled.client modules are intended to be kept seperate to allow dependencies to be kept minimal in each. However, this is not enforced except by code review which is falliable. Configuring a linting step to ensure that certain packages are not able to import from each other would prevent this happening.
e.g. dodal has configured importlinter to prevent circular imports
[tool.importlinter]
root_package = "dodal"
[[tool.importlinter.contracts]]
name = "Common cannot import from beamlines"
type = "forbidden"
source_modules = ["dodal.common"]
forbidden_modules = ["dodal.beamlines"]
[[tool.importlinter.contracts]]
name = "Enforce import order"
type = "layers"
layers = ["dodal.plans", "dodal.beamlines", "dodal.devices"]
This may also be useful for enforcing optional dependencies are not misused?
The above configures so that dodal.common cannot import from dodal.beamlines, and that dodal.plans can import from dodal.beamlines, which can import from dodal.devices but not in the opposite direction.
Great idea!