diff --git a/integrations/astra/pyproject.toml b/integrations/astra/pyproject.toml index 9ecbd43df..25bcf20b8 100644 --- a/integrations/astra/pyproject.toml +++ b/integrations/astra/pyproject.toml @@ -127,7 +127,6 @@ unfixable = [ # Don't touch unused imports "F401", ] -exclude = ["example"] [tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] diff --git a/integrations/deepeval/example/example.py b/integrations/deepeval/example/example.py index e1265a739..97a26ef34 100644 --- a/integrations/deepeval/example/example.py +++ b/integrations/deepeval/example/example.py @@ -1,6 +1,7 @@ # A valid OpenAI API key is required to run this example. from haystack import Pipeline + from haystack_integrations.components.evaluators.deepeval import DeepEvalEvaluator, DeepEvalMetric QUESTIONS = [ diff --git a/integrations/deepeval/pyproject.toml b/integrations/deepeval/pyproject.toml index 3e22053c6..5d81fa0a5 100644 --- a/integrations/deepeval/pyproject.toml +++ b/integrations/deepeval/pyproject.toml @@ -71,7 +71,7 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -extend-exclude = ["tests", "example"] +exclude = ["example", "tests"] [tool.ruff.lint] select = [ diff --git a/integrations/deepeval/tests/test_evaluator.py b/integrations/deepeval/tests/test_evaluator.py index 7d1946185..24b9ba7ea 100644 --- a/integrations/deepeval/tests/test_evaluator.py +++ b/integrations/deepeval/tests/test_evaluator.py @@ -5,10 +5,10 @@ from unittest.mock import patch import pytest +from deepeval.evaluate import BaseMetric, TestResult from haystack import DeserializationError from haystack_integrations.components.evaluators.deepeval import DeepEvalEvaluator, DeepEvalMetric -from deepeval.evaluate import TestResult, BaseMetric DEFAULT_QUESTIONS = [ "Which is the most popular global sport?", diff --git a/integrations/langfuse/example/basic_rag.py b/integrations/langfuse/example/basic_rag.py index 492a14d49..b1d5e620f 100644 --- a/integrations/langfuse/example/basic_rag.py +++ b/integrations/langfuse/example/basic_rag.py @@ -10,6 +10,7 @@ from haystack.components.generators import OpenAIGenerator from haystack.components.retrievers import InMemoryEmbeddingRetriever from haystack.document_stores.in_memory import InMemoryDocumentStore + from haystack_integrations.components.connectors.langfuse import LangfuseConnector diff --git a/integrations/langfuse/pyproject.toml b/integrations/langfuse/pyproject.toml index da02b1346..61de4596c 100644 --- a/integrations/langfuse/pyproject.toml +++ b/integrations/langfuse/pyproject.toml @@ -84,7 +84,7 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -extend-exclude = ["tests", "example"] +exclude = ["example", "tests"] [tool.ruff.lint] select = [ diff --git a/integrations/langfuse/tests/test_langfuse_span.py b/integrations/langfuse/tests/test_langfuse_span.py index a5a5f2c13..7ea82ba97 100644 --- a/integrations/langfuse/tests/test_langfuse_span.py +++ b/integrations/langfuse/tests/test_langfuse_span.py @@ -3,7 +3,9 @@ os.environ["HAYSTACK_CONTENT_TRACING_ENABLED"] = "true" from unittest.mock import Mock + from haystack.dataclasses import ChatMessage + from haystack_integrations.tracing.langfuse.tracer import LangfuseSpan diff --git a/integrations/langfuse/tests/test_tracer.py b/integrations/langfuse/tests/test_tracer.py index 241581a72..c6bf4acdf 100644 --- a/integrations/langfuse/tests/test_tracer.py +++ b/integrations/langfuse/tests/test_tracer.py @@ -1,5 +1,5 @@ import os -from unittest.mock import Mock, MagicMock, patch +from unittest.mock import MagicMock, Mock, patch from haystack_integrations.tracing.langfuse.tracer import LangfuseTracer diff --git a/integrations/langfuse/tests/test_tracing.py b/integrations/langfuse/tests/test_tracing.py index 05acf750e..936064e0a 100644 --- a/integrations/langfuse/tests/test_tracing.py +++ b/integrations/langfuse/tests/test_tracing.py @@ -1,16 +1,17 @@ import os import random import time -import pytest from urllib.parse import urlparse + +import pytest import requests -from requests.auth import HTTPBasicAuth from haystack import Pipeline from haystack.components.builders import ChatPromptBuilder -from haystack.dataclasses import ChatMessage -from haystack_integrations.components.connectors.langfuse import LangfuseConnector from haystack.components.generators.chat import OpenAIChatGenerator +from haystack.dataclasses import ChatMessage +from requests.auth import HTTPBasicAuth +from haystack_integrations.components.connectors.langfuse import LangfuseConnector from haystack_integrations.components.generators.anthropic import AnthropicChatGenerator from haystack_integrations.components.generators.cohere import CohereChatGenerator diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index bd01bc149..bc8555140 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -71,8 +71,8 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"] [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" -style = ["ruff check {args:. --exclude tests/, examples/ }", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/, examples/ }", "style"] +style = ["ruff check {args:.}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.hatch.metadata] diff --git a/integrations/optimum/example/example.py b/integrations/optimum/example/example.py index 0d86ce99b..a1e22f575 100644 --- a/integrations/optimum/example/example.py +++ b/integrations/optimum/example/example.py @@ -3,10 +3,10 @@ from haystack import Pipeline from haystack_integrations.components.embedders.optimum import ( - OptimumTextEmbedder, - OptimumEmbedderPooling, OptimumEmbedderOptimizationConfig, OptimumEmbedderOptimizationMode, + OptimumEmbedderPooling, + OptimumTextEmbedder, ) pipeline = Pipeline() diff --git a/integrations/optimum/pyproject.toml b/integrations/optimum/pyproject.toml index c248ab91c..305af6042 100644 --- a/integrations/optimum/pyproject.toml +++ b/integrations/optimum/pyproject.toml @@ -99,7 +99,7 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -extend-exclude = ["tests", "example"] +exclude = ["example", "tests"] [tool.ruff.lint] select = [ diff --git a/integrations/optimum/tests/test_optimum_document_embedder.py b/integrations/optimum/tests/test_optimum_document_embedder.py index 9288bb688..7c8ca02e0 100644 --- a/integrations/optimum/tests/test_optimum_document_embedder.py +++ b/integrations/optimum/tests/test_optimum_document_embedder.py @@ -1,21 +1,22 @@ -from unittest.mock import MagicMock, patch -import tempfile import copy +import tempfile +from unittest.mock import MagicMock, patch import pytest from haystack.dataclasses import Document from haystack.utils.auth import Secret +from huggingface_hub.utils import RepositoryNotFoundError + from haystack_integrations.components.embedders.optimum import OptimumDocumentEmbedder -from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling from haystack_integrations.components.embedders.optimum.optimization import ( OptimumEmbedderOptimizationConfig, OptimumEmbedderOptimizationMode, ) +from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling from haystack_integrations.components.embedders.optimum.quantization import ( OptimumEmbedderQuantizationConfig, OptimumEmbedderQuantizationMode, ) -from huggingface_hub.utils import RepositoryNotFoundError @pytest.fixture @@ -147,9 +148,7 @@ def test_to_and_from_dict(self, mock_check_valid_model, mock_get_pooling_mode): assert embedder._backend.parameters.optimizer_settings is None assert embedder._backend.parameters.quantizer_settings is None - def test_to_and_from_dict_with_custom_init_parameters( - self, mock_check_valid_model, mock_get_pooling_mode - ): # noqa: ARG002 + def test_to_and_from_dict_with_custom_init_parameters(self, mock_check_valid_model, mock_get_pooling_mode): component = OptimumDocumentEmbedder( model="sentence-transformers/all-minilm-l6-v2", token=Secret.from_env_var("ENV_VAR", strict=False), diff --git a/integrations/optimum/tests/test_optimum_text_embedder.py b/integrations/optimum/tests/test_optimum_text_embedder.py index ad0e7d800..db42ec26d 100644 --- a/integrations/optimum/tests/test_optimum_text_embedder.py +++ b/integrations/optimum/tests/test_optimum_text_embedder.py @@ -2,17 +2,18 @@ import pytest from haystack.utils.auth import Secret +from huggingface_hub.utils import RepositoryNotFoundError + from haystack_integrations.components.embedders.optimum import OptimumTextEmbedder -from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling from haystack_integrations.components.embedders.optimum.optimization import ( OptimumEmbedderOptimizationConfig, OptimumEmbedderOptimizationMode, ) +from haystack_integrations.components.embedders.optimum.pooling import OptimumEmbedderPooling from haystack_integrations.components.embedders.optimum.quantization import ( OptimumEmbedderQuantizationConfig, OptimumEmbedderQuantizationMode, ) -from huggingface_hub.utils import RepositoryNotFoundError @pytest.fixture diff --git a/integrations/ragas/pyproject.toml b/integrations/ragas/pyproject.toml index ad3a83c7d..dd56e35f6 100644 --- a/integrations/ragas/pyproject.toml +++ b/integrations/ragas/pyproject.toml @@ -77,7 +77,7 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -extend-exclude = ["tests", "example"] +exclude = ["example", "tests"] [tool.ruff.lint] select = [ diff --git a/integrations/ragas/tests/test_evaluator.py b/integrations/ragas/tests/test_evaluator.py index fc8901c32..0f847ed0b 100644 --- a/integrations/ragas/tests/test_evaluator.py +++ b/integrations/ragas/tests/test_evaluator.py @@ -5,10 +5,11 @@ import pytest from datasets import Dataset from haystack import DeserializationError -from haystack_integrations.components.evaluators.ragas import RagasEvaluator, RagasMetric from ragas.evaluation import Result from ragas.metrics.base import Metric +from haystack_integrations.components.evaluators.ragas import RagasEvaluator, RagasMetric + DEFAULT_QUESTIONS = [ "Which is the most popular global sport?", "Who created the Python language?",