From 8ca6212132d27eea1a3147329536bbf1aac018b6 Mon Sep 17 00:00:00 2001 From: Ben King <9087625+benfdking@users.noreply.github.com> Date: Wed, 23 Jul 2025 14:09:47 +0100 Subject: [PATCH] chore: prevent bad imports from lsp module elsewhere --- pyproject.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3ea3935c1c..180b86e93b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -280,9 +280,20 @@ select = [ ] extend-select = ["TID"] + [tool.ruff.lint.flake8-tidy-imports] banned-module-level-imports = [ "duckdb", "numpy", "pandas", ] + +# Bans imports from sqlmesh.lsp in files outside of sqlmesh/lsp +[tool.ruff.lint.flake8-tidy-imports.banned-api] +"sqlmesh.lsp".msg = "Only files within sqlmesh/lsp can import from sqlmesh.lsp" + +[tool.ruff.lint.per-file-ignores] +# TID251 is used to ignore the import of sqlmesh.lsp in files outside sqlmesh/lsp +"sqlmesh/lsp/**/*.py" = ["TID251"] +"tests/lsp/**/*.py" = ["TID251"] +"benchmarks/lsp*.py" = ["TID251"]