From 67a8f1249be45422662d9e661bb558a9adde5e8c Mon Sep 17 00:00:00 2001 From: Amna Mubashar Date: Wed, 18 Jun 2025 09:53:19 +0200 Subject: [PATCH] chore: update linter configuration for compatibility with latest ruff release (#9528) * Fix linting * Fix linting * Update error suppression * Update pre commit * Update pyproject.toml --- .pre-commit-config.yaml | 2 +- haystack/core/component/sockets.py | 2 +- haystack/core/pipeline/base.py | 2 +- haystack/dataclasses/document.py | 2 +- pyproject.toml | 5 +++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4a9a7267..429fd2d4e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: args: [--markdown-linebreak-ext=md] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.12 + rev: v0.12.0 hooks: - id: ruff-check args: [ --fix ] diff --git a/haystack/core/component/sockets.py b/haystack/core/component/sockets.py index da516e9a3..8abeb8b25 100644 --- a/haystack/core/component/sockets.py +++ b/haystack/core/component/sockets.py @@ -12,7 +12,7 @@ SocketsDict = Dict[str, Union[InputSocket, OutputSocket]] SocketsIOType = Union[Type[InputSocket], Type[OutputSocket]] -class Sockets: +class Sockets: # noqa: PLW1641 """ Represents the inputs or outputs of a `Component`. diff --git a/haystack/core/pipeline/base.py b/haystack/core/pipeline/base.py index 078eb8513..2db9cdb1e 100644 --- a/haystack/core/pipeline/base.py +++ b/haystack/core/pipeline/base.py @@ -71,7 +71,7 @@ class ComponentPriority(IntEnum): BLOCKED = 5 -class PipelineBase: +class PipelineBase: # noqa: PLW1641 """ Components orchestration engine. diff --git a/haystack/dataclasses/document.py b/haystack/dataclasses/document.py index 6794e002b..55bd74e11 100644 --- a/haystack/dataclasses/document.py +++ b/haystack/dataclasses/document.py @@ -43,7 +43,7 @@ class _BackwardCompatible(type): @dataclass -class Document(metaclass=_BackwardCompatible): +class Document(metaclass=_BackwardCompatible): # noqa: PLW1641 """ Base data class containing some data to be queried. diff --git a/pyproject.toml b/pyproject.toml index 81b5a6df7..4ba6fd5c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,7 @@ dependencies = [ "pandas", # AzureOCRDocumentConverter, CSVDocumentCleaner, CSVDocumentSplitter, # EvaluationRunResult, XLSXToDocument, and pipeline tests - "transformers[torch,sentencepiece]>=4.51.1,<4.52", # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators... + "transformers[torch, sentencepiece]>=4.51.1,<4.52", # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators... "huggingface_hub>=0.27.0", # Hugging Face API Generators and Embedders "sentence-transformers>=4.1.0", # Sentence Transformers Embedders, Rankers, and SASEvaluator "langdetect", # TextLanguageRouter and DocumentLanguageClassifier @@ -333,7 +333,8 @@ ignore = [ "SIM118", # in-dict-keys # we re-export symbols for correct type checking # https://typing.python.org/en/latest/spec/distributing.html#import-conventions - "PLC0414", # useless-import-alias + "PLC0414", # useless-import-alias, + "PLC0415", # import-outside-top-level, ] [tool.ruff.lint.mccabe]