Skip to content

Commit 39908f7

Browse files
authored
Chore/add python formatter and linter (#37)
* add black as code formatter * add flake8 as linter
1 parent 2ba347f commit 39908f7

20 files changed

+1034
-635
lines changed

.github/workflows/check-format.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Check Python code format with Black
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**/*.py'
9+
pull_request:
10+
paths:
11+
- 'src/**/*.py'
12+
13+
jobs:
14+
black-format:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
25+
- name: Install Black
26+
run: pip install black
27+
28+
- name: Check code format with Black
29+
run: black --check src/

.github/workflows/check-lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint Python code with Flake8
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'src/**/*.py'
7+
8+
jobs:
9+
flake8-lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install Flake8
21+
run: pip install flake8
22+
23+
- name: Run Flake8
24+
run: flake8 src/ --ignore=E501,W503

.github/workflows/publish-pypi.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install build twine
2828
pip install -r requirements.txt
29-
29+
pip install flake8
30+
31+
- name: Lint with flake8
32+
run: flake8 src/
33+
3034
- name: Build package
3135
run: python -m build
3236

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ description = "SingleStore MCP server"
55
readme = "README.md"
66
requires-python = ">=3.11"
77
dependencies = [
8+
"black>=25.1.0",
89
"fastapi>=0.115.12",
10+
"flake8>=7.2.0",
911
"mcp[cli]>=1.8.1",
1012
"nbformat>=5.10.4",
1113
"singlestoredb>=1.12.0",
@@ -23,3 +25,7 @@ packages = ["src"]
2325

2426
[project.scripts]
2527
singlestore-mcp-server = "server:main"
28+
29+
[tool.flake8]
30+
# line too long
31+
ignore="E501"

src/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from . import server
22

3+
34
def main():
45
"""Main entry point for the package."""
56
server.main()
67

8+
79
# Optionally expose other important items at package level
8-
__all__ = ['main', 'server']
10+
__all__ = ["main", "server"]

0 commit comments

Comments
 (0)