Skip to content

Commit 4139566

Browse files
committed
chore: update pyproject.toml and console.py for linter integration
- Added Pyright exclusion patterns in pyproject.toml to ignore specific directories. - Introduced a new method `show_linter_violations` in EventConsole to handle and publish linting violations. - Reorganized imports in console.py for better clarity and consistency.
1 parent f9e8b79 commit 4139566

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

dagster_sqlmesh/console.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1+
import logging
12
import typing as t
2-
from typing import Dict, Union, Callable
3-
from dataclasses import dataclass
4-
import uuid
53
import unittest
6-
import logging
4+
import uuid
5+
from dataclasses import dataclass
6+
from typing import Callable, Dict, Union
77

88
from sqlglot.expressions import Alter
99
from sqlmesh.core.console import Console
10-
from sqlmesh.core.plan import EvaluatablePlan
1110
from sqlmesh.core.context_diff import ContextDiff
12-
from sqlmesh.core.plan import PlanBuilder
13-
from sqlmesh.core.table_diff import RowDiff, SchemaDiff, TableDiff
1411
from sqlmesh.core.environment import EnvironmentNamingInfo
12+
from sqlmesh.core.linter.rule import RuleViolation
13+
from sqlmesh.core.plan import EvaluatablePlan, PlanBuilder
1514
from sqlmesh.core.snapshot import (
1615
Snapshot,
1716
SnapshotChangeCategory,
1817
SnapshotInfoLike,
1918
)
19+
from sqlmesh.core.table_diff import RowDiff, SchemaDiff, TableDiff
2020
from sqlmesh.utils.concurrency import NodeExecutionFailedError
2121

2222
logger = logging.getLogger(__name__)
@@ -559,6 +559,12 @@ def print_environments(self, environments_summary: t.Dict[str, int]) -> None:
559559
def show_table_diff_summary(self, table_diff: TableDiff) -> None:
560560
self.publish(ShowTableDiffSummary(table_diff))
561561

562+
def show_linter_violations(
563+
self,
564+
violations: list[RuleViolation],
565+
) -> None:
566+
self.publish(LogWarning("Linting violations found", str(violations)))
567+
562568

563569
class DebugEventConsole(EventConsole):
564570
"""A console that wraps an existing console and logs all events to a logger"""

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"scripts": {
1313
"build": "turbo run build --concurrency=100%",
1414
"format:staged": "lint-staged",
15-
"pyright": "pyright --pythonpath $(echo 'import sys; print(sys.prefix)' | uv run -)/bin/python",
15+
"pyright": "uv run -q -c \"import sys; print(sys.executable)\" | xargs -r pyright --pythonpath",
1616
"prepare": "husky install"
1717
},
1818
"devDependencies": {

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,16 @@ dev = [
2828
[build-system]
2929
requires = ["hatchling"]
3030
build-backend = "hatchling.build"
31+
32+
[tool.pyright]
33+
exclude = [
34+
".venv",
35+
"**/.venv",
36+
"node_modules",
37+
"**/.git",
38+
"**/.github",
39+
"**/.vscode",
40+
"**/.idea",
41+
"**/.pytest_cache",
42+
]
43+

0 commit comments

Comments
 (0)