diff --git a/.github/workflows/anthropic.yml b/.github/workflows/anthropic.yml index c4cdeb2d1..52ba5c9d4 100644 --- a/.github/workflows/anthropic.yml +++ b/.github/workflows/anthropic.yml @@ -15,7 +15,7 @@ defaults: working-directory: integrations/anthropic concurrency: - group: cohere-${{ github.head_ref }} + group: anthropic-${{ github.head_ref }} cancel-in-progress: true env: diff --git a/integrations/amazon_bedrock/pyproject.toml b/integrations/amazon_bedrock/pyproject.toml index f4a410dbd..1298abfab 100644 --- a/integrations/amazon_bedrock/pyproject.toml +++ b/integrations/amazon_bedrock/pyproject.toml @@ -67,7 +67,7 @@ typing = "mypy --install-types --non-interactive --explicit-package-bases {args: style = ["ruff check {args:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] @@ -79,6 +79,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -128,13 +130,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/amazon_sagemaker/pyproject.toml b/integrations/amazon_sagemaker/pyproject.toml index f8050bb48..a25b806f6 100644 --- a/integrations/amazon_sagemaker/pyproject.toml +++ b/integrations/amazon_sagemaker/pyproject.toml @@ -70,7 +70,7 @@ 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:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.black] @@ -81,6 +81,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -131,13 +133,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/anthropic/pyproject.toml b/integrations/anthropic/pyproject.toml index e1d3fa867..987f017be 100644 --- a/integrations/anthropic/pyproject.toml +++ b/integrations/anthropic/pyproject.toml @@ -67,7 +67,7 @@ typing = "mypy --install-types --non-interactive --explicit-package-bases {args: style = ["ruff check {args:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] @@ -79,6 +79,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -129,13 +131,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/astra/pyproject.toml b/integrations/astra/pyproject.toml index 7d543ddc9..25bcf20b8 100644 --- a/integrations/astra/pyproject.toml +++ b/integrations/astra/pyproject.toml @@ -78,7 +78,9 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -lint.select = [ + +[tool.ruff.lint] +select = [ "A", "ARG", "B", @@ -105,7 +107,7 @@ lint.select = [ "W", "YTT", ] -lint.ignore = [ +ignore = [ # Allow non-abstract empty methods in abstract base classes "B027", # Allow boolean positional values in function calls, like `dict.get(... True)` @@ -121,11 +123,10 @@ lint.ignore = [ "PLR0913", "PLR0915", ] -lint.unfixable = [ +unfixable = [ # Don't touch unused imports "F401", ] -lint.exclude = ["example"] [tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] diff --git a/integrations/chroma/pyproject.toml b/integrations/chroma/pyproject.toml index cebfa1b9d..2bffabfd8 100644 --- a/integrations/chroma/pyproject.toml +++ b/integrations/chroma/pyproject.toml @@ -70,8 +70,8 @@ dependencies = [ ] [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" -style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:.}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.hatch.metadata] @@ -85,7 +85,9 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -lint.select = [ + +[tool.ruff.lint] +select = [ "A", "ARG", "B", @@ -112,7 +114,7 @@ lint.select = [ "W", "YTT", ] -lint.ignore = [ +ignore = [ # Allow non-abstract empty methods in abstract base classes "B027", # Allow boolean positional values in function calls, like `dict.get(... True)` @@ -130,19 +132,19 @@ lint.ignore = [ # Ignore unused params "ARG002", ] -lint.unfixable = [ +unfixable = [ # Don't touch unused imports "F401", ] exclude = ["example"] -[tool.ruff.isort] -known-first-party = ["src", "example", "tests"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] "example/**/*" = ["T201"] diff --git a/integrations/chroma/tests/test_document_store.py b/integrations/chroma/tests/test_document_store.py index 3a6952ff8..d33086945 100644 --- a/integrations/chroma/tests/test_document_store.py +++ b/integrations/chroma/tests/test_document_store.py @@ -3,10 +3,10 @@ # SPDX-License-Identifier: Apache-2.0 import logging import operator +import sys import uuid from typing import List from unittest import mock -import sys import numpy as np import pytest diff --git a/integrations/cohere/pyproject.toml b/integrations/cohere/pyproject.toml index add8dc150..d86165668 100644 --- a/integrations/cohere/pyproject.toml +++ b/integrations/cohere/pyproject.toml @@ -65,10 +65,10 @@ 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/}", + "ruff check {args:.}", "black --check --diff {args:.}", ] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.black] @@ -79,6 +79,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -127,13 +129,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/cohere/tests/test_cohere_chat_generator.py b/integrations/cohere/tests/test_cohere_chat_generator.py index fe9b7f43e..175a6d14b 100644 --- a/integrations/cohere/tests/test_cohere_chat_generator.py +++ b/integrations/cohere/tests/test_cohere_chat_generator.py @@ -7,6 +7,7 @@ from haystack.components.generators.utils import print_streaming_chunk from haystack.dataclasses import ChatMessage, ChatRole, StreamingChunk from haystack.utils import Secret + from haystack_integrations.components.generators.cohere import CohereChatGenerator pytestmark = pytest.mark.chat_generators diff --git a/integrations/cohere/tests/test_cohere_generator.py b/integrations/cohere/tests/test_cohere_generator.py index 736b6bfbf..60ee6ac93 100644 --- a/integrations/cohere/tests/test_cohere_generator.py +++ b/integrations/cohere/tests/test_cohere_generator.py @@ -7,6 +7,7 @@ from cohere.core import ApiError from haystack.components.generators.utils import print_streaming_chunk from haystack.utils import Secret + from haystack_integrations.components.generators.cohere import CohereGenerator pytestmark = pytest.mark.generators diff --git a/integrations/cohere/tests/test_cohere_ranker.py b/integrations/cohere/tests/test_cohere_ranker.py index 670e662d4..ff861b39d 100644 --- a/integrations/cohere/tests/test_cohere_ranker.py +++ b/integrations/cohere/tests/test_cohere_ranker.py @@ -4,6 +4,7 @@ import pytest from haystack import Document from haystack.utils.auth import Secret + from haystack_integrations.components.rankers.cohere import CohereRanker pytestmark = pytest.mark.ranker diff --git a/integrations/cohere/tests/test_document_embedder.py b/integrations/cohere/tests/test_document_embedder.py index ffbf280e9..d69e1a5a2 100644 --- a/integrations/cohere/tests/test_document_embedder.py +++ b/integrations/cohere/tests/test_document_embedder.py @@ -6,6 +6,7 @@ import pytest from haystack import Document from haystack.utils import Secret + from haystack_integrations.components.embedders.cohere import CohereDocumentEmbedder pytestmark = pytest.mark.embedders diff --git a/integrations/cohere/tests/test_text_embedder.py b/integrations/cohere/tests/test_text_embedder.py index b4f3e234c..80f7c1a3e 100644 --- a/integrations/cohere/tests/test_text_embedder.py +++ b/integrations/cohere/tests/test_text_embedder.py @@ -5,6 +5,7 @@ import pytest from haystack.utils import Secret + from haystack_integrations.components.embedders.cohere import CohereTextEmbedder pytestmark = pytest.mark.embedders 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 44d89cb11..5d81fa0a5 100644 --- a/integrations/deepeval/pyproject.toml +++ b/integrations/deepeval/pyproject.toml @@ -60,7 +60,7 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"] [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive {args:src/}" style = ["ruff check {args:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.black] @@ -71,6 +71,9 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 +exclude = ["example", "tests"] + +[tool.ruff.lint] select = [ "A", "ARG", @@ -121,15 +124,14 @@ unfixable = [ # Don't touch unused imports "F401", ] -extend-exclude = ["tests", "example"] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "all" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] 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/elasticsearch/pyproject.toml b/integrations/elasticsearch/pyproject.toml index 4e13b1c23..47b168f30 100644 --- a/integrations/elasticsearch/pyproject.toml +++ b/integrations/elasticsearch/pyproject.toml @@ -65,8 +65,8 @@ detached = true 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/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.hatch.metadata] @@ -80,6 +80,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -128,13 +130,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/fastembed/pyproject.toml b/integrations/fastembed/pyproject.toml index 4ebd765dd..69aba5562 100644 --- a/integrations/fastembed/pyproject.toml +++ b/integrations/fastembed/pyproject.toml @@ -66,8 +66,8 @@ detached = true dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243", "numpy"] [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 --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.black] @@ -78,6 +78,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -128,13 +130,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # examples can contain "print" commands diff --git a/integrations/google_ai/pyproject.toml b/integrations/google_ai/pyproject.toml index db958a487..d06e0a53f 100644 --- a/integrations/google_ai/pyproject.toml +++ b/integrations/google_ai/pyproject.toml @@ -64,7 +64,7 @@ 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:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.black] @@ -75,6 +75,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -123,13 +125,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/google_vertex/pyproject.toml b/integrations/google_vertex/pyproject.toml index 747bbecbf..a0cefbcd4 100644 --- a/integrations/google_vertex/pyproject.toml +++ b/integrations/google_vertex/pyproject.toml @@ -64,7 +64,7 @@ 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:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.black] @@ -75,6 +75,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -120,13 +122,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/instructor_embedders/pyproject.toml b/integrations/instructor_embedders/pyproject.toml index 017062a47..458c0ae0c 100644 --- a/integrations/instructor_embedders/pyproject.toml +++ b/integrations/instructor_embedders/pyproject.toml @@ -88,8 +88,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/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.coverage.run] @@ -105,6 +105,8 @@ exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"] [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -152,13 +154,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["instructor_embedders"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/jina/pyproject.toml b/integrations/jina/pyproject.toml index 908633686..cbd8df479 100644 --- a/integrations/jina/pyproject.toml +++ b/integrations/jina/pyproject.toml @@ -62,8 +62,8 @@ detached = true 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/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.black] @@ -74,6 +74,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -119,13 +121,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["jina_haystack"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] 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 6f9213be7..61de4596c 100644 --- a/integrations/langfuse/pyproject.toml +++ b/integrations/langfuse/pyproject.toml @@ -69,8 +69,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/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.hatch.metadata] @@ -84,7 +84,10 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -lint.select = [ +exclude = ["example", "tests"] + +[tool.ruff.lint] +select = [ "A", "ARG", "B", @@ -110,8 +113,7 @@ lint.select = [ "W", "YTT", ] - -lint.ignore = [ +ignore = [ # Allow non-abstract empty methods in abstract base classes "B027", # Ignore checks for possible passwords @@ -127,14 +129,13 @@ lint.ignore = [ # Asserts "S101", ] -lint.unfixable = [ +unfixable = [ # Don't touch unused imports "F401", ] -extend-exclude = ["tests", "example"] [tool.ruff.lint.isort] -known-first-party = ["src"] +known-first-party = ["haystack_integrations"] [tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" 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/llama_cpp/pyproject.toml b/integrations/llama_cpp/pyproject.toml index 4fe0d82b0..673df575a 100644 --- a/integrations/llama_cpp/pyproject.toml +++ b/integrations/llama_cpp/pyproject.toml @@ -70,15 +70,15 @@ 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 --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] allow-direct-references = true -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] [tool.black] target-version = ["py38"] @@ -88,6 +88,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -133,10 +135,10 @@ unfixable = [ "F401", ] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # Examples can print their output diff --git a/integrations/mistral/pyproject.toml b/integrations/mistral/pyproject.toml index 8e28c2c06..16f332331 100644 --- a/integrations/mistral/pyproject.toml +++ b/integrations/mistral/pyproject.toml @@ -65,10 +65,10 @@ 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/}", + "ruff check {args:}", "black --check --diff {args:.}", ] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.black] @@ -79,6 +79,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -127,13 +129,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/mistral/tests/test_mistral_chat_generator.py b/integrations/mistral/tests/test_mistral_chat_generator.py index 181397c00..3c95f19db 100644 --- a/integrations/mistral/tests/test_mistral_chat_generator.py +++ b/integrations/mistral/tests/test_mistral_chat_generator.py @@ -7,11 +7,12 @@ from haystack.components.generators.utils import print_streaming_chunk from haystack.dataclasses import ChatMessage, StreamingChunk from haystack.utils.auth import Secret -from haystack_integrations.components.generators.mistral.chat.chat_generator import MistralChatGenerator from openai import OpenAIError from openai.types.chat import ChatCompletion, ChatCompletionMessage from openai.types.chat.chat_completion import Choice +from haystack_integrations.components.generators.mistral.chat.chat_generator import MistralChatGenerator + @pytest.fixture def chat_messages(): diff --git a/integrations/mistral/tests/test_mistral_document_embedder.py b/integrations/mistral/tests/test_mistral_document_embedder.py index 6e5c11759..4e710e45d 100644 --- a/integrations/mistral/tests/test_mistral_document_embedder.py +++ b/integrations/mistral/tests/test_mistral_document_embedder.py @@ -6,6 +6,7 @@ import pytest from haystack import Document from haystack.utils import Secret + from haystack_integrations.components.embedders.mistral.document_embedder import MistralDocumentEmbedder pytestmark = pytest.mark.embedders diff --git a/integrations/mistral/tests/test_mistral_text_embedder.py b/integrations/mistral/tests/test_mistral_text_embedder.py index af004b022..175a96e0f 100644 --- a/integrations/mistral/tests/test_mistral_text_embedder.py +++ b/integrations/mistral/tests/test_mistral_text_embedder.py @@ -5,6 +5,7 @@ import pytest from haystack.utils import Secret + from haystack_integrations.components.embedders.mistral.text_embedder import MistralTextEmbedder pytestmark = pytest.mark.embedders diff --git a/integrations/mongodb_atlas/pyproject.toml b/integrations/mongodb_atlas/pyproject.toml index f8fcf4254..95ed6c03a 100644 --- a/integrations/mongodb_atlas/pyproject.toml +++ b/integrations/mongodb_atlas/pyproject.toml @@ -66,8 +66,8 @@ detached = true 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 --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.black] @@ -78,6 +78,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -126,13 +128,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # examples can contain "print" commands diff --git a/integrations/nvidia/pyproject.toml b/integrations/nvidia/pyproject.toml index 82fb32b95..b5c6dd205 100644 --- a/integrations/nvidia/pyproject.toml +++ b/integrations/nvidia/pyproject.toml @@ -67,10 +67,10 @@ 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/}", + "ruff check {args:}", "black --check --diff {args:.}", ] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.black] @@ -81,6 +81,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -129,13 +131,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index 1174d3b78..bc8555140 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -71,15 +71,15 @@ 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 --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] allow-direct-references = true -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] [tool.black] target-version = ["py38"] @@ -89,6 +89,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -134,10 +136,10 @@ unfixable = [ "F401", ] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # Examples can print their output diff --git a/integrations/opensearch/pyproject.toml b/integrations/opensearch/pyproject.toml index 6be86727e..24f1653bd 100644 --- a/integrations/opensearch/pyproject.toml +++ b/integrations/opensearch/pyproject.toml @@ -67,8 +67,8 @@ detached = true dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243", "boto3"] [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" -style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.hatch.metadata] @@ -82,6 +82,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -130,13 +132,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] 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 2e0fb26a4..305af6042 100644 --- a/integrations/optimum/pyproject.toml +++ b/integrations/optimum/pyproject.toml @@ -82,14 +82,14 @@ 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:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true [tool.ruff.lint.isort] -known-first-party = ["src"] +known-first-party = ["haystack_integrations"] [tool.black] target-version = ["py38"] @@ -99,6 +99,9 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 +exclude = ["example", "tests"] + +[tool.ruff.lint] select = [ "A", "ARG", @@ -145,7 +148,6 @@ unfixable = [ # Don't touch unused imports "F401", ] -extend-exclude = ["tests", "example"] [tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" 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/pgvector/pyproject.toml b/integrations/pgvector/pyproject.toml index 8f4c2447b..014d163bc 100644 --- a/integrations/pgvector/pyproject.toml +++ b/integrations/pgvector/pyproject.toml @@ -66,8 +66,8 @@ detached = true 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 --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.black] @@ -78,6 +78,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -128,13 +130,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # examples can contain "print" commands diff --git a/integrations/pinecone/pyproject.toml b/integrations/pinecone/pyproject.toml index 866385dd3..3f2e4d6bd 100644 --- a/integrations/pinecone/pyproject.toml +++ b/integrations/pinecone/pyproject.toml @@ -71,7 +71,7 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243", "numpy"] [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" style = ["ruff check {args:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.hatch.metadata] @@ -85,6 +85,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -133,13 +135,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # examples can contain "print" commands diff --git a/integrations/qdrant/pyproject.toml b/integrations/qdrant/pyproject.toml index 225844f22..898fd2dcf 100644 --- a/integrations/qdrant/pyproject.toml +++ b/integrations/qdrant/pyproject.toml @@ -62,8 +62,8 @@ detached = true 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 --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.black] @@ -74,6 +74,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -125,10 +127,10 @@ unfixable = [ "F401", ] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] # examples can contain "print" commands diff --git a/integrations/ragas/pyproject.toml b/integrations/ragas/pyproject.toml index d9ae6ca02..dd56e35f6 100644 --- a/integrations/ragas/pyproject.toml +++ b/integrations/ragas/pyproject.toml @@ -66,7 +66,7 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"] [tool.hatch.envs.lint.scripts] typing = "mypy --install-types --non-interactive {args:src/}" style = ["ruff check {args:.}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:.}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] all = ["style", "typing"] [tool.black] @@ -77,6 +77,9 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 +exclude = ["example", "tests"] + +[tool.ruff.lint] select = [ "A", "ARG", @@ -128,15 +131,14 @@ unfixable = [ # Don't touch unused imports "F401", ] -extend-exclude = ["tests", "example"] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "all" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] 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?", diff --git a/integrations/snowflake/pyproject.toml b/integrations/snowflake/pyproject.toml index 68f9ec477..355e9d090 100644 --- a/integrations/snowflake/pyproject.toml +++ b/integrations/snowflake/pyproject.toml @@ -62,8 +62,8 @@ detached = true 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/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.black] @@ -74,6 +74,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -123,13 +125,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["snowflake_haystack"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/snowflake/tests/test_snowflake_table_retriever.py b/integrations/snowflake/tests/test_snowflake_table_retriever.py index 547f7e1b1..f5b8fee37 100644 --- a/integrations/snowflake/tests/test_snowflake_table_retriever.py +++ b/integrations/snowflake/tests/test_snowflake_table_retriever.py @@ -10,9 +10,9 @@ import pytest from dateutil.tz import tzlocal from haystack import Pipeline +from haystack.components.builders import PromptBuilder from haystack.components.converters import OutputAdapter from haystack.components.generators import OpenAIGenerator -from haystack.components.builders import PromptBuilder from haystack.utils import Secret from openai.types.chat import ChatCompletion, ChatCompletionMessage from openai.types.chat.chat_completion import Choice @@ -478,7 +478,10 @@ def test_to_dict_default(self, monkeypatch: MagicMock) -> None: data = component.to_dict() assert data == { - "type": "haystack_integrations.components.retrievers.snowflake.snowflake_table_retriever.SnowflakeTableRetriever", + "type": ( + "haystack_integrations.components.retrievers.snowflake." + "snowflake_table_retriever.SnowflakeTableRetriever" + ), "init_parameters": { "api_key": { "env_vars": ["SNOWFLAKE_API_KEY"], @@ -510,7 +513,10 @@ def test_to_dict_with_parameters(self, monkeypatch: MagicMock) -> None: data = component.to_dict() assert data == { - "type": "haystack_integrations.components.retrievers.snowflake.snowflake_table_retriever.SnowflakeTableRetriever", + "type": ( + "haystack_integrations.components.retrievers.snowflake." + "snowflake_table_retriever.SnowflakeTableRetriever" + ), "init_parameters": { "api_key": { "env_vars": ["SNOWFLAKE_API_KEY"], diff --git a/integrations/unstructured/pyproject.toml b/integrations/unstructured/pyproject.toml index 6811753d9..88bd463b2 100644 --- a/integrations/unstructured/pyproject.toml +++ b/integrations/unstructured/pyproject.toml @@ -65,10 +65,10 @@ 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/}", + "ruff check {args:}", "black --check --diff {args:.}", ] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.hatch.metadata] @@ -82,6 +82,8 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 + +[tool.ruff.lint] select = [ "A", "ARG", @@ -130,13 +132,13 @@ unfixable = [ "F401", ] -[tool.ruff.isort] -known-first-party = ["src"] +[tool.ruff.lint.isort] +known-first-party = ["haystack_integrations"] -[tool.ruff.flake8-tidy-imports] +[tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports "tests/**/*" = ["PLR2004", "S101", "TID252"] diff --git a/integrations/unstructured/tests/test_converter.py b/integrations/unstructured/tests/test_converter.py index 5d1a6c091..063289b07 100644 --- a/integrations/unstructured/tests/test_converter.py +++ b/integrations/unstructured/tests/test_converter.py @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: Apache-2.0 import pytest + from haystack_integrations.components.converters.unstructured import UnstructuredFileConverter diff --git a/integrations/weaviate/pyproject.toml b/integrations/weaviate/pyproject.toml index 624a06f1d..22d3a160d 100644 --- a/integrations/weaviate/pyproject.toml +++ b/integrations/weaviate/pyproject.toml @@ -65,8 +65,8 @@ detached = true 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/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"] +style = ["ruff check {args:}", "black --check --diff {args:.}"] +fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] all = ["style", "typing"] [tool.black] @@ -77,7 +77,9 @@ skip-string-normalization = true [tool.ruff] target-version = "py38" line-length = 120 -lint.select = [ + +[tool.ruff.lint] +select = [ "A", "ARG", "B", @@ -104,7 +106,7 @@ lint.select = [ "W", "YTT", ] -lint.ignore = [ +ignore = [ # Allow non-abstract empty methods in abstract base classes "B027", # Allow boolean positional values in function calls, like `dict.get(... True)` @@ -120,13 +122,13 @@ lint.ignore = [ "PLR0913", "PLR0915", ] -lint.unfixable = [ +unfixable = [ # Don't touch unused imports "F401", ] [tool.ruff.lint.isort] -known-first-party = ["src"] +known-first-party = ["haystack_integrations"] [tool.ruff.lint.flake8-tidy-imports] ban-relative-imports = "parents"