Skip to content

Commit 76b92e5

Browse files
committed
fix linting
1 parent ed61ea7 commit 76b92e5

File tree

12 files changed

+54
-82
lines changed

12 files changed

+54
-82
lines changed

.github/workflows/unit_tests.yml

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,25 @@
11
name: Unit Tests
22

33
on:
4-
push:
5-
paths:
6-
- "servers/**"
7-
- ".github/workflows/unit_tests.yml"
84
pull_request:
9-
paths:
10-
- "servers/**"
11-
- ".github/workflows/unit_tests.yml"
5+
types: [opened, synchronize]
6+
merge_group:
7+
types: [checks_requested]
8+
push:
9+
# Always run on push to main. The build cache can only be reused
10+
# if it was saved by a run from the repository's default branch.
11+
# The run result will be identical to that from the merge queue
12+
# because the commit is identical, yet we need to perform it to
13+
# seed the build cache.
14+
branches:
15+
- master
1216

1317
jobs:
14-
discover:
15-
runs-on:
16-
group: databrickslabs-protected-runner-group
17-
labels: linux-ubuntu-latest
18-
outputs:
19-
server_dirs: ${{ steps.set-matrix.outputs.server_dirs }}
20-
21-
steps:
22-
- name: Checkout code
23-
uses: actions/checkout@v4
24-
25-
- name: Discover server dirs with tests
26-
id: set-matrix
27-
run: |
28-
dirs=$(find servers -mindepth 1 -maxdepth 1 -type d -exec test -d "{}/tests" \; -print | sed 's|servers/||' | jq -R . | jq -cs .)
29-
echo "Found directories: $dirs"
30-
echo "server_dirs=$dirs" >> "$GITHUB_OUTPUT"
31-
32-
3318

3419
test:
35-
needs: discover
3620
runs-on:
3721
group: databrickslabs-protected-runner-group
3822
labels: linux-ubuntu-latest
39-
strategy:
40-
matrix:
41-
server-dir: ${{ fromJson(needs.discover.outputs.server_dirs) }}
4223

4324
steps:
4425
- name: Checkout code
@@ -53,14 +34,12 @@ jobs:
5334
uses: astral-sh/setup-uv@v5
5435

5536
- name: Install dependencies with uv
56-
working-directory: servers/${{ matrix.server-dir }}
5737
run: |
58-
uv sync
59-
uv pip install --group dev
38+
uv sync
6039
6140
- name: Run tests
62-
working-directory: servers/${{ matrix.server-dir }}
6341
run: uv run pytest tests
42+
6443
lint:
6544
runs-on:
6645
group: databrickslabs-protected-runner-group
@@ -80,4 +59,4 @@ jobs:
8059
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
8160
8261
- name: Run lint checks
83-
run: ./dev/lint.sh
62+
run: make lint

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,6 @@ a.md
122122
gunicorn.conf.py
123123

124124
# ignore version file
125-
src/databricks/labs/mcp/_version.py
125+
src/databricks/labs/mcp/_version.py
126+
127+
.ruff_cache/

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
fmt:
2-
uv run isort .
32
uv run black .
43
uv run ruff check . --fix
54

6-
verify:
7-
uv run isort . --check
5+
lint:
86
uv run black . --check
97
uv run ruff check .

dev/lint.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dev-dependencies = [
2323
"pyright>=1.1.393",
2424
"ruff>=0.9.4",
2525
"pytest>=8.3.4",
26+
"isort>=6.0.1",
2627
]
2728

2829
[project.scripts]
@@ -66,4 +67,4 @@ replacement = '<img \1src="https://raw.githubusercontent.com/databrickslabs/mcp/
6667
testpaths = ["tests"]
6768
python_files = "test_*.py"
6869
python_classes = "Test*"
69-
python_functions = "test_*"
70+
python_functions = "test_*"

src/databricks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DO NOT ADD ANYTHING ELSE TO THIS FILE FOR COMPATIBILITY WITH OTHER databricks.labs.* PACKAGES
22
# SEE https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
3-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
3+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

src/databricks/labs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DO NOT ADD ANYTHING ELSE TO THIS FILE FOR COMPATIBILITY WITH OTHER databricks.labs.* PACKAGES
22
# SEE https://packaging.python.org/guides/packaging-namespace-packages/#pkgutil-style-namespace-packages
3-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
3+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

src/databricks/labs/mcp/servers/unity_catalog/tools/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
)
77

88
from databricks.labs.mcp.servers.unity_catalog.tools.genie import list_genie_tools
9-
from databricks.labs.mcp.servers.unity_catalog.tools.functions import list_uc_function_tools
10-
from databricks.labs.mcp.servers.unity_catalog.tools.vector_search import list_vector_search_tools
9+
from databricks.labs.mcp.servers.unity_catalog.tools.functions import (
10+
list_uc_function_tools,
11+
)
12+
from databricks.labs.mcp.servers.unity_catalog.tools.vector_search import (
13+
list_vector_search_tools,
14+
)
1115

1216
Content: TypeAlias = Union[TextContent, ImageContent, EmbeddedResource]
1317

tests/test_functions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ class DummySettings:
5454

5555

5656
@mock.patch(
57-
"databricks.labs.mcp.servers.unity_catalog.tools.functions.DatabricksFunctionClient", new=DummyClient
57+
"databricks.labs.mcp.servers.unity_catalog.tools.functions.DatabricksFunctionClient",
58+
new=DummyClient,
59+
)
60+
@mock.patch(
61+
"databricks.labs.mcp.servers.unity_catalog.tools.functions.UCFunctionToolkit",
62+
new=DummyToolkit,
5863
)
59-
@mock.patch("databricks.labs.mcp.servers.unity_catalog.tools.functions.UCFunctionToolkit", new=DummyToolkit)
6064
def test_list_uc_function_tools():
6165
settings = DummySettings()
6266
tools = list_uc_function_tools(settings)

tests/test_genie.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ class DummyWorkspaceClient:
6363
pass
6464

6565

66-
@mock.patch("databricks.labs.mcp.servers.unity_catalog.tools.genie.WorkspaceClient", new=DummyWorkspaceClient)
66+
@mock.patch(
67+
"databricks.labs.mcp.servers.unity_catalog.tools.genie.WorkspaceClient",
68+
new=DummyWorkspaceClient,
69+
)
6770
def test_genie_tool_execute():
6871
mock_func = mock.Mock()
6972
mock_func.return_value = [mock.Mock(text="hello world")]

0 commit comments

Comments
 (0)