Skip to content

Add linting to ensure boundaries of client/server code are respected #864

@DiamondJoseph

Description

@DiamondJoseph

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions