Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use ruff to format code instead of black #269

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.5

hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: ".*poetry.lock"
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.1
hooks:
- id: black-jupyter
name: black-src
alias: black
exclude: ".*poetry.lock"
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
hooks:
Expand All @@ -50,6 +46,7 @@ repos:
--python-version=3.11,
]
exclude: ^(examples/|e2e_tests/)

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
Expand All @@ -60,21 +57,19 @@ repos:
additional_dependencies: [black==23.10.1]
# Using PEP 8's line length in docs prevents excess left/right scrolling
args: [--line-length=79]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
exclude: poetry.lock

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies: [tomli]
- repo: https://github.com/srstevenson/nb-clean
rev: 3.1.0
hooks:
- id: nb-clean
args: [--preserve-cell-outputs, --remove-empty-cells]

- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
Expand Down
4 changes: 1 addition & 3 deletions tests/message_queues/test_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ async def test_publish(mock_connect: MagicMock) -> None:
mq = RabbitMQMessageQueue()
# mocks
mock_exchange_publish = AsyncMock()
mock_connect.return_value.channel.return_value.declare_exchange.return_value.publish = (
mock_exchange_publish
)
mock_connect.return_value.channel.return_value.declare_exchange.return_value.publish = mock_exchange_publish
# message types
queue_message = QueueMessage(publisher_id="test", id_="1")
message_body = json.dumps(queue_message.model_dump()).encode("utf-8")
Expand Down
5 changes: 4 additions & 1 deletion tests/orchestrators/test_simple_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ async def test_get_next_message() -> None:
assert len(queue_messages) == 1
assert queue_messages[0].type == INITIAL_QUEUE_MESSAGE.type
assert isinstance(queue_messages[0].data, dict)
assert queue_messages[0].data["task"]["input"] == INITIAL_QUEUE_MESSAGE.data["task"]["input"] # type: ignore
assert (
queue_messages[0].data["task"]["input"]
== INITIAL_QUEUE_MESSAGE.data["task"]["input"]
) # type: ignore

assert state[TASK_DEF.task_id] == {}

Expand Down
Loading