From 75b48753f6d157517a6c95f1c065ecf98ce9cabc Mon Sep 17 00:00:00 2001 From: anakin87 Date: Wed, 4 Jun 2025 18:09:11 +0200 Subject: [PATCH 01/19] ollama draft --- integrations/ollama/pyproject.toml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index e38859e375..3eb1e8070f 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -47,31 +47,38 @@ git_describe_command = 'git describe --tags --match="integrations/ollama-v[0-9]* [tool.hatch.envs.default] installer = "uv" +dependencies = ["haystack-pydoc-tools"] + +[tool.hatch.envs.default.scripts] +docs = ["pydoc-markdown pydoc/config.yml"] + +[tool.hatch.envs.test] dependencies = [ "coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", - "haystack-pydoc-tools", + "mypy", + "pip" + ] -[tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + test-cov = "coverage run -m pytest {args:tests}" test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" cov-report = ["- coverage combine", "coverage report"] cov = ["test-cov", "cov-report"] cov-retry = ["test-cov-retry", "cov-report"] -docs = ["pydoc-markdown pydoc/config.yml"] [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true From 250d75baaa6af85a8ddd14f007f7f3fa380be88d Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 09:17:56 +0200 Subject: [PATCH 02/19] progress --- .github/workflows/ollama.yml | 8 +++---- integrations/ollama/pyproject.toml | 15 +++++++------ .../embedders/ollama/document_embedder.py | 2 +- .../embedders/ollama/text_embedder.py | 2 +- .../generators/ollama/chat/chat_generator.py | 22 +++++++++++-------- .../components/generators/ollama/generator.py | 14 +++++++----- .../ollama/tests/test_chat_generator.py | 1 - 7 files changed, 35 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ollama.yml b/.github/workflows/ollama.yml index ec24e3def0..5f3c6db608 100644 --- a/.github/workflows/ollama.yml +++ b/.github/workflows/ollama.yml @@ -86,27 +86,27 @@ jobs: - name: Lint if: matrix.python-version == '3.9' - run: hatch run lint:all + run: hatch fmt --check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index 3eb1e8070f..bdc70b7c01 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -54,8 +54,8 @@ docs = ["pydoc-markdown pydoc/config.yml"] [tool.hatch.envs.test] dependencies = [ - "coverage[toml]>=6.5", "pytest", + "pytest-cov", "pytest-rerunfailures", "mypy", "pip" @@ -66,19 +66,17 @@ dependencies = [ unit = 'pytest -m "not integration" {args:tests}' integration = 'pytest -m "integration" {args:tests}' all = 'pytest {args:tests}' -types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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}" [tool.hatch.metadata] allow-direct-references = true @@ -95,6 +93,9 @@ skip-string-normalization = true target-version = "py38" line-length = 120 +[tool.ruff.format] +docstring-code-line-length = 120 + [tool.ruff.lint] select = [ "A", diff --git a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py index 8d2f5f5059..8d187c6d34 100644 --- a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py +++ b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py @@ -21,7 +21,7 @@ class OllamaDocumentEmbedder: document_embedder = OllamaDocumentEmbedder() result = document_embedder.run([doc]) - print(result['documents'][0].embedding) + print(result["documents"][0].embedding) ``` """ diff --git a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py index b08b8bef3b..43f088c339 100644 --- a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py +++ b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py @@ -17,7 +17,7 @@ class OllamaTextEmbedder: embedder = OllamaTextEmbedder() result = embedder.run(text="What do llamas say once you have thanked them? No probllama!") - print(result['embedding']) + print(result["embedding"]) ``` """ diff --git a/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py b/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py index 55e313edea..a35cfb0ed4 100644 --- a/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py +++ b/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py @@ -135,15 +135,19 @@ class OllamaChatGenerator: from haystack_integrations.components.generators.ollama import OllamaChatGenerator from haystack.dataclasses import ChatMessage - generator = OllamaChatGenerator(model="zephyr", - url = "http://localhost:11434", - generation_kwargs={ - "num_predict": 100, - "temperature": 0.9, - }) - - messages = [ChatMessage.from_system("\nYou are a helpful, respectful and honest assistant"), - ChatMessage.from_user("What's Natural Language Processing?")] + generator = OllamaChatGenerator( + model="zephyr", + url="http://localhost:11434", + generation_kwargs={ + "num_predict": 100, + "temperature": 0.9, + }, + ) + + messages = [ + ChatMessage.from_system("\nYou are a helpful, respectful and honest assistant"), + ChatMessage.from_user("What's Natural Language Processing?"), + ] print(generator.run(messages=messages)) ``` diff --git a/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py b/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py index d476c6bcfd..8973889936 100644 --- a/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py +++ b/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py @@ -83,12 +83,14 @@ class OllamaGenerator: ```python from haystack_integrations.components.generators.ollama import OllamaGenerator - generator = OllamaGenerator(model="zephyr", - url = "http://localhost:11434", - generation_kwargs={ - "num_predict": 100, - "temperature": 0.9, - }) + generator = OllamaGenerator( + model="zephyr", + url="http://localhost:11434", + generation_kwargs={ + "num_predict": 100, + "temperature": 0.9, + }, + ) print(generator.run("Who is the best American actor?")) ``` diff --git a/integrations/ollama/tests/test_chat_generator.py b/integrations/ollama/tests/test_chat_generator.py index 58842e32b7..2e9404ba0b 100644 --- a/integrations/ollama/tests/test_chat_generator.py +++ b/integrations/ollama/tests/test_chat_generator.py @@ -212,7 +212,6 @@ def test_init(self, tools): } def test_init_fail_with_duplicate_tool_names(self, tools): - duplicate_tools = [tools[0], tools[0]] with pytest.raises(ValueError): OllamaChatGenerator(tools=duplicate_tools) From afd2a11c70fe0ea9bd1ec18fc2970415b84f0a4a Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 11:10:40 +0200 Subject: [PATCH 03/19] improvs --- .github/workflows/ollama.yml | 2 +- integrations/ollama/pyproject.toml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ollama.yml b/.github/workflows/ollama.yml index 5f3c6db608..4383187271 100644 --- a/.github/workflows/ollama.yml +++ b/.github/workflows/ollama.yml @@ -86,7 +86,7 @@ jobs: - name: Lint if: matrix.python-version == '3.9' - run: hatch fmt --check && hatch run lint:typing + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index bdc70b7c01..d1dd993ec6 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -47,10 +47,11 @@ git_describe_command = 'git describe --tags --match="integrations/ollama-v[0-9]* [tool.hatch.envs.default] installer = "uv" -dependencies = ["haystack-pydoc-tools"] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] docs = ["pydoc-markdown pydoc/config.yml"] +fmt [tool.hatch.envs.test] dependencies = [ From 8a91999c40aee407d9ae2d708d1e1c50aae0c411 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 11:13:08 +0200 Subject: [PATCH 04/19] revert some changes --- integrations/ollama/pyproject.toml | 6 ++--- .../embedders/ollama/document_embedder.py | 2 +- .../embedders/ollama/text_embedder.py | 2 +- .../generators/ollama/chat/chat_generator.py | 22 ++++++++----------- .../components/generators/ollama/generator.py | 14 +++++------- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index d1dd993ec6..43a2b3816e 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -51,7 +51,8 @@ dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] docs = ["pydoc-markdown pydoc/config.yml"] -fmt +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" [tool.hatch.envs.test] dependencies = [ @@ -94,9 +95,6 @@ skip-string-normalization = true target-version = "py38" line-length = 120 -[tool.ruff.format] -docstring-code-line-length = 120 - [tool.ruff.lint] select = [ "A", diff --git a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py index 8d187c6d34..8d2f5f5059 100644 --- a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py +++ b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/document_embedder.py @@ -21,7 +21,7 @@ class OllamaDocumentEmbedder: document_embedder = OllamaDocumentEmbedder() result = document_embedder.run([doc]) - print(result["documents"][0].embedding) + print(result['documents'][0].embedding) ``` """ diff --git a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py index 43f088c339..b08b8bef3b 100644 --- a/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py +++ b/integrations/ollama/src/haystack_integrations/components/embedders/ollama/text_embedder.py @@ -17,7 +17,7 @@ class OllamaTextEmbedder: embedder = OllamaTextEmbedder() result = embedder.run(text="What do llamas say once you have thanked them? No probllama!") - print(result["embedding"]) + print(result['embedding']) ``` """ diff --git a/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py b/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py index a35cfb0ed4..55e313edea 100644 --- a/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py +++ b/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/chat_generator.py @@ -135,19 +135,15 @@ class OllamaChatGenerator: from haystack_integrations.components.generators.ollama import OllamaChatGenerator from haystack.dataclasses import ChatMessage - generator = OllamaChatGenerator( - model="zephyr", - url="http://localhost:11434", - generation_kwargs={ - "num_predict": 100, - "temperature": 0.9, - }, - ) - - messages = [ - ChatMessage.from_system("\nYou are a helpful, respectful and honest assistant"), - ChatMessage.from_user("What's Natural Language Processing?"), - ] + generator = OllamaChatGenerator(model="zephyr", + url = "http://localhost:11434", + generation_kwargs={ + "num_predict": 100, + "temperature": 0.9, + }) + + messages = [ChatMessage.from_system("\nYou are a helpful, respectful and honest assistant"), + ChatMessage.from_user("What's Natural Language Processing?")] print(generator.run(messages=messages)) ``` diff --git a/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py b/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py index 8973889936..d476c6bcfd 100644 --- a/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py +++ b/integrations/ollama/src/haystack_integrations/components/generators/ollama/generator.py @@ -83,14 +83,12 @@ class OllamaGenerator: ```python from haystack_integrations.components.generators.ollama import OllamaGenerator - generator = OllamaGenerator( - model="zephyr", - url="http://localhost:11434", - generation_kwargs={ - "num_predict": 100, - "temperature": 0.9, - }, - ) + generator = OllamaGenerator(model="zephyr", + url = "http://localhost:11434", + generation_kwargs={ + "num_predict": 100, + "temperature": 0.9, + }) print(generator.run("Who is the best American actor?")) ``` From 6eaf34c18051dfc30095d419714c2f9132b4df9c Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 11:15:23 +0200 Subject: [PATCH 05/19] fix --- integrations/ollama/pyproject.toml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index 2e6cf4f8a9..8714ce9ddb 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -47,18 +47,8 @@ git_describe_command = 'git describe --tags --match="integrations/ollama-v[0-9]* [tool.hatch.envs.default] installer = "uv" -<<<<<<< HEAD dependencies = ["haystack-pydoc-tools", "ruff"] -======= -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] ->>>>>>> main [tool.hatch.envs.default.scripts] docs = ["pydoc-markdown pydoc/config.yml"] fmt = "ruff check --fix {args} && ruff format {args}" From c5b4fc0101f913854886d1b32e3a47bd174fc65f Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 11:16:12 +0200 Subject: [PATCH 06/19] asyncio needed --- integrations/ollama/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index 8714ce9ddb..095d788c11 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -57,6 +57,7 @@ fmt-check = "ruff check {args} && ruff format --check {args}" [tool.hatch.envs.test] dependencies = [ "pytest", + "pytest-asyncio", "pytest-cov", "pytest-rerunfailures", "mypy", From 5a21dc3cd8b894bd60c4442cc8d051eab229eefe Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 11:23:13 +0200 Subject: [PATCH 07/19] explanatory comments --- .github/workflows/ollama.yml | 2 ++ integrations/ollama/pyproject.toml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/ollama.yml b/.github/workflows/ollama.yml index 4383187271..0ff36cbda5 100644 --- a/.github/workflows/ollama.yml +++ b/.github/workflows/ollama.yml @@ -84,6 +84,8 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' run: hatch run fmt-check && hatch run lint:typing diff --git a/integrations/ollama/pyproject.toml b/integrations/ollama/pyproject.toml index 095d788c11..0057494e3a 100644 --- a/integrations/ollama/pyproject.toml +++ b/integrations/ollama/pyproject.toml @@ -73,6 +73,9 @@ cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true From df28d7ffe99f2388a08c28431af01aef8b40f8b1 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 14:52:48 +0200 Subject: [PATCH 08/19] try anthropic --- .github/workflows/anthropic.yml | 4 ++- integrations/anthropic/pyproject.toml | 45 ++++++++++++++++----------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/anthropic.yml b/.github/workflows/anthropic.yml index be0c113ba0..bb89d02c28 100644 --- a/.github/workflows/anthropic.yml +++ b/.github/workflows/anthropic.yml @@ -50,9 +50,11 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Run tests run: hatch run cov-retry diff --git a/integrations/anthropic/pyproject.toml b/integrations/anthropic/pyproject.toml index 0b03b519c2..04eb88f184 100644 --- a/integrations/anthropic/pyproject.toml +++ b/integrations/anthropic/pyproject.toml @@ -43,35 +43,42 @@ git_describe_command = 'git describe --tags --match="integrations/anthropic-v[0- [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "haystack-pydoc-tools", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] - -all = ["style", "typing"] - [tool.black] target-version = ["py38"] line-length = 120 From 8df11a20eb3340543f3a77b0689fbed883a045da Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 14:56:10 +0200 Subject: [PATCH 09/19] fmt --- .../example/documentation_rag_with_claude.py | 6 +----- .../generators/anthropic/generator.py | 1 - .../anthropic/tests/test_chat_generator.py | 20 +++++++++---------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/integrations/anthropic/example/documentation_rag_with_claude.py b/integrations/anthropic/example/documentation_rag_with_claude.py index 134acd38c6..359f45ec15 100644 --- a/integrations/anthropic/example/documentation_rag_with_claude.py +++ b/integrations/anthropic/example/documentation_rag_with_claude.py @@ -13,11 +13,7 @@ messages = [ ChatMessage.from_system("You are a prompt expert who answers questions based on the given documents."), ChatMessage.from_user( - "Here are the documents:\n" - "{% for d in documents %} \n" - " {{d.content}} \n" - "{% endfor %}" - "\nAnswer: {{query}}" + "Here are the documents:\n{% for d in documents %} \n {{d.content}} \n{% endfor %}\nAnswer: {{query}}" ), ] diff --git a/integrations/anthropic/src/haystack_integrations/components/generators/anthropic/generator.py b/integrations/anthropic/src/haystack_integrations/components/generators/anthropic/generator.py index 1dfd017e24..9147d2c136 100644 --- a/integrations/anthropic/src/haystack_integrations/components/generators/anthropic/generator.py +++ b/integrations/anthropic/src/haystack_integrations/components/generators/anthropic/generator.py @@ -218,7 +218,6 @@ def run( ) # if streaming is disabled, the response is an Anthropic Message elif isinstance(response, Message): - completions = [ content_block.text for content_block in response.content if isinstance(content_block, TextBlock) ] diff --git a/integrations/anthropic/tests/test_chat_generator.py b/integrations/anthropic/tests/test_chat_generator.py index bf16e54dec..acc1b994e6 100644 --- a/integrations/anthropic/tests/test_chat_generator.py +++ b/integrations/anthropic/tests/test_chat_generator.py @@ -67,7 +67,6 @@ def mock_anthropic_completion(): class TestAnthropicChatGenerator: - def test_init_default(self, monkeypatch): """ Test the default initialization of the AnthropicChatGenerator component. @@ -586,17 +585,17 @@ def test_serde_in_pipeline(self): # add outputs_to_string, inputs_from_state and outputs_to_state tool parameters for compatibility with # haystack-ai>=2.12.0 if hasattr(tool, "outputs_to_string"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_string" - ] = tool.outputs_to_string + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_string"] = ( + tool.outputs_to_string + ) if hasattr(tool, "inputs_from_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "inputs_from_state" - ] = tool.inputs_from_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["inputs_from_state"] = ( + tool.inputs_from_state + ) if hasattr(tool, "outputs_to_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_state" - ] = tool.outputs_to_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_state"] = ( + tool.outputs_to_state + ) assert pipeline_dict == expected_dict @@ -1152,7 +1151,6 @@ def test_prompt_caching_live_run(self, cache_enabled): class TestAnthropicChatGeneratorAsync: - @pytest.fixture async def mock_anthropic_completion_async(self): with patch("anthropic.resources.messages.AsyncMessages.create") as mock_anthropic: From 9fad719f2c777e3f9238e8ed8e8a9365877b42b3 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 15:00:24 +0200 Subject: [PATCH 10/19] update --- .github/workflows/anthropic.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/anthropic.yml b/.github/workflows/anthropic.yml index bb89d02c28..7971628875 100644 --- a/.github/workflows/anthropic.yml +++ b/.github/workflows/anthropic.yml @@ -57,20 +57,20 @@ jobs: run: hatch run fmt-check && hatch run lint:typing - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' From 6c4670bf87981d0b5974b75d5ee9f766435b8240 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 15:34:27 +0200 Subject: [PATCH 11/19] more --- .github/workflows/amazon_bedrock.yml | 12 +++-- .github/workflows/amazon_sagemaker.yml | 10 ++-- .github/workflows/astra.yml | 10 ++-- .github/workflows/azure_ai_search.yml | 12 +++-- .github/workflows/chroma.yml | 10 ++-- .github/workflows/cohere.yml | 10 ++-- .github/workflows/deepeval.yml | 10 ++-- .github/workflows/elasticsearch.yml | 12 +++-- .github/workflows/fastembed.yml | 12 +++-- .github/workflows/github.yml | 10 ++-- .github/workflows/google_ai.yml | 10 ++-- .github/workflows/google_genai.yml | 10 ++-- .github/workflows/google_vertex.yml | 10 ++-- .github/workflows/instructor_embedders.yml | 13 ++++-- .github/workflows/jina.yml | 10 ++-- .github/workflows/langfuse.yml | 10 ++-- .github/workflows/llama_cpp.yml | 10 ++-- .github/workflows/mcp.yml | 8 ++-- .github/workflows/meta_llama.yml | 10 ++-- .github/workflows/mistral.yml | 10 ++-- .github/workflows/mongodb_atlas.yml | 11 +++-- .github/workflows/nvidia.yml | 10 ++-- .github/workflows/ollama.yml | 2 +- .github/workflows/openrouter.yml | 10 ++-- .github/workflows/opensearch.yml | 12 +++-- .github/workflows/optimum.yml | 10 ++-- .github/workflows/pgvector.yml | 12 +++-- .github/workflows/pinecone.yml | 8 ++-- .github/workflows/qdrant.yml | 10 ++-- .github/workflows/ragas.yml | 10 ++-- .github/workflows/snowflake.yml | 10 ++-- .github/workflows/stackit.yml | 10 ++-- .github/workflows/unstructured.yml | 12 +++-- .github/workflows/weaviate.yml | 10 ++-- .../workflows/weights_and_biases_weave.yml | 10 ++-- integrations/amazon_bedrock/pyproject.toml | 40 +++++++++------- integrations/amazon_sagemaker/README.md | 2 +- .../cohere/examples/cohere_generation.py | 2 +- integrations/cohere/pyproject.toml | 45 ++++++++++-------- .../cohere/tests/test_chat_generator.py | 1 - integrations/cohere/tests/test_ranker.py | 8 ++-- integrations/google_genai/pyproject.toml | 42 ++++++++++------- .../google_genai/tests/test_chat_generator.py | 8 ++-- integrations/mistral/pyproject.toml | 46 +++++++++++-------- .../tests/test_mistral_chat_generator.py | 18 ++++---- integrations/nvidia/README.md | 2 +- 46 files changed, 332 insertions(+), 238 deletions(-) diff --git a/.github/workflows/amazon_bedrock.yml b/.github/workflows/amazon_bedrock.yml index 433a5bc899..01bcd6938e 100644 --- a/.github/workflows/amazon_bedrock.yml +++ b/.github/workflows/amazon_bedrock.yml @@ -54,16 +54,18 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run unit tests - run: hatch run cov-retry -m "not integration" + run: hatch run test:unit # Do not authenticate on pull requests from forks - name: AWS authentication @@ -76,20 +78,20 @@ jobs: - name: Run integration tests if: success() && steps.aws-auth.outcome == 'success' - run: hatch run cov-retry -m "integration" + run: hatch run test:cov-retry -m "integration" - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/amazon_sagemaker.yml b/.github/workflows/amazon_sagemaker.yml index 09ccbf2b95..1f58f04c36 100644 --- a/.github/workflows/amazon_sagemaker.yml +++ b/.github/workflows/amazon_sagemaker.yml @@ -49,29 +49,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/astra.yml b/.github/workflows/astra.yml index c047dcb892..7c109549de 100644 --- a/.github/workflows/astra.yml +++ b/.github/workflows/astra.yml @@ -50,9 +50,11 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' @@ -62,20 +64,20 @@ jobs: env: ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/azure_ai_search.yml b/.github/workflows/azure_ai_search.yml index 7992587ded..7b87280b91 100644 --- a/.github/workflows/azure_ai_search.yml +++ b/.github/workflows/azure_ai_search.yml @@ -47,29 +47,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/chroma.yml b/.github/workflows/chroma.yml index eb362f47f4..27bc6e1332 100644 --- a/.github/workflows/chroma.yml +++ b/.github/workflows/chroma.yml @@ -49,9 +49,11 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' @@ -62,20 +64,20 @@ jobs: run: hatch run chroma run & - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/cohere.yml b/.github/workflows/cohere.yml index a261ff301d..7601d7debd 100644 --- a/.github/workflows/cohere.yml +++ b/.github/workflows/cohere.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/deepeval.yml b/.github/workflows/deepeval.yml index ea5a78c264..a41ed603d5 100644 --- a/.github/workflows/deepeval.yml +++ b/.github/workflows/deepeval.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/elasticsearch.yml b/.github/workflows/elasticsearch.yml index ee46f4947c..b96e82603a 100644 --- a/.github/workflows/elasticsearch.yml +++ b/.github/workflows/elasticsearch.yml @@ -44,9 +44,11 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Run ElasticSearch container run: docker compose up -d @@ -56,20 +58,20 @@ jobs: run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/fastembed.yml b/.github/workflows/fastembed.yml index dce6ef98f8..0b01a19bfb 100644 --- a/.github/workflows/fastembed.yml +++ b/.github/workflows/fastembed.yml @@ -34,29 +34,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index 21c9ba44a1..6b0917ed10 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -49,29 +49,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/google_ai.yml b/.github/workflows/google_ai.yml index c9c427bfb9..d1d7f78673 100644 --- a/.github/workflows/google_ai.yml +++ b/.github/workflows/google_ai.yml @@ -51,29 +51,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/google_genai.yml b/.github/workflows/google_genai.yml index 0d69060b07..c5691caf82 100644 --- a/.github/workflows/google_genai.yml +++ b/.github/workflows/google_genai.yml @@ -51,29 +51,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/google_vertex.yml b/.github/workflows/google_vertex.yml index 0805c5192d..aed09ae71e 100644 --- a/.github/workflows/google_vertex.yml +++ b/.github/workflows/google_vertex.yml @@ -49,28 +49,30 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/instructor_embedders.yml b/.github/workflows/instructor_embedders.yml index ea693c9eaf..2a472dd292 100644 --- a/.github/workflows/instructor_embedders.yml +++ b/.github/workflows/instructor_embedders.yml @@ -27,29 +27,32 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup Python + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/jina.yml b/.github/workflows/jina.yml index 80a9c1d76b..100afbae87 100644 --- a/.github/workflows/jina.yml +++ b/.github/workflows/jina.yml @@ -49,29 +49,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/langfuse.yml b/.github/workflows/langfuse.yml index 862847a2f8..5e7cfc493b 100644 --- a/.github/workflows/langfuse.yml +++ b/.github/workflows/langfuse.yml @@ -54,28 +54,30 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/llama_cpp.yml b/.github/workflows/llama_cpp.yml index e645f77287..f4f81b128f 100644 --- a/.github/workflows/llama_cpp.yml +++ b/.github/workflows/llama_cpp.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/mcp.yml b/.github/workflows/mcp.yml index 35bea0eafe..bb66569f2b 100644 --- a/.github/workflows/mcp.yml +++ b/.github/workflows/mcp.yml @@ -65,27 +65,27 @@ jobs: - name: Lint if: matrix.python-version == '3.10' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.10' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/meta_llama.yml b/.github/workflows/meta_llama.yml index 7a4a49bed9..87697ac52c 100644 --- a/.github/workflows/meta_llama.yml +++ b/.github/workflows/meta_llama.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/mistral.yml b/.github/workflows/mistral.yml index 553761bdd9..a92d62eb33 100644 --- a/.github/workflows/mistral.yml +++ b/.github/workflows/mistral.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/mongodb_atlas.yml b/.github/workflows/mongodb_atlas.yml index 5b75c2afe1..0e1c676981 100644 --- a/.github/workflows/mongodb_atlas.yml +++ b/.github/workflows/mongodb_atlas.yml @@ -46,30 +46,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - working-directory: integrations/mongodb_atlas if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/nvidia.yml b/.github/workflows/nvidia.yml index 24a9b7db64..280269c616 100644 --- a/.github/workflows/nvidia.yml +++ b/.github/workflows/nvidia.yml @@ -51,12 +51,14 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' @@ -66,14 +68,14 @@ jobs: run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/ollama.yml b/.github/workflows/ollama.yml index 0ff36cbda5..75ee410e09 100644 --- a/.github/workflows/ollama.yml +++ b/.github/workflows/ollama.yml @@ -87,7 +87,7 @@ jobs: # TODO: Once this integration is properly typed, use hatch run test:types # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' + if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run fmt-check && hatch run lint:typing - name: Generate docs diff --git a/.github/workflows/openrouter.yml b/.github/workflows/openrouter.yml index 46a4b4768f..b6d5e8d127 100644 --- a/.github/workflows/openrouter.yml +++ b/.github/workflows/openrouter.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/opensearch.yml b/.github/workflows/opensearch.yml index 59f4207fde..d40bf4493e 100644 --- a/.github/workflows/opensearch.yml +++ b/.github/workflows/opensearch.yml @@ -44,9 +44,11 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Run opensearch container run: docker compose up -d @@ -56,20 +58,20 @@ jobs: run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/optimum.yml b/.github/workflows/optimum.yml index 8692888e9c..b2621a2818 100644 --- a/.github/workflows/optimum.yml +++ b/.github/workflows/optimum.yml @@ -49,29 +49,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/pgvector.yml b/.github/workflows/pgvector.yml index ff1f553731..d56bceeb97 100644 --- a/.github/workflows/pgvector.yml +++ b/.github/workflows/pgvector.yml @@ -53,29 +53,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/pinecone.yml b/.github/workflows/pinecone.yml index b3ede5191f..2deccb5d84 100644 --- a/.github/workflows/pinecone.yml +++ b/.github/workflows/pinecone.yml @@ -54,7 +54,7 @@ jobs: - name: Lint working-directory: integrations/pinecone - if: matrix.python-version == '3.9' + if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run lint:all - name: Generate docs @@ -64,20 +64,20 @@ jobs: - name: Run tests env: INDEX_NAME: ${{ matrix.INDEX_NAME }} - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/qdrant.yml b/.github/workflows/qdrant.yml index b2a7fdc2f3..af4d627fbd 100644 --- a/.github/workflows/qdrant.yml +++ b/.github/workflows/qdrant.yml @@ -49,29 +49,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/ragas.yml b/.github/workflows/ragas.yml index de52e753be..2249870296 100644 --- a/.github/workflows/ragas.yml +++ b/.github/workflows/ragas.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/snowflake.yml b/.github/workflows/snowflake.yml index 5d8373d5eb..11c13a667a 100644 --- a/.github/workflows/snowflake.yml +++ b/.github/workflows/snowflake.yml @@ -49,29 +49,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/stackit.yml b/.github/workflows/stackit.yml index 841b4f892d..d62f998c4d 100644 --- a/.github/workflows/stackit.yml +++ b/.github/workflows/stackit.yml @@ -50,29 +50,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/unstructured.yml b/.github/workflows/unstructured.yml index 083aebfa6b..680c392b01 100644 --- a/.github/workflows/unstructured.yml +++ b/.github/workflows/unstructured.yml @@ -61,29 +61,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint - if: matrix.python-version == '3.9' - run: hatch run lint:all + if: matrix.python-version == '3.9' && runner.os == 'Linux' + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/weaviate.yml b/.github/workflows/weaviate.yml index 5092acb012..44ae0022c8 100644 --- a/.github/workflows/weaviate.yml +++ b/.github/workflows/weaviate.yml @@ -44,9 +44,11 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Run Weaviate container run: docker compose up -d @@ -56,20 +58,20 @@ jobs: run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/.github/workflows/weights_and_biases_weave.yml b/.github/workflows/weights_and_biases_weave.yml index 15c928998c..8c9c759ced 100644 --- a/.github/workflows/weights_and_biases_weave.yml +++ b/.github/workflows/weights_and_biases_weave.yml @@ -46,29 +46,31 @@ jobs: - name: Install Hatch run: pip install --upgrade hatch + # TODO: Once this integration is properly typed, use hatch run test:types + # https://github.com/deepset-ai/haystack-core-integrations/issues/1771 - name: Lint if: matrix.python-version == '3.9' && runner.os == 'Linux' - run: hatch run lint:all + run: hatch run fmt-check && hatch run lint:typing - name: Generate docs if: matrix.python-version == '3.9' && runner.os == 'Linux' run: hatch run docs - name: Run tests - run: hatch run cov-retry + run: hatch run test:cov-retry - name: Run unit tests with lowest direct dependencies run: | hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt hatch run uv pip install -r requirements_lowest_direct.txt - hatch run test -m "not integration" + hatch run test:unit - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' run: | hatch env prune hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main - hatch run cov-retry -m "not integration" + hatch run test:unit - name: Send event to Datadog for nightly failures if: failure() && github.event_name == 'schedule' diff --git a/integrations/amazon_bedrock/pyproject.toml b/integrations/amazon_bedrock/pyproject.toml index faf9e19d7d..1475fb1d21 100644 --- a/integrations/amazon_bedrock/pyproject.toml +++ b/integrations/amazon_bedrock/pyproject.toml @@ -43,23 +43,34 @@ git_describe_command = 'git describe --tags --match="integrations/amazon_bedrock [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "haystack-pydoc-tools", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -67,9 +78,6 @@ dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/amazon_sagemaker/README.md b/integrations/amazon_sagemaker/README.md index 1ea01871d2..3afbca4f21 100644 --- a/integrations/amazon_sagemaker/README.md +++ b/integrations/amazon_sagemaker/README.md @@ -34,7 +34,7 @@ hatch run test To only run unit tests: ``` -hatch run test -m "not integration" +hatch run test:unit ``` To only run integration tests: diff --git a/integrations/cohere/examples/cohere_generation.py b/integrations/cohere/examples/cohere_generation.py index 3baec63273..c480c5714b 100644 --- a/integrations/cohere/examples/cohere_generation.py +++ b/integrations/cohere/examples/cohere_generation.py @@ -42,7 +42,7 @@ pipe.add_component("joiner", BranchJoiner(List[ChatMessage])) pipe.add_component("fc_llm", CohereChatGenerator(model="command-r")) pipe.add_component("validator", JsonSchemaValidator(json_schema=person_schema)) -pipe.add_component("adapter", OutputAdapter("{{chat_message}}", List[ChatMessage])), +(pipe.add_component("adapter", OutputAdapter("{{chat_message}}", List[ChatMessage])),) # And connect them pipe.connect("adapter", "joiner") pipe.connect("joiner", "fc_llm") diff --git a/integrations/cohere/pyproject.toml b/integrations/cohere/pyproject.toml index 71897aff80..07300ceff0 100644 --- a/integrations/cohere/pyproject.toml +++ b/integrations/cohere/pyproject.toml @@ -43,34 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/cohere-v[0-9]* [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/cohere/tests/test_chat_generator.py b/integrations/cohere/tests/test_chat_generator.py index e8068dae38..fe74f9e7b6 100644 --- a/integrations/cohere/tests/test_chat_generator.py +++ b/integrations/cohere/tests/test_chat_generator.py @@ -161,7 +161,6 @@ def test_finalize_streaming_message_without_tool_calls(self): class TestCohereChatGenerator: - def test_init_default(self, monkeypatch): monkeypatch.setenv("COHERE_API_KEY", "test-api-key") diff --git a/integrations/cohere/tests/test_ranker.py b/integrations/cohere/tests/test_ranker.py index 29cfc0989c..f95e3e71c7 100644 --- a/integrations/cohere/tests/test_ranker.py +++ b/integrations/cohere/tests/test_ranker.py @@ -160,8 +160,8 @@ def test_prepare_cohere_input_docs_default_separator(self, monkeypatch): content=f"document number {i}", meta={ "meta_field_1": f"meta_value_1 {i}", - "meta_field_2": f"meta_value_2 {i+5}", - "meta_field_3": f"meta_value_3 {i+15}", + "meta_field_2": f"meta_value_2 {i + 5}", + "meta_field_3": f"meta_value_3 {i + 15}", }, ) for i in range(5) @@ -185,8 +185,8 @@ def test_prepare_cohere_input_docs_custom_separator(self, monkeypatch): content=f"document number {i}", meta={ "meta_field_1": f"meta_value_1 {i}", - "meta_field_2": f"meta_value_2 {i+5}", - "meta_field_3": f"meta_value_3 {i+15}", + "meta_field_2": f"meta_value_2 {i + 5}", + "meta_field_3": f"meta_value_3 {i + 15}", }, ) for i in range(5) diff --git a/integrations/google_genai/pyproject.toml b/integrations/google_genai/pyproject.toml index 5923dc1924..f362746f9c 100644 --- a/integrations/google_genai/pyproject.toml +++ b/integrations/google_genai/pyproject.toml @@ -43,31 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/google_genai-v [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/google_genai/tests/test_chat_generator.py b/integrations/google_genai/tests/test_chat_generator.py index e94af67f4f..9cb2754e74 100644 --- a/integrations/google_genai/tests/test_chat_generator.py +++ b/integrations/google_genai/tests/test_chat_generator.py @@ -284,9 +284,9 @@ def test_live_run_with_toolset(self, tools): assert len(final_results["replies"]) == 1 final_message = final_results["replies"][0] assert final_message.text - assert ( - "paris" in final_message.text.lower() or "weather" in final_message.text.lower() - ), "Response does not contain Paris or weather" + assert "paris" in final_message.text.lower() or "weather" in final_message.text.lower(), ( + "Response does not contain Paris or weather" + ) @pytest.mark.skipif( not os.environ.get("GOOGLE_API_KEY", None), @@ -404,7 +404,7 @@ async def test_concurrent_async_calls(self): # Create multiple tasks tasks = [] for i in range(3): - messages = [ChatMessage.from_user(f"What's the capital of country number {i+1}? Just say the city name.")] + messages = [ChatMessage.from_user(f"What's the capital of country number {i + 1}? Just say the city name.")] task = component.run_async(messages) tasks.append(task) diff --git a/integrations/mistral/pyproject.toml b/integrations/mistral/pyproject.toml index a2d06e428b..3fe18b0a5e 100644 --- a/integrations/mistral/pyproject.toml +++ b/integrations/mistral/pyproject.toml @@ -43,35 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/mistral-v[0-9] [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "pytz", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/mistral/tests/test_mistral_chat_generator.py b/integrations/mistral/tests/test_mistral_chat_generator.py index 07998b8069..ac868505e5 100644 --- a/integrations/mistral/tests/test_mistral_chat_generator.py +++ b/integrations/mistral/tests/test_mistral_chat_generator.py @@ -476,17 +476,17 @@ def test_serde_in_pipeline(self, monkeypatch): # add outputs_to_string, inputs_from_state and outputs_to_state tool parameters for compatibility with # haystack-ai>=2.12.0 if hasattr(tool, "outputs_to_string"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_string" - ] = tool.outputs_to_string + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_string"] = ( + tool.outputs_to_string + ) if hasattr(tool, "inputs_from_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "inputs_from_state" - ] = tool.inputs_from_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["inputs_from_state"] = ( + tool.inputs_from_state + ) if hasattr(tool, "outputs_to_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_state" - ] = tool.outputs_to_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_state"] = ( + tool.outputs_to_state + ) assert pipeline_dict == expected_dict diff --git a/integrations/nvidia/README.md b/integrations/nvidia/README.md index 558c34d284..897febebf0 100644 --- a/integrations/nvidia/README.md +++ b/integrations/nvidia/README.md @@ -38,7 +38,7 @@ hatch run test To only run unit tests: ``` -hatch run test -m "not integration" +hatch run test:unit ``` To run the linters `ruff` and `mypy`: From 113bb208fbf18b125a91abebe2f7e03c6bf2817a Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 15:55:24 +0200 Subject: [PATCH 12/19] more --- integrations/chroma/pyproject.toml | 42 ++++++++++++------- .../document_stores/chroma/document_store.py | 3 +- integrations/elasticsearch/pyproject.toml | 42 +++++++++++-------- .../tests/test_document_store.py | 2 - integrations/weaviate/pyproject.toml | 36 +++++++++++----- 5 files changed, 78 insertions(+), 47 deletions(-) diff --git a/integrations/chroma/pyproject.toml b/integrations/chroma/pyproject.toml index 57e6438d8b..5b91852e27 100644 --- a/integrations/chroma/pyproject.toml +++ b/integrations/chroma/pyproject.toml @@ -43,22 +43,34 @@ git_describe_command = 'git describe --tags --match="integrations/chroma-v[0-9]* [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "databind-core<4.5.0", # FIXME: the latest 4.5.0 causes loops in pip resolver -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -69,11 +81,9 @@ dependencies = [ "ruff>=0.0.243", "numpy", # we need the stubs from the main package ] + [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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py b/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py index 75c563457a..d817ed1001 100644 --- a/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py +++ b/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py @@ -123,8 +123,7 @@ def _ensure_initialized(self): if self._metadata != self._collection.metadata: logger.warning( - "Collection already exists. " - "The `distance_function` and `metadata` parameters will be ignored." + "Collection already exists. The `distance_function` and `metadata` parameters will be ignored." ) else: self._collection = client.create_collection( diff --git a/integrations/elasticsearch/pyproject.toml b/integrations/elasticsearch/pyproject.toml index 8975f3d11c..fdbfa8f601 100644 --- a/integrations/elasticsearch/pyproject.toml +++ b/integrations/elasticsearch/pyproject.toml @@ -47,23 +47,34 @@ git_describe_command = 'git describe --tags --match="integrations/elasticsearch- [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "pytest-xdist", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -71,9 +82,6 @@ dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/elasticsearch/tests/test_document_store.py b/integrations/elasticsearch/tests/test_document_store.py index 31f7a82a01..d754579a30 100644 --- a/integrations/elasticsearch/tests/test_document_store.py +++ b/integrations/elasticsearch/tests/test_document_store.py @@ -342,7 +342,6 @@ def test_init_with_custom_mapping(self, mock_elasticsearch): @pytest.mark.integration class TestElasticsearchDocumentStoreAsync: - @pytest.fixture async def document_store(self, request): """ @@ -410,7 +409,6 @@ async def test_bm25_retrieval_async(self, document_store): @pytest.mark.asyncio async def test_embedding_retrieval_async(self, document_store): - # init document store docs = [ Document(content="Most similar document", embedding=[1.0, 1.0, 1.0, 1.0]), diff --git a/integrations/weaviate/pyproject.toml b/integrations/weaviate/pyproject.toml index 59f6e8dcfb..e638d85f4d 100644 --- a/integrations/weaviate/pyproject.toml +++ b/integrations/weaviate/pyproject.toml @@ -47,25 +47,41 @@ git_describe_command = 'git describe --tags --match="integrations/weaviate-v[0-9 [tool.hatch.envs.default] installer = "uv" -dependencies = ["coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", "ipython", "haystack-pydoc-tools"] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] From 4df9021dad345cac769e6838322711d820ee5b0a Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 15:58:20 +0200 Subject: [PATCH 13/19] another 5 --- integrations/google_vertex/pyproject.toml | 42 ++++++++++------- .../google_vertex/document_embedder.py | 2 +- .../google_vertex/tests/chat/test_gemini.py | 21 ++++----- .../google_vertex/tests/test_gemini.py | 2 - integrations/mongodb_atlas/pyproject.toml | 41 ++++++++++------- .../tests/test_document_store_async.py | 1 - integrations/nvidia/pyproject.toml | 45 +++++++++++-------- integrations/opensearch/pyproject.toml | 41 +++++++++-------- integrations/qdrant/pyproject.toml | 36 ++++++++++----- .../document_stores/qdrant/document_store.py | 1 - .../qdrant/migrate_to_sparse.py | 2 +- integrations/qdrant/tests/test_converters.py | 2 - .../qdrant/tests/test_document_store.py | 7 --- .../qdrant/tests/test_document_store_async.py | 4 -- 14 files changed, 136 insertions(+), 111 deletions(-) diff --git a/integrations/google_vertex/pyproject.toml b/integrations/google_vertex/pyproject.toml index 9722b6a7db..ffae0ac789 100644 --- a/integrations/google_vertex/pyproject.toml +++ b/integrations/google_vertex/pyproject.toml @@ -43,31 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/google_vertex- [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/google_vertex/src/haystack_integrations/components/embedders/google_vertex/document_embedder.py b/integrations/google_vertex/src/haystack_integrations/components/embedders/google_vertex/document_embedder.py index 9671743f44..b1022f506e 100755 --- a/integrations/google_vertex/src/haystack_integrations/components/embedders/google_vertex/document_embedder.py +++ b/integrations/google_vertex/src/haystack_integrations/components/embedders/google_vertex/document_embedder.py @@ -246,7 +246,7 @@ def run(self, documents: List[Document]): except Exception as e: logger.debug(f"Batch {batch_number} Error tokens, {e}") logger.debug(f"Batch {batch_number} Embedding by smaller batchers") - logger.debug(f"batch_size reduced to {math.ceil(batch_size/2)})") + logger.debug(f"batch_size reduced to {math.ceil(batch_size / 2)})") try: all_embeddings.extend( diff --git a/integrations/google_vertex/tests/chat/test_gemini.py b/integrations/google_vertex/tests/chat/test_gemini.py index 12d4a5ad51..74bb0c8180 100644 --- a/integrations/google_vertex/tests/chat/test_gemini.py +++ b/integrations/google_vertex/tests/chat/test_gemini.py @@ -84,11 +84,9 @@ def test_convert_chatmessage_to_google_content_invalid(): class TestVertexAIGeminiChatGenerator: - @patch("haystack_integrations.components.generators.google_vertex.chat.gemini.vertexai_init") @patch("haystack_integrations.components.generators.google_vertex.chat.gemini.GenerativeModel") def test_init(self, mock_vertexai_init, _mock_generative_model, tools): - generation_config = GenerationConfig( candidate_count=1, stop_sequences=["stop"], @@ -124,7 +122,6 @@ def test_init(self, mock_vertexai_init, _mock_generative_model, tools): @patch("haystack_integrations.components.generators.google_vertex.chat.gemini.vertexai_init") @patch("haystack_integrations.components.generators.google_vertex.chat.gemini.GenerativeModel") def test_to_dict(self, _mock_vertexai_init, _mock_generative_model): - gemini = VertexAIGeminiChatGenerator() assert gemini.to_dict() == { "type": "haystack_integrations.components.generators.google_vertex.chat.gemini.VertexAIGeminiChatGenerator", @@ -725,17 +722,17 @@ def test_serde_in_pipeline(self): # add outputs_to_string, inputs_from_state and outputs_to_state tool parameters for compatibility with # haystack-ai>=2.12.0 if hasattr(tool, "outputs_to_string"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_string" - ] = tool.outputs_to_string + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_string"] = ( + tool.outputs_to_string + ) if hasattr(tool, "inputs_from_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "inputs_from_state" - ] = tool.inputs_from_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["inputs_from_state"] = ( + tool.inputs_from_state + ) if hasattr(tool, "outputs_to_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_state" - ] = tool.outputs_to_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_state"] = ( + tool.outputs_to_state + ) assert pipeline_dict == expected_dict diff --git a/integrations/google_vertex/tests/test_gemini.py b/integrations/google_vertex/tests/test_gemini.py index a426316612..96703c1ab2 100644 --- a/integrations/google_vertex/tests/test_gemini.py +++ b/integrations/google_vertex/tests/test_gemini.py @@ -12,7 +12,6 @@ @patch("haystack_integrations.components.generators.google_vertex.gemini.vertexai_init") @patch("haystack_integrations.components.generators.google_vertex.gemini.GenerativeModel") def test_init(mock_vertexai_init, _mock_generative_model): - generation_config = GenerationConfig( candidate_count=1, stop_sequences=["stop"], @@ -48,7 +47,6 @@ def test_init_fails_with_tools_or_tool_config(): @patch("haystack_integrations.components.generators.google_vertex.gemini.vertexai_init") @patch("haystack_integrations.components.generators.google_vertex.gemini.GenerativeModel") def test_to_dict(_mock_vertexai_init, _mock_generative_model): - gemini = VertexAIGeminiGenerator() assert gemini.to_dict() == { "type": "haystack_integrations.components.generators.google_vertex.gemini.VertexAIGeminiGenerator", diff --git a/integrations/mongodb_atlas/pyproject.toml b/integrations/mongodb_atlas/pyproject.toml index 574036ab26..7c4f20878d 100644 --- a/integrations/mongodb_atlas/pyproject.toml +++ b/integrations/mongodb_atlas/pyproject.toml @@ -46,24 +46,34 @@ git_describe_command = 'git describe --tags --match="integrations/mongodb_atlas- [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "pytest-asyncio", - "ipython", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -71,9 +81,6 @@ dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/mongodb_atlas/tests/test_document_store_async.py b/integrations/mongodb_atlas/tests/test_document_store_async.py index f1924a2daa..94608e3dff 100644 --- a/integrations/mongodb_atlas/tests/test_document_store_async.py +++ b/integrations/mongodb_atlas/tests/test_document_store_async.py @@ -33,7 +33,6 @@ def test_init_is_lazy(_mock_client): @pytest.mark.skipif(not os.environ.get("MONGO_CONNECTION_STRING"), reason="No MongoDBAtlas connection string provided") @pytest.mark.integration class TestDocumentStoreAsync(FilterableDocsFixtureMixin): - @pytest.fixture async def document_store(self): database_name = "haystack_integration_test" diff --git a/integrations/nvidia/pyproject.toml b/integrations/nvidia/pyproject.toml index fb34c9f127..d9f176e5a5 100644 --- a/integrations/nvidia/pyproject.toml +++ b/integrations/nvidia/pyproject.toml @@ -43,34 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/nvidia-v[0-9]* [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "requests_mock", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/opensearch/pyproject.toml b/integrations/opensearch/pyproject.toml index 72751d9dd1..454d95989a 100644 --- a/integrations/opensearch/pyproject.toml +++ b/integrations/opensearch/pyproject.toml @@ -45,26 +45,34 @@ git_describe_command = 'git describe --tags --match="integrations/opensearch-v[0 [tool.hatch.envs.default] installer = "uv" +dependencies = ["haystack-pydoc-tools", "ruff"] + +[tool.hatch.envs.default.scripts] +docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "pytest-xdist", - "pytest-asyncio", - "haystack-pydoc-tools", - "boto3", + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" ] -[tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' -docs = ["pydoc-markdown pydoc/config.yml"] +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -72,9 +80,6 @@ dependencies = ["pip", "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:}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff check --fix {args:}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/qdrant/pyproject.toml b/integrations/qdrant/pyproject.toml index 381ff1de13..dde0b5ed7c 100644 --- a/integrations/qdrant/pyproject.toml +++ b/integrations/qdrant/pyproject.toml @@ -46,25 +46,41 @@ git_describe_command = 'git describe --tags --match="integrations/qdrant-v[0-9]* [tool.hatch.envs.default] installer = "uv" -dependencies = ["coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", "haystack-pydoc-tools", "pytest-asyncio"] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py b/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py index 357b5adb04..d2c4f30f5a 100644 --- a/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py +++ b/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/document_store.py @@ -1233,7 +1233,6 @@ async def _create_payload_index_async( """ if payload_fields_to_index is not None: for payload_index in payload_fields_to_index: - # self._async_client is initialized at this point # since _initialize_async_client() is called before this method is executed assert self._async_client is not None diff --git a/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/migrate_to_sparse.py b/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/migrate_to_sparse.py index 0af7096828..3204643804 100644 --- a/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/migrate_to_sparse.py +++ b/integrations/qdrant/src/haystack_integrations/document_stores/qdrant/migrate_to_sparse.py @@ -115,7 +115,7 @@ def migrate_to_sparse_embeddings_support(old_document_store: QdrantDocumentStore message = ( f"Points transmitted: {points_transmitted}/{total_points}\n" - f"Percent done {points_transmitted/total_points*100:.2f}%\n" + f"Percent done {points_transmitted / total_points * 100:.2f}%\n" f"Time elapsed: {time.time() - start:.2f} seconds\n" f"Time remaining: {(((time.time() - start) / points_transmitted) * points_remaining) / 60:.2f} minutes\n" f"Current offset: {next_page_offset}\n" diff --git a/integrations/qdrant/tests/test_converters.py b/integrations/qdrant/tests/test_converters.py index 566da49ab9..fc6ba784f2 100644 --- a/integrations/qdrant/tests/test_converters.py +++ b/integrations/qdrant/tests/test_converters.py @@ -14,7 +14,6 @@ def test_convert_id_is_deterministic(): def test_point_to_document_reverts_proper_structure_from_record_with_sparse(): - point = rest.Record( id="c7c62e8e-02b9-4ec6-9f88-46bd97b628b7", payload={ @@ -41,7 +40,6 @@ def test_point_to_document_reverts_proper_structure_from_record_with_sparse(): def test_point_to_document_reverts_proper_structure_from_record_without_sparse(): - point = rest.Record( id="c7c62e8e-02b9-4ec6-9f88-46bd97b628b7", payload={ diff --git a/integrations/qdrant/tests/test_document_store.py b/integrations/qdrant/tests/test_document_store.py index 1920aaf8c2..5335299f1b 100644 --- a/integrations/qdrant/tests/test_document_store.py +++ b/integrations/qdrant/tests/test_document_store.py @@ -210,7 +210,6 @@ def test_query_hybrid_fail_without_sparse_embedding(self, document_store): embedding = [0.1] * 768 with pytest.raises(QdrantStoreError): - document_store._query_hybrid( query_sparse_embedding=sparse_embedding, query_embedding=embedding, @@ -223,7 +222,6 @@ def test_query_hybrid_search_batch_failure(self): embedding = [0.1] * 768 with patch.object(document_store._client, "query_points", side_effect=Exception("query_points")): - with pytest.raises(QdrantStoreError): document_store._query_hybrid(query_sparse_embedding=sparse_embedding, query_embedding=embedding) @@ -237,7 +235,6 @@ def test_set_up_collection_with_existing_incompatible_collection(self): with patch.object(document_store._client, "collection_exists", return_value=True), patch.object( document_store._client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(QdrantStoreError, match="created outside of Haystack"): document_store._set_up_collection("test_collection", 768, False, "cosine", True, False) @@ -253,7 +250,6 @@ def test_set_up_collection_use_sparse_embeddings_true_without_named_vectors(self with patch.object(document_store._client, "collection_exists", return_value=True), patch.object( document_store._client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(QdrantStoreError, match="without sparse embedding vectors"): document_store._set_up_collection("test_collection", 768, False, "cosine", True, False) @@ -268,7 +264,6 @@ def test_set_up_collection_use_sparse_embeddings_false_with_named_vectors(self): with patch.object(document_store._client, "collection_exists", return_value=True), patch.object( document_store._client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(QdrantStoreError, match="with sparse embedding vectors"): document_store._set_up_collection("test_collection", 768, False, "cosine", False, False) @@ -285,7 +280,6 @@ def test_set_up_collection_with_distance_mismatch(self): with patch.object(document_store._client, "collection_exists", return_value=True), patch.object( document_store._client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(ValueError, match="different similarity"): document_store._set_up_collection("test_collection", 768, False, "cosine", False, False) @@ -301,6 +295,5 @@ def test_set_up_collection_with_dimension_mismatch(self): with patch.object(document_store._client, "collection_exists", return_value=True), patch.object( document_store._client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(ValueError, match="different vector size"): document_store._set_up_collection("test_collection", 768, False, "cosine", False, False) diff --git a/integrations/qdrant/tests/test_document_store_async.py b/integrations/qdrant/tests/test_document_store_async.py index caa4a33c54..fa141f8156 100644 --- a/integrations/qdrant/tests/test_document_store_async.py +++ b/integrations/qdrant/tests/test_document_store_async.py @@ -123,7 +123,6 @@ async def test_query_hybrid_fail_without_sparse_embedding_async(self, document_s embedding = [0.1] * 768 with pytest.raises(QdrantStoreError): - await document_store._query_hybrid_async( query_sparse_embedding=sparse_embedding, query_embedding=embedding, @@ -137,7 +136,6 @@ async def test_query_hybrid_search_batch_failure_async(self): embedding = [0.1] * 768 with patch.object(document_store._async_client, "query_points", side_effect=Exception("query_points")): - with pytest.raises(QdrantStoreError): await document_store._query_hybrid_async( query_sparse_embedding=sparse_embedding, query_embedding=embedding @@ -170,7 +168,6 @@ async def test_set_up_collection_with_existing_incompatible_collection_async(sel with patch.object(document_store._async_client, "collection_exists", return_value=True), patch.object( document_store._async_client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(QdrantStoreError, match="created outside of Haystack"): await document_store._set_up_collection_async("test_collection", 768, False, "cosine", True, False) @@ -187,7 +184,6 @@ async def test_set_up_collection_use_sparse_embeddings_true_without_named_vector with patch.object(document_store._async_client, "collection_exists", return_value=True), patch.object( document_store._async_client, "get_collection", return_value=mock_collection_info ): - with pytest.raises(QdrantStoreError, match="without sparse embedding vectors"): await document_store._set_up_collection_async("test_collection", 768, False, "cosine", True, False) From 07e6c8147bb06213927c884dcaeec63be1eb2d75 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 17:22:03 +0200 Subject: [PATCH 14/19] 10 more --- integrations/azure_ai_search/pyproject.toml | 44 ++++++++++------- .../azure_ai_search/document_store.py | 1 - .../tests/test_bm25_retriever.py | 1 - .../tests/test_embedding_retriever.py | 1 - .../tests/test_hybrid_retriever.py | 1 - integrations/github/pyproject.toml | 47 ++++++++++--------- integrations/google_ai/pyproject.toml | 42 ++++++++++------- .../tests/generators/chat/test_chat_gemini.py | 22 ++++----- integrations/jina/pyproject.toml | 36 ++++++++++---- integrations/langfuse/pyproject.toml | 42 ++++++++++------- integrations/optimum/pyproject.toml | 42 ++++++++++------- integrations/pgvector/pyproject.toml | 43 ++++++++++------- integrations/pgvector/tests/test_retrieval.py | 1 - .../pgvector/tests/test_retrieval_async.py | 1 - integrations/ragas/pyproject.toml | 45 +++++++++++------- integrations/snowflake/pyproject.toml | 36 ++++++++++---- integrations/unstructured/pyproject.toml | 45 ++++++++++-------- 17 files changed, 269 insertions(+), 181 deletions(-) diff --git a/integrations/azure_ai_search/pyproject.toml b/integrations/azure_ai_search/pyproject.toml index 80e72513b6..d4c7b0f15a 100644 --- a/integrations/azure_ai_search/pyproject.toml +++ b/integrations/azure_ai_search/pyproject.toml @@ -42,31 +42,41 @@ root = "../.." git_describe_command = 'git describe --tags --match="integrations/azure_ai_search-v[0-9]*"' [tool.hatch.envs.default] -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "pytest-xdist", - "haystack-pydoc-tools", -] +installer = "uv" +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] 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:src/}", "black --check --diff {args:.}"] -fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true @@ -138,7 +148,7 @@ ban-relative-imports = "parents" [tool.ruff.lint.per-file-ignores] # Tests can use magic values, assertions, and relative imports -"tests/**/*" = ["PLR2004", "S101", "TID252", "S311"] +"tests/**/*" = ["PLR2004", "S101", "TID252", "S311", "T201"] "example/**/*" = ["T201"] [tool.coverage.run] diff --git a/integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search/document_store.py b/integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search/document_store.py index 814caa9945..6f7e7aca81 100644 --- a/integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search/document_store.py +++ b/integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search/document_store.py @@ -85,7 +85,6 @@ class AzureAISearchDocumentStore: - def __init__( self, *, diff --git a/integrations/azure_ai_search/tests/test_bm25_retriever.py b/integrations/azure_ai_search/tests/test_bm25_retriever.py index 00f1cc7db5..d0dc82ae3c 100644 --- a/integrations/azure_ai_search/tests/test_bm25_retriever.py +++ b/integrations/azure_ai_search/tests/test_bm25_retriever.py @@ -154,7 +154,6 @@ def test_run_time_params(): ) @pytest.mark.integration class TestRetriever: - def test_run(self, document_store: AzureAISearchDocumentStore): docs = [Document(id="1", content="Test document")] document_store.write_documents(docs) diff --git a/integrations/azure_ai_search/tests/test_embedding_retriever.py b/integrations/azure_ai_search/tests/test_embedding_retriever.py index 12da2208e3..006f41b5b3 100644 --- a/integrations/azure_ai_search/tests/test_embedding_retriever.py +++ b/integrations/azure_ai_search/tests/test_embedding_retriever.py @@ -169,7 +169,6 @@ def test_run_time_params(): ) @pytest.mark.integration class TestRetriever: - def test_run(self, document_store: AzureAISearchDocumentStore): docs = [Document(id="1")] document_store.write_documents(docs) diff --git a/integrations/azure_ai_search/tests/test_hybrid_retriever.py b/integrations/azure_ai_search/tests/test_hybrid_retriever.py index 078b713bec..74d61c6cd9 100644 --- a/integrations/azure_ai_search/tests/test_hybrid_retriever.py +++ b/integrations/azure_ai_search/tests/test_hybrid_retriever.py @@ -175,7 +175,6 @@ def test_run_time_params(): ) @pytest.mark.integration class TestRetriever: - def test_run(self, document_store: AzureAISearchDocumentStore): docs = [Document(id="1")] document_store.write_documents(docs) diff --git a/integrations/github/pyproject.toml b/integrations/github/pyproject.toml index 48ea0034db..19105806b2 100644 --- a/integrations/github/pyproject.toml +++ b/integrations/github/pyproject.toml @@ -43,36 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/github-v[0-9]* [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "pytz", - ] - +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] -fix = "ruff check --fix" +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/google_ai/pyproject.toml b/integrations/google_ai/pyproject.toml index 5128aa8af0..4bd67b1a65 100644 --- a/integrations/google_ai/pyproject.toml +++ b/integrations/google_ai/pyproject.toml @@ -43,31 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/google_ai-v[0- [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/google_ai/tests/generators/chat/test_chat_gemini.py b/integrations/google_ai/tests/generators/chat/test_chat_gemini.py index c8bfe56928..349e14965a 100644 --- a/integrations/google_ai/tests/generators/chat/test_chat_gemini.py +++ b/integrations/google_ai/tests/generators/chat/test_chat_gemini.py @@ -339,17 +339,17 @@ def test_serde_in_pipeline(self, monkeypatch): # add outputs_to_string, inputs_from_state and outputs_to_state tool parameters for compatibility with # haystack-ai>=2.12.0 if hasattr(tool, "outputs_to_string"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_string" - ] = tool.outputs_to_string + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_string"] = ( + tool.outputs_to_string + ) if hasattr(tool, "inputs_from_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "inputs_from_state" - ] = tool.inputs_from_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["inputs_from_state"] = ( + tool.inputs_from_state + ) if hasattr(tool, "outputs_to_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_state" - ] = tool.outputs_to_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_state"] = ( + tool.outputs_to_state + ) assert pipeline_dict == expected_dict @@ -415,7 +415,6 @@ async def test_run_async(self): @pytest.mark.integration @pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set") def test_run_with_tools(self, tools): - gemini_chat = GoogleAIGeminiChatGenerator(model="gemini-2.0-flash-exp", tools=tools) user_message = [ChatMessage.from_user("What is the temperature in celsius in Berlin?")] response = gemini_chat.run(messages=user_message) @@ -452,7 +451,6 @@ def test_run_with_tools(self, tools): @pytest.mark.integration @pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set") async def test_run_with_tools_async(self, tools): - gemini_chat = GoogleAIGeminiChatGenerator(model="gemini-2.0-flash-exp", tools=tools) user_message = [ChatMessage.from_user("What is the temperature in celsius in Berlin?")] response = await gemini_chat.run_async(messages=user_message) @@ -488,7 +486,6 @@ async def test_run_with_tools_async(self, tools): @pytest.mark.integration @pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set") def test_run_with_tools_and_tool_config(self, tools): - def get_population(city: Annotated[str, "the city for which to get the population, e.g. 'Munich'"] = "Munich"): """A simple function to get the population for a location.""" return f"Population of {city}: 1,000,000" @@ -524,7 +521,6 @@ def get_population(city: Annotated[str, "the city for which to get the populatio @pytest.mark.integration @pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set") async def test_run_with_tools_and_tool_config_async(self, tools): - def get_population(city: Annotated[str, "the city for which to get the population, e.g. 'Munich'"] = "Munich"): """A simple function to get the population for a location.""" return f"Population of {city}: 1,000,000" diff --git a/integrations/jina/pyproject.toml b/integrations/jina/pyproject.toml index 78d41c535a..a3a993b439 100644 --- a/integrations/jina/pyproject.toml +++ b/integrations/jina/pyproject.toml @@ -45,25 +45,41 @@ git_describe_command = 'git describe --tags --match="integrations/jina-v[0-9]*"' [tool.hatch.envs.default] installer = "uv" -dependencies = ["coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", "haystack-pydoc-tools"] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/langfuse/pyproject.toml b/integrations/langfuse/pyproject.toml index e9c57e7fd2..a4e15a4832 100644 --- a/integrations/langfuse/pyproject.toml +++ b/integrations/langfuse/pyproject.toml @@ -43,23 +43,34 @@ git_describe_command = 'git describe --tags --match="integrations/langfuse-v[0-9 [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "anthropic-haystack", - "cohere-haystack" -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -72,9 +83,6 @@ dependencies = [ [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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/optimum/pyproject.toml b/integrations/optimum/pyproject.toml index a6eca7a964..b14163571d 100644 --- a/integrations/optimum/pyproject.toml +++ b/integrations/optimum/pyproject.toml @@ -54,23 +54,34 @@ git_describe_command = 'git describe --tags --match="integrations/optimum-v[0-9] [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "databind-core<4.5.0", - "setuptools", # FIXME: the latest 4.5.0 causes loops in pip resolver -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -78,9 +89,6 @@ dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/pgvector/pyproject.toml b/integrations/pgvector/pyproject.toml index 0df47728a9..9828b7ba79 100644 --- a/integrations/pgvector/pyproject.toml +++ b/integrations/pgvector/pyproject.toml @@ -43,32 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/pgvector-v[0-9 [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "ipython", - "haystack-pydoc-tools", - "pytest-asyncio", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/pgvector/tests/test_retrieval.py b/integrations/pgvector/tests/test_retrieval.py index 27bf2d2739..997126929f 100644 --- a/integrations/pgvector/tests/test_retrieval.py +++ b/integrations/pgvector/tests/test_retrieval.py @@ -13,7 +13,6 @@ @pytest.mark.integration class TestEmbeddingRetrieval: - @pytest.mark.parametrize("document_store", ["document_store", "document_store_w_hnsw_index"], indirect=True) def test_embedding_retrieval_cosine_similarity(self, document_store: PgvectorDocumentStore): query_embedding = [0.1] * 768 diff --git a/integrations/pgvector/tests/test_retrieval_async.py b/integrations/pgvector/tests/test_retrieval_async.py index 9781b224a4..4ee5eba4e9 100644 --- a/integrations/pgvector/tests/test_retrieval_async.py +++ b/integrations/pgvector/tests/test_retrieval_async.py @@ -14,7 +14,6 @@ @pytest.mark.integration @pytest.mark.asyncio class TestEmbeddingRetrievalAsync: - @pytest.mark.parametrize("document_store", ["document_store", "document_store_w_hnsw_index"], indirect=True) async def test_embedding_retrieval_cosine_similarity_async(self, document_store: PgvectorDocumentStore): query_embedding = [0.1] * 768 diff --git a/integrations/ragas/pyproject.toml b/integrations/ragas/pyproject.toml index e95520a694..c41f246e3d 100644 --- a/integrations/ragas/pyproject.toml +++ b/integrations/ragas/pyproject.toml @@ -43,32 +43,41 @@ git_describe_command = 'git describe --tags --match="integrations/ragas-v[0-9]*" [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "pytest-asyncio", - "pydantic" -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] +typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" [tool.black] target-version = ["py38"] diff --git a/integrations/snowflake/pyproject.toml b/integrations/snowflake/pyproject.toml index 89c06b7cdc..23dcae1aa7 100644 --- a/integrations/snowflake/pyproject.toml +++ b/integrations/snowflake/pyproject.toml @@ -44,25 +44,41 @@ git_describe_command = 'git describe --tags --match="integrations/snowflake-v[0- [tool.hatch.envs.default] installer = "uv" -dependencies = ["coverage[toml]>=6.5", "pytest-rerunfailures", "haystack-pydoc-tools", "pytest", "pytest-mock>=3.14.0"] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/unstructured/pyproject.toml b/integrations/unstructured/pyproject.toml index fdabb501d2..6584c92529 100644 --- a/integrations/unstructured/pyproject.toml +++ b/integrations/unstructured/pyproject.toml @@ -48,34 +48,41 @@ git_describe_command = 'git describe --tags --match="integrations/unstructured-v [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "pytest-xdist", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] + [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' + +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true From a4498723d294ffa5407200a4e5675494a0064f32 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 17:30:38 +0200 Subject: [PATCH 15/19] more --- integrations/amazon_sagemaker/pyproject.toml | 37 +++++++++------ integrations/astra/examples/example.py | 42 +++++++++-------- integrations/astra/pyproject.toml | 38 +++++++++------ .../astra/tests/test_embedding_retrieval.py | 1 - integrations/deepeval/pyproject.toml | 33 +++++++++---- .../components/evaluators/deepeval/metrics.py | 2 +- integrations/fastembed/pyproject.toml | 40 +++++++++------- .../instructor_embedders/pyproject.toml | 38 +++++++++------ integrations/langfuse/pyproject.toml | 4 +- integrations/llama_cpp/pyproject.toml | 39 +++++++++------- .../llama_cpp/tests/test_chat_generator.py | 3 -- integrations/mcp/examples/mcp_stdio_client.py | 1 - integrations/mcp/pyproject.toml | 46 ++++++++++--------- .../mcp/tests/test_mcp_integration.py | 6 +-- integrations/meta_llama/pyproject.toml | 44 ++++++++++-------- .../tests/test_llama_chat_generator.py | 18 ++++---- integrations/openrouter/pyproject.toml | 44 ++++++++++-------- .../tests/test_openrouter_chat_generator.py | 18 ++++---- integrations/stackit/pyproject.toml | 44 ++++++++++-------- .../example/hybrid_retrieval.py | 2 - .../weights_and_biases_weave/pyproject.toml | 33 +++++++++---- .../tests/test_tracer.py | 1 - 22 files changed, 304 insertions(+), 230 deletions(-) diff --git a/integrations/amazon_sagemaker/pyproject.toml b/integrations/amazon_sagemaker/pyproject.toml index 02fdaca259..244b808fa8 100644 --- a/integrations/amazon_sagemaker/pyproject.toml +++ b/integrations/amazon_sagemaker/pyproject.toml @@ -46,31 +46,38 @@ git_describe_command = 'git describe --tags --match="integrations/amazon_sagemak [tool.hatch.envs.default] installer = "uv" +dependencies = ["haystack-pydoc-tools", "ruff"] +[tool.hatch.envs.default.scripts] +docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" ] -[tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] -docs = ["pydoc-markdown pydoc/config.yml"] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/astra/examples/example.py b/integrations/astra/examples/example.py index 61e6f5f3a5..5f99938663 100644 --- a/integrations/astra/examples/example.py +++ b/integrations/astra/examples/example.py @@ -75,31 +75,35 @@ raise ValueError(msg) logger.info( - f"""filter results: {document_store.filter_documents( - { - "field": "meta", - "operator": "==", - "value": { - "file_path": "/workspace/astra-haystack/examples/data/usr_01.txt", - "source_id": "5b2d27de79bba97da6fc446180d0d99e1024bc7dd6a757037f0934162cfb0916", - }, - } - ) -}""" + f"""filter results: { + document_store.filter_documents( + { + "field": "meta", + "operator": "==", + "value": { + "file_path": "/workspace/astra-haystack/examples/data/usr_01.txt", + "source_id": "5b2d27de79bba97da6fc446180d0d99e1024bc7dd6a757037f0934162cfb0916", + }, + } + ) + }""" ) logger.info( - f"""get_document_by_id {document_store.get_document_by_id( - "92ef055fbae55b2b0fc79d34cbf8a80b0ad7700ca526053223b0cc6d1351df10")}""" + f"""get_document_by_id { + document_store.get_document_by_id("92ef055fbae55b2b0fc79d34cbf8a80b0ad7700ca526053223b0cc6d1351df10") + }""" ) logger.info( - f"""get_documents_by_ids {document_store.get_documents_by_id( - [ - "92ef055fbae55b2b0fc79d34cbf8a80b0ad7700ca526053223b0cc6d1351df10", - "6f2450a51eaa3eeb9239d875402bcfe24b2d3534ff27f26c1f3fc8133b04e756", - ] - )}""" + f"""get_documents_by_ids { + document_store.get_documents_by_id( + [ + "92ef055fbae55b2b0fc79d34cbf8a80b0ad7700ca526053223b0cc6d1351df10", + "6f2450a51eaa3eeb9239d875402bcfe24b2d3534ff27f26c1f3fc8133b04e756", + ] + ) + }""" ) document_store.delete_documents(["92ef055fbae55b2b0fc79d34cbf8a80b0ad7700ca526053223b0cc6d1351df10"]) diff --git a/integrations/astra/pyproject.toml b/integrations/astra/pyproject.toml index 0b310924ae..121e1a1760 100644 --- a/integrations/astra/pyproject.toml +++ b/integrations/astra/pyproject.toml @@ -43,30 +43,38 @@ git_describe_command = 'git describe --tags --match="integrations/astra-v[0-9]*" [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/astra/tests/test_embedding_retrieval.py b/integrations/astra/tests/test_embedding_retrieval.py index bf23fe9f57..24814c9724 100644 --- a/integrations/astra/tests/test_embedding_retrieval.py +++ b/integrations/astra/tests/test_embedding_retrieval.py @@ -13,7 +13,6 @@ ) @pytest.mark.skipif(os.environ.get("ASTRA_DB_API_ENDPOINT", "") == "", reason="ASTRA_DB_API_ENDPOINT env var not set") class TestEmbeddingRetrieval: - @pytest.fixture def document_store(self) -> AstraDocumentStore: return AstraDocumentStore( diff --git a/integrations/deepeval/pyproject.toml b/integrations/deepeval/pyproject.toml index 734e441b8b..465e013ee7 100644 --- a/integrations/deepeval/pyproject.toml +++ b/integrations/deepeval/pyproject.toml @@ -43,25 +43,38 @@ git_describe_command = 'git describe --tags --match="integrations/deepeval-v[0-9 [tool.hatch.envs.default] installer = "uv" -dependencies = ["coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", "haystack-pydoc-tools"] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/deepeval/src/haystack_integrations/components/evaluators/deepeval/metrics.py b/integrations/deepeval/src/haystack_integrations/components/evaluators/deepeval/metrics.py index 7fb5db5b02..4fa2427730 100644 --- a/integrations/deepeval/src/haystack_integrations/components/evaluators/deepeval/metrics.py +++ b/integrations/deepeval/src/haystack_integrations/components/evaluators/deepeval/metrics.py @@ -171,7 +171,7 @@ def _validate_input_elements(**kwargs): same_length = len({len(x) for x in kwargs.values()}) == 1 if not same_length: - msg = f"Mismatching counts in the following inputs: {({k: len(v) for k, v in kwargs.items()})}" + msg = f"Mismatching counts in the following inputs: { ({k: len(v) for k, v in kwargs.items()}) }" raise ValueError(msg) @staticmethod diff --git a/integrations/fastembed/pyproject.toml b/integrations/fastembed/pyproject.toml index f9bb1e5ec8..24a0a4f228 100644 --- a/integrations/fastembed/pyproject.toml +++ b/integrations/fastembed/pyproject.toml @@ -43,31 +43,39 @@ git_describe_command = 'git describe --tags --match="integrations/fastembed-v[0- [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "ipython", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip", + "ipython" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/instructor_embedders/pyproject.toml b/integrations/instructor_embedders/pyproject.toml index 83824ae17e..c8f3d18143 100644 --- a/integrations/instructor_embedders/pyproject.toml +++ b/integrations/instructor_embedders/pyproject.toml @@ -67,21 +67,32 @@ git_describe_command = 'git describe --tags --match="integrations/instructor_emb [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -89,9 +100,6 @@ dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.coverage.run] source = ["haystack_integrations"] diff --git a/integrations/langfuse/pyproject.toml b/integrations/langfuse/pyproject.toml index a4e15a4832..b72135817b 100644 --- a/integrations/langfuse/pyproject.toml +++ b/integrations/langfuse/pyproject.toml @@ -57,7 +57,9 @@ dependencies = [ "pytest-cov", "pytest-rerunfailures", "mypy", - "pip" + "pip", + "anthropic-haystack", + "cohere-haystack", ] [tool.hatch.envs.test.scripts] diff --git a/integrations/llama_cpp/pyproject.toml b/integrations/llama_cpp/pyproject.toml index 27d5859d2c..cc527d804c 100644 --- a/integrations/llama_cpp/pyproject.toml +++ b/integrations/llama_cpp/pyproject.toml @@ -46,25 +46,33 @@ git_describe_command = 'git describe --tags --match="integrations/llama_cpp-v[0- [tool.hatch.envs.default] installer = "uv" +dependencies = ["haystack-pydoc-tools", "ruff"] +[tool.hatch.envs.default.scripts] +docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] dependencies = [ - "coverage[toml]>=6.5", "pytest", + "pytest-asyncio", + "pytest-cov", "pytest-rerunfailures", - "haystack-pydoc-tools", - # "transformers[sentencepiece]" is required for models using a custom HF tokenizer. - # We exclude it from dependencies since some use cases don't need it. - # If missing when required, llama-cpp-python will provide a clear error message. - "transformers[sentencepiece]", + "mypy", + "pip", + "transformers[sentencepiece]" ] -[tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] -docs = ["pydoc-markdown pydoc/config.yml"] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true @@ -72,9 +80,6 @@ dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.hatch.metadata] allow-direct-references = true diff --git a/integrations/llama_cpp/tests/test_chat_generator.py b/integrations/llama_cpp/tests/test_chat_generator.py index e99399e5e7..f0e46f0b4c 100644 --- a/integrations/llama_cpp/tests/test_chat_generator.py +++ b/integrations/llama_cpp/tests/test_chat_generator.py @@ -445,7 +445,6 @@ def generator(self, model_path, capsys): @pytest.mark.integration def test_function_call(self, generator): - def get_user_info(username: Annotated[str, "The username to retrieve information for."]): """Retrieves detailed information about a user.""" return {"username": username, "age": 25, "location": "San Francisco"} @@ -503,7 +502,6 @@ def test_function_call_and_execute(self, generator): class TestLlamaCppChatGeneratorChatML: - @pytest.fixture def generator(self, model_path, capsys): gguf_model_path = ( @@ -525,7 +523,6 @@ def generator(self, model_path, capsys): @pytest.mark.integration def test_function_call_chatml(self, generator): - def get_user_detail(name: Annotated[str, "The name of the user"], age: Annotated[int, "The age of the user"]): """Retrieves detailed information about a user.""" pass diff --git a/integrations/mcp/examples/mcp_stdio_client.py b/integrations/mcp/examples/mcp_stdio_client.py index 89b4260002..191f0ec273 100644 --- a/integrations/mcp/examples/mcp_stdio_client.py +++ b/integrations/mcp/examples/mcp_stdio_client.py @@ -22,7 +22,6 @@ def main(): stdio_tool = None try: - stdio_tool = MCPTool( name="get_current_time", server_info=StdioServerInfo(command="uvx", args=["mcp-server-time", "--local-timezone=Europe/Berlin"]), diff --git a/integrations/mcp/pyproject.toml b/integrations/mcp/pyproject.toml index d88c9271f3..313a5ad688 100644 --- a/integrations/mcp/pyproject.toml +++ b/integrations/mcp/pyproject.toml @@ -52,42 +52,44 @@ git_describe_command = 'git describe --tags --match="integrations/mcp-v[0-9]*"' [tool.hatch.envs.default] installer = "uv" +dependencies = ["haystack-pydoc-tools", "ruff"] + +[tool.hatch.envs.default.scripts] +docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] dependencies = [ - "coverage[toml]>=6.5", - "haystack-pydoc-tools", "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip", "anyio", - "pytest-asyncio", "pytest-tornasync", - "pytest-rerunfailures", "pytest-pythonpath", - "mcp-server-time" ## time server for tests + "mcp-server-time" ] -[tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] -docs = ["pydoc-markdown pydoc/config.yml"] +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true -dependencies = [ - "pip", - "black>=23.1.0", - "mypy>=1.0.0", - "ruff>=0.0.243" -] +dependencies = ["pip", "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 check --fix {args:.}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py310"] diff --git a/integrations/mcp/tests/test_mcp_integration.py b/integrations/mcp/tests/test_mcp_integration.py index ec71dcf0ef..934845f9a9 100644 --- a/integrations/mcp/tests/test_mcp_integration.py +++ b/integrations/mcp/tests/test_mcp_integration.py @@ -234,6 +234,6 @@ def test_mcp_tool_error_handling_integration(self): # Check for platform-agnostic error message patterns error_message = str(exc_info.value) assert error_message, "Error message should not be empty" - assert any( - text in error_message.lower() for text in ["failed", "connection", "initialize"] - ), f"Error message '{error_message}' should contain connection failure information" + assert any(text in error_message.lower() for text in ["failed", "connection", "initialize"]), ( + f"Error message '{error_message}' should contain connection failure information" + ) diff --git a/integrations/meta_llama/pyproject.toml b/integrations/meta_llama/pyproject.toml index ef6162334f..51f8c9db4e 100644 --- a/integrations/meta_llama/pyproject.toml +++ b/integrations/meta_llama/pyproject.toml @@ -43,35 +43,39 @@ git_describe_command = 'git describe --tags --match="integrations/meta_llama-v[0 [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "pytz", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip", + "pytz" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/meta_llama/tests/test_llama_chat_generator.py b/integrations/meta_llama/tests/test_llama_chat_generator.py index 990e3f7c79..8c7e3af98e 100644 --- a/integrations/meta_llama/tests/test_llama_chat_generator.py +++ b/integrations/meta_llama/tests/test_llama_chat_generator.py @@ -510,17 +510,17 @@ def test_serde_in_pipeline(self, monkeypatch): # add outputs_to_string, inputs_from_state and outputs_to_state tool parameters for compatibility with # haystack-ai>=2.12.0 if hasattr(tool, "outputs_to_string"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_string" - ] = tool.outputs_to_string + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_string"] = ( + tool.outputs_to_string + ) if hasattr(tool, "inputs_from_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "inputs_from_state" - ] = tool.inputs_from_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["inputs_from_state"] = ( + tool.inputs_from_state + ) if hasattr(tool, "outputs_to_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_state" - ] = tool.outputs_to_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_state"] = ( + tool.outputs_to_state + ) assert pipeline_dict == expected_dict diff --git a/integrations/openrouter/pyproject.toml b/integrations/openrouter/pyproject.toml index 5a8e4fec20..bac6b095d6 100644 --- a/integrations/openrouter/pyproject.toml +++ b/integrations/openrouter/pyproject.toml @@ -43,35 +43,39 @@ git_describe_command = 'git describe --tags --match="integrations/openrouter-v[0 [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-asyncio", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "pytz", -] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip", + "pytz" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" + +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/openrouter/tests/test_openrouter_chat_generator.py b/integrations/openrouter/tests/test_openrouter_chat_generator.py index 101617a78c..cbcb03160c 100644 --- a/integrations/openrouter/tests/test_openrouter_chat_generator.py +++ b/integrations/openrouter/tests/test_openrouter_chat_generator.py @@ -509,17 +509,17 @@ def test_serde_in_pipeline(self, monkeypatch): # add outputs_to_string, inputs_from_state and outputs_to_state tool parameters for compatibility with # haystack-ai>=2.12.0 if hasattr(tool, "outputs_to_string"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_string" - ] = tool.outputs_to_string + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_string"] = ( + tool.outputs_to_string + ) if hasattr(tool, "inputs_from_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "inputs_from_state" - ] = tool.inputs_from_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["inputs_from_state"] = ( + tool.inputs_from_state + ) if hasattr(tool, "outputs_to_state"): - expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"][ - "outputs_to_state" - ] = tool.outputs_to_state + expected_dict["components"]["generator"]["init_parameters"]["tools"][0]["data"]["outputs_to_state"] = ( + tool.outputs_to_state + ) assert pipeline_dict == expected_dict diff --git a/integrations/stackit/pyproject.toml b/integrations/stackit/pyproject.toml index 0dde17cbbf..b5f17edba0 100644 --- a/integrations/stackit/pyproject.toml +++ b/integrations/stackit/pyproject.toml @@ -43,35 +43,39 @@ git_describe_command = 'git describe --tags --match="integrations/stackit-v[0-9] [tool.hatch.envs.default] installer = "uv" -dependencies = [ - "coverage[toml]>=6.5", - "pytest", - "pytest-rerunfailures", - "haystack-pydoc-tools", - "pytz", - ] - +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip", + "pytz" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py38"] diff --git a/integrations/weights_and_biases_weave/example/hybrid_retrieval.py b/integrations/weights_and_biases_weave/example/hybrid_retrieval.py index 647efca982..acfa2a7fcd 100644 --- a/integrations/weights_and_biases_weave/example/hybrid_retrieval.py +++ b/integrations/weights_and_biases_weave/example/hybrid_retrieval.py @@ -9,7 +9,6 @@ def index(): - document_store = InMemoryDocumentStore() documents = [ Document(content="The Eiffel Tower is located in Paris, France."), @@ -30,7 +29,6 @@ def index(): def hybrid_pipeline(document_store): - text_embedder = SentenceTransformersTextEmbedder() embedding_retriever = InMemoryEmbeddingRetriever(document_store) bm25_retriever = InMemoryBM25Retriever(document_store) diff --git a/integrations/weights_and_biases_weave/pyproject.toml b/integrations/weights_and_biases_weave/pyproject.toml index e4ce4f4568..cd72ffb7c7 100644 --- a/integrations/weights_and_biases_weave/pyproject.toml +++ b/integrations/weights_and_biases_weave/pyproject.toml @@ -43,25 +43,38 @@ git_describe_command = 'git describe --tags --match="integrations/weights_and_bi [tool.hatch.envs.default] installer = "uv" -dependencies = ["coverage[toml]>=6.5", "pytest", "pytest-rerunfailures", "haystack-pydoc-tools"] +dependencies = ["haystack-pydoc-tools", "ruff"] [tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +dependencies = [ + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-rerunfailures", + "mypy", + "pip" +] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' +cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' +types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}" +# TODO: remove lint environment once this integration is properly typed +# test environment should be used instead +# https://github.com/deepset-ai/haystack-core-integrations/issues/1771 [tool.hatch.envs.lint] installer = "uv" detached = true dependencies = ["pip", "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 check --fix {args:}", "style"] -all = ["style", "typing"] [tool.black] target-version = ["py39"] diff --git a/integrations/weights_and_biases_weave/tests/test_tracer.py b/integrations/weights_and_biases_weave/tests/test_tracer.py index e8a8212889..415577820d 100644 --- a/integrations/weights_and_biases_weave/tests/test_tracer.py +++ b/integrations/weights_and_biases_weave/tests/test_tracer.py @@ -27,7 +27,6 @@ def finish_call(self, call, output=None, exception=None): class TestWeaveTracer: - def test_initialization(self): with patch("weave.init") as mock_init: mock_init.return_value = MockWeaveClient() From 1d742b58f097c69912eb516c6583b0e3ab193bb9 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 17:41:44 +0200 Subject: [PATCH 16/19] lf --- integrations/langfuse/pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integrations/langfuse/pyproject.toml b/integrations/langfuse/pyproject.toml index b72135817b..aaa9dddf3b 100644 --- a/integrations/langfuse/pyproject.toml +++ b/integrations/langfuse/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] -dependencies = ["haystack-ai>=2.13.0", "langfuse>=2.9.0"] +dependencies = ["haystack-ai>=2.13.0", "langfuse>=2.9.0, <3.0.0"] [project.urls] Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/langfuse#readme" @@ -60,6 +60,7 @@ dependencies = [ "pip", "anthropic-haystack", "cohere-haystack", + ] [tool.hatch.envs.test.scripts] From 5b9ff480873d5f872198033a7b05f4a2c8bb0323 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 17:51:18 +0200 Subject: [PATCH 17/19] add missing test deps --- integrations/mistral/pyproject.toml | 3 ++- integrations/nvidia/pyproject.toml | 3 ++- integrations/opensearch/pyproject.toml | 3 ++- integrations/snowflake/pyproject.toml | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/integrations/mistral/pyproject.toml b/integrations/mistral/pyproject.toml index 3fe18b0a5e..2132ffac0a 100644 --- a/integrations/mistral/pyproject.toml +++ b/integrations/mistral/pyproject.toml @@ -57,7 +57,8 @@ dependencies = [ "pytest-cov", "pytest-rerunfailures", "mypy", - "pip" + "pip", + "pytz" ] [tool.hatch.envs.test.scripts] diff --git a/integrations/nvidia/pyproject.toml b/integrations/nvidia/pyproject.toml index d9f176e5a5..2b499a0100 100644 --- a/integrations/nvidia/pyproject.toml +++ b/integrations/nvidia/pyproject.toml @@ -57,7 +57,8 @@ dependencies = [ "pytest-cov", "pytest-rerunfailures", "mypy", - "pip" + "pip", + "requests_mock" ] [tool.hatch.envs.test.scripts] diff --git a/integrations/opensearch/pyproject.toml b/integrations/opensearch/pyproject.toml index 454d95989a..7ba9a92d64 100644 --- a/integrations/opensearch/pyproject.toml +++ b/integrations/opensearch/pyproject.toml @@ -59,7 +59,8 @@ dependencies = [ "pytest-cov", "pytest-rerunfailures", "mypy", - "pip" + "pip", + "boto3" ] [tool.hatch.envs.test.scripts] diff --git a/integrations/snowflake/pyproject.toml b/integrations/snowflake/pyproject.toml index 23dcae1aa7..fa8a84b72a 100644 --- a/integrations/snowflake/pyproject.toml +++ b/integrations/snowflake/pyproject.toml @@ -58,7 +58,8 @@ dependencies = [ "pytest-cov", "pytest-rerunfailures", "mypy", - "pip" + "pip", + "pytest-mock" ] [tool.hatch.envs.test.scripts] From 1fb6960f38f03a2b90dad8ecbc7fb575700964b0 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Thu, 5 Jun 2025 17:57:11 +0200 Subject: [PATCH 18/19] fix pinecone --- integrations/pinecone/pyproject.toml | 29 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/integrations/pinecone/pyproject.toml b/integrations/pinecone/pyproject.toml index 40aa514b71..577f6da872 100644 --- a/integrations/pinecone/pyproject.toml +++ b/integrations/pinecone/pyproject.toml @@ -46,24 +46,33 @@ git_describe_command = 'git describe --tags --match="integrations/pinecone-v[0-9 [tool.hatch.envs.default] installer = "uv" +dependencies = ["haystack-pydoc-tools", "ruff"] + +[tool.hatch.envs.default.scripts] +docs = ["pydoc-markdown pydoc/config.yml"] +fmt = "ruff check --fix {args} && ruff format {args}" +fmt-check = "ruff check {args} && ruff format --check {args}" + +[tool.hatch.envs.test] +installer = "uv" dependencies = [ - "coverage[toml]>=6.5", "pytest", "pytest-asyncio", + "pytest-cov", "pytest-rerunfailures", + "mypy", + "pip", "pytest-xdist", - "haystack-pydoc-tools", ] -[tool.hatch.envs.default.scripts] + +[tool.hatch.envs.test.scripts] +unit = 'pytest -m "not integration" {args:tests}' +integration = 'pytest -m "integration" {args:tests}' +all = 'pytest {args:tests}' + # Pinecone tests are slow (require HTTP requests), so we run them in parallel # with pytest-xdist (https://pytest-xdist.readthedocs.io/en/stable/distribution.html) -test = "pytest -n auto --maxprocesses=2 -x {args:tests}" -test-cov = "coverage run -m pytest -n auto --maxprocesses=2 {args:tests}" -test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x" -cov-report = ["- coverage combine", "coverage report"] -cov = ["test-cov", "cov-report"] -cov-retry = ["test-cov-retry", "cov-report"] -docs = ["pydoc-markdown pydoc/config.yml"] +cov-retry = 'all -n auto --maxprocesses=2 --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x' [tool.hatch.envs.lint] installer = "uv" From 24303e5f04d325fbd3086c53c99a6badc2488132 Mon Sep 17 00:00:00 2001 From: anakin87 Date: Fri, 6 Jun 2025 08:10:16 +0200 Subject: [PATCH 19/19] pytz test dep --- integrations/nvidia/pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integrations/nvidia/pyproject.toml b/integrations/nvidia/pyproject.toml index 4865aafa5b..815303755f 100644 --- a/integrations/nvidia/pyproject.toml +++ b/integrations/nvidia/pyproject.toml @@ -58,7 +58,8 @@ dependencies = [ "pytest-rerunfailures", "mypy", "pip", - "requests_mock" + "requests_mock", + "pytz" ] [tool.hatch.envs.test.scripts]