Skip to content

Commit a2cc87a

Browse files
authored
chore: drop pylint (#443)
* draft * fix rules * always use LazyImporter * remove pylint * fixes
1 parent 0fba2bc commit a2cc87a

File tree

27 files changed

+187
-285
lines changed

27 files changed

+187
-285
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,18 @@ jobs:
4242
linting:
4343
runs-on: ubuntu-latest
4444
steps:
45-
- uses: actions/checkout@v5
45+
- uses: actions/checkout@v6
4646

4747
- name: Get changed files
4848
id: files
4949
uses: tj-actions/changed-files@v47
5050
with:
51-
files_yaml: |
52-
python:
53-
- '**/*.py'
54-
- '!test/**'
55-
pyproject:
56-
- 'pyproject.toml'
57-
51+
files: |
52+
**/*.py
53+
pyproject.toml
54+
files_ignore: |
55+
test/**
56+
.github/**
5857
- uses: actions/setup-python@v6
5958
with:
6059
python-version: "${{ env.PYTHON_VERSION }}"
@@ -65,15 +64,8 @@ jobs:
6564
- name: Ruff - check format and linting
6665
run: hatch run fmt-check
6766

68-
- name: Pylint
69-
# Running pylint on pyproject.toml causes errors, so we only run it on python files.
70-
if: steps.files.outputs.python_any_changed == 'true'
71-
run: |
72-
hatch run test:lint ${{ steps.files.outputs.python_all_changed_files }}
73-
74-
7567
- name: Typing
76-
if: steps.files.outputs.python_any_changed == 'true' || steps.files.outputs.pyproject_any_changed == 'true'
68+
if: steps.files.outputs.any_changed == 'true'
7769
run: |
7870
mkdir .mypy_cache
7971
hatch run test:types

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
args: [--markdown-linebreak-ext=md]
1818

1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.14.0
20+
rev: v0.15.2
2121
hooks:
2222
- id: ruff-check
2323
args: [ --fix ]

haystack_experimental/chat_message_stores/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
from haystack_experimental.chat_message_stores.in_memory import InMemoryChatMessageStore
5+
import sys
6+
from typing import TYPE_CHECKING
67

7-
__all__ = ["InMemoryChatMessageStore"]
8+
from lazy_imports import LazyImporter
9+
10+
_import_structure = {"in_memory": ["InMemoryChatMessageStore"]}
11+
12+
if TYPE_CHECKING:
13+
from .in_memory import InMemoryChatMessageStore as InMemoryChatMessageStore
14+
else:
15+
sys.modules[__name__] = LazyImporter(name=__name__, module_file=__file__, import_structure=_import_structure)

haystack_experimental/chat_message_stores/in_memory.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
from collections.abc import Iterable
56
from dataclasses import replace
6-
from typing import Any, Iterable
7+
from typing import Any
78

89
from haystack import default_from_dict, default_to_dict
910
from haystack.dataclasses import ChatMessage, ChatRole

haystack_experimental/chat_message_stores/types.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
from haystack.dataclasses import ChatMessage
88

9-
# Ellipsis are needed for the type checker, it's safe to disable module-wide
10-
# pylint: disable=unnecessary-ellipsis
11-
129

1310
class ChatMessageStore(Protocol):
1411
"""

haystack_experimental/components/agents/agent.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
# pylint: disable=wrong-import-order,wrong-import-position,ungrouped-imports
65
# ruff: noqa: I001
76

87
import inspect
@@ -240,8 +239,7 @@ def _initialize_fresh_execution(
240239
retriever_kwargs = _select_kwargs(self._chat_message_retriever, chat_message_store_kwargs or {})
241240
if "chat_history_id" in retriever_kwargs:
242241
updated_messages = self._chat_message_retriever.run(
243-
current_messages=exe_context.state.get("messages", []),
244-
**retriever_kwargs,
242+
current_messages=exe_context.state.get("messages", []), **retriever_kwargs
245243
)["messages"]
246244
# We replace the messages in state with the updated messages including chat history
247245
exe_context.state.set("messages", updated_messages, handler_override=replace_values)

haystack_experimental/components/agents/human_in_the_loop/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@
77

88
from lazy_imports import LazyImporter
99

10-
_import_structure = {
11-
"dataclasses": ["ToolExecutionDecision"],
12-
"errors": ["HITLBreakpointException"],
13-
"strategies": ["BreakpointConfirmationStrategy"],
14-
}
10+
_import_structure = {"errors": ["HITLBreakpointException"], "strategies": ["BreakpointConfirmationStrategy"]}
1511

1612
if TYPE_CHECKING:
17-
from .dataclasses import ToolExecutionDecision as ToolExecutionDecision
1813
from .errors import HITLBreakpointException as HITLBreakpointException
1914
from .strategies import BreakpointConfirmationStrategy as BreakpointConfirmationStrategy
2015

haystack_experimental/components/agents/human_in_the_loop/breakpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_tool_calls_and_descriptions_from_snapshot(
2727
"""
2828
break_point = agent_snapshot.break_point.break_point
2929
if not isinstance(break_point, ToolBreakpoint):
30-
raise ValueError("The provided AgentSnapshot does not contain a ToolBreakpoint.")
30+
raise TypeError("The provided AgentSnapshot does not contain a ToolBreakpoint.")
3131

3232
tool_caused_break_point = break_point.tool_name
3333

haystack_experimental/components/agents/human_in_the_loop/strategies.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def run(
3737
self,
3838
*,
3939
tool_name: str,
40-
tool_description: str,
41-
tool_params: dict[str, Any],
40+
tool_description: str, # noqa: ARG002
41+
tool_params: dict[str, Any], # noqa: ARG002
4242
tool_call_id: str | None = None,
43-
confirmation_strategy_context: dict[str, Any] | None = None,
43+
confirmation_strategy_context: dict[str, Any] | None = None, # noqa: ARG002
4444
) -> ToolExecutionDecision:
4545
"""
4646
Run the breakpoint confirmation strategy for a given tool and its parameters.

haystack_experimental/components/embedders/types/protocol.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
from haystack import Document
88

9-
# See https://github.com/pylint-dev/pylint/issues/9319.
10-
# pylint: disable=unnecessary-ellipsis
11-
129

1310
class DocumentEmbedder(Protocol):
1411
"""

0 commit comments

Comments
 (0)