Skip to content

Commit 62122da

Browse files
srtaalejzimeg
andauthored
build: replace flake8 and black with ruff (#24)
Co-authored-by: Eden Zimbelman <eden.zimbelman@salesforce.com>
1 parent ea6a3cf commit 62122da

File tree

9 files changed

+46
-70
lines changed

9 files changed

+46
-70
lines changed

.flake8

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

.github/workflows/black.yml

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

.github/workflows/flake8.yml

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

.github/workflows/ruff.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Linting and formatting validation using ruff
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
strategy:
13+
matrix:
14+
python-version: ["3.13"]
15+
16+
steps:
17+
- uses: actions/checkout@v5
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
pip install -U pip
25+
pip install -r requirements.txt
26+
- name: Lint and check formatting with ruff
27+
run: |
28+
ruff check .
29+
ruff format --check .

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ Start talking to the bot! Start a new DM or thread and click the feedback button
6060

6161
#### Linting
6262
```zsh
63-
# Run flake8 from root directory for linting
64-
flake8 *.py && flake8 listeners/
63+
# Run ruff check from root directory for linting
64+
ruff check
6565

66-
# Run black from root directory for code formatting
67-
black .
66+
# Run ruff format from root directory for code formatting
67+
ruff format
6868
```
6969

7070
## Project Structure

ai/llm_caller.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ def call_llm(
2121
openai_client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
2222
messages = [{"role": "system", "content": system_content}]
2323
messages.extend(messages_in_thread)
24-
response = openai_client.responses.create(model="gpt-4o-mini", input=messages, stream=True)
24+
response = openai_client.responses.create(
25+
model="gpt-4o-mini", input=messages, stream=True
26+
)
2527
return response

listeners/views/feedback_block.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
from typing import List
22

3-
from slack_sdk.models.blocks import Block, ContextActionsBlock, FeedbackButtonObject, FeedbackButtonsElement
3+
from slack_sdk.models.blocks import (
4+
Block,
5+
ContextActionsBlock,
6+
FeedbackButtonObject,
7+
FeedbackButtonsElement,
8+
)
49

510

611
def create_feedback_block() -> List[Block]:

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
[tool.black]
2-
line-length = 125
1+
[tool.ruff]
2+
[tool.ruff.lint]
3+
[tool.ruff.format]
34

45
[tool.pytest.ini_options]
56
testpaths = ["tests"]

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ slack-bolt==1.26.0
55
openai
66

77
pytest
8-
flake8
9-
black
8+
ruff==0.14.0
109
python-dotenv==1.1.1

0 commit comments

Comments
 (0)