diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..e8133f2 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: chartboost/ruff-action@v1 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a19940f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.7 + hooks: + # Run the linter. + - id: ruff + args: [ --fix ] + # Run the formatter. + - id: ruff-format \ No newline at end of file diff --git a/examples/task_planner/task_planner_topological_sort.py b/examples/task_planner/task_planner_topological_sort.py index 4da084e..78b0ed4 100644 --- a/examples/task_planner/task_planner_topological_sort.py +++ b/examples/task_planner/task_planner_topological_sort.py @@ -79,7 +79,7 @@ class TaskPlan(BaseModel): tmp_dep_graph = {item.id: set(item.subtasks) for item in self.task_graph} def topological_sort( - dep_graph: dict[int, set[int]] + dep_graph: dict[int, set[int]], ) -> Generator[set[int], None, None]: while True: ordered = set(item for item, dep in dep_graph.items() if len(dep) == 0) diff --git a/instructor/cli/files.py b/instructor/cli/files.py index 96534bf..df91acf 100644 --- a/instructor/cli/files.py +++ b/instructor/cli/files.py @@ -101,7 +101,7 @@ def delete(file_id: str = typer.Argument(..., help="ID of the file to delete")): help="Monitor the status of a file on OpenAI's servers", ) def status( - file_id: str = typer.Argument(..., help="ID of the file to check the status of") + file_id: str = typer.Argument(..., help="ID of the file to check the status of"), ): with console.status(f"Monitoring status of file {file_id}...") as status: while True: diff --git a/requirements.txt b/requirements.txt index 45c3f29..0198a72 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,6 @@ openai>=1.1.0 pydantic docstring-parser rich -aiohttp \ No newline at end of file +aiohttp +ruff==0.1.7 +pre-commit==3.5.0 \ No newline at end of file diff --git a/tests/openai/evals/test_nested_structures.py b/tests/openai/evals/test_nested_structures.py index 7818558..1e5ddc9 100644 --- a/tests/openai/evals/test_nested_structures.py +++ b/tests/openai/evals/test_nested_structures.py @@ -1,4 +1,3 @@ -from typing import Iterable from openai import OpenAI from pydantic import BaseModel, Field from typing import List