diff --git a/.flake8 b/.flake8 deleted file mode 100644 index e8411f0..0000000 --- a/.flake8 +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -max-line-length = 200 -exclude = .gitignore,venv diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index 2bc889d..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Formatting validation using black - -on: - push: - branches: [ main ] - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - matrix: - python-version: ['3.9'] - - steps: - - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip - pip install -r requirements.txt - - name: Format with black - run: | - black . - if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi \ No newline at end of file diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml deleted file mode 100644 index 89d6d6a..0000000 --- a/.github/workflows/flake8.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Linting validation using flake8 - -on: - push: - branches: [ main ] - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - matrix: - python-version: ['3.9'] - - steps: - - uses: actions/checkout@v5 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install -U pip - pip install -r requirements.txt - - name: Lint with flake8 - run: | - flake8 *.py && flake8 listeners/ \ No newline at end of file diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..c7ece3a --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,29 @@ +name: Linting and formatting validation using ruff + +on: + push: + branches: [main] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 5 + strategy: + matrix: + python-version: ["3.13"] + + steps: + - uses: actions/checkout@v5 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install -U pip + pip install -r requirements.txt + - name: Lint and check formatting with ruff + run: | + ruff check . + ruff format --check . \ No newline at end of file diff --git a/README.md b/README.md index 41fc350..8cc86cd 100644 --- a/README.md +++ b/README.md @@ -60,11 +60,11 @@ Start talking to the bot! Start a new DM or thread and click the feedback button #### Linting ```zsh -# Run flake8 from root directory for linting -flake8 *.py && flake8 listeners/ +# Run ruff check from root directory for linting +ruff check -# Run black from root directory for code formatting -black . +# Run ruff format from root directory for code formatting +ruff format ``` ## Project Structure diff --git a/ai/llm_caller.py b/ai/llm_caller.py index a1b9fc5..d0a0591 100644 --- a/ai/llm_caller.py +++ b/ai/llm_caller.py @@ -21,5 +21,7 @@ def call_llm( openai_client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY")) messages = [{"role": "system", "content": system_content}] messages.extend(messages_in_thread) - response = openai_client.responses.create(model="gpt-4o-mini", input=messages, stream=True) + response = openai_client.responses.create( + model="gpt-4o-mini", input=messages, stream=True + ) return response diff --git a/listeners/views/feedback_block.py b/listeners/views/feedback_block.py index 48028be..ffbb489 100644 --- a/listeners/views/feedback_block.py +++ b/listeners/views/feedback_block.py @@ -1,6 +1,11 @@ from typing import List -from slack_sdk.models.blocks import Block, ContextActionsBlock, FeedbackButtonObject, FeedbackButtonsElement +from slack_sdk.models.blocks import ( + Block, + ContextActionsBlock, + FeedbackButtonObject, + FeedbackButtonsElement, +) def create_feedback_block() -> List[Block]: diff --git a/pyproject.toml b/pyproject.toml index b007a65..6dca91c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ -[tool.black] -line-length = 125 +[tool.ruff] +[tool.ruff.lint] +[tool.ruff.format] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/requirements.txt b/requirements.txt index 9e8c646..12b483f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,5 @@ slack-bolt==1.26.0 openai pytest -flake8 -black +ruff==0.14.0 python-dotenv==1.1.1