weave-haystack 3.0.0__tar.gz → 3.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. weave_haystack-3.2.0/CHANGELOG.md +20 -0
  2. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/LICENSE.txt +1 -1
  3. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/PKG-INFO +2 -1
  4. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/example/hybrid_retrieval.py +1 -1
  5. weave_haystack-3.2.0/pydoc/config_docusaurus.yml +14 -0
  6. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/pyproject.toml +16 -3
  7. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/src/haystack_integrations/components/connectors/weave/__init__.py +1 -1
  8. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/src/haystack_integrations/components/connectors/weave/weave_connector.py +13 -1
  9. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/src/haystack_integrations/tracing/weave/__init__.py +1 -1
  10. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/src/haystack_integrations/tracing/weave/tracer.py +8 -0
  11. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/tests/test_tracer.py +4 -0
  12. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/tests/test_weave_connector.py +12 -5
  13. weave_haystack-3.0.0/CHANGELOG.md +0 -36
  14. weave_haystack-3.0.0/pydoc/config_docusaurus.yml +0 -29
  15. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/.gitignore +0 -0
  16. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/README.md +0 -0
  17. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/example/README.md +0 -0
  18. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/src/haystack_integrations/components/connectors/py.typed +0 -0
  19. {weave_haystack-3.0.0 → weave_haystack-3.2.0}/src/haystack_integrations/tracing/py.typed +0 -0
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ## [integrations/weave-v3.1.0] - 2026-01-14
4
+
5
+ ### 🚀 Features
6
+
7
+ - Update weave components to auto call run `warm_up` (#2750)
8
+
9
+ ### 🧹 Chores
10
+
11
+ - Standardize Weave integration - pt.2 (#2739)
12
+
13
+
14
+ ## [integrations/weave-v3.0.0] - 2026-01-13
15
+
16
+ ### 🧹 Chores
17
+
18
+ - Standardize Weave integration (#2738)
19
+
20
+ <!-- generated by git-cliff -->
@@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
58
58
 
59
59
  To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
60
 
61
- Copyright [yyyy] [name of copyright owner]
61
+ Copyright 2025 deepset GmbH
62
62
 
63
63
  Licensed under the Apache License, Version 2.0 (the "License");
64
64
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weave-haystack
3
- Version: 3.0.0
3
+ Version: 3.2.0
4
4
  Summary: An integration of Weights & Biases Weave tracer with Haystack
5
5
  Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations
6
6
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weave/README.md
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
18
19
  Classifier: Programming Language :: Python :: Implementation :: CPython
19
20
  Classifier: Programming Language :: Python :: Implementation :: PyPy
20
21
  Requires-Python: >=3.10
@@ -20,7 +20,7 @@ def index():
20
20
  ]
21
21
 
22
22
  embedder = SentenceTransformersDocumentEmbedder()
23
- embedder.warm_up()
23
+ # Components warm up automatically on first run.
24
24
  embed_docs = embedder.run(documents)
25
25
 
26
26
  document_store.write_documents(embed_docs["documents"])
@@ -0,0 +1,14 @@
1
+ loaders:
2
+ - modules:
3
+ - haystack_integrations.components.connectors.weave.weave_connector
4
+ - haystack_integrations.tracing.weave.tracer
5
+ search_path: [../src]
6
+ processors:
7
+ - type: filter
8
+ documented_only: true
9
+ skip_empty_modules: true
10
+ renderer:
11
+ description: Weights & Bias integration for Haystack
12
+ id: integrations-weave
13
+ filename: weave.md
14
+ title: Weave
@@ -19,6 +19,7 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.11",
20
20
  "Programming Language :: Python :: 3.12",
21
21
  "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
22
23
  "Programming Language :: Python :: Implementation :: CPython",
23
24
  "Programming Language :: Python :: Implementation :: PyPy",
24
25
  ]
@@ -44,7 +45,7 @@ git_describe_command = 'git describe --tags --match="integrations/weave-v[0-9]*"
44
45
  installer = "uv"
45
46
  dependencies = ["haystack-pydoc-tools", "ruff"]
46
47
  [tool.hatch.envs.default.scripts]
47
- docs = ["pydoc-markdown pydoc/config_docusaurus.yml"]
48
+ docs = ["haystack-pydoc pydoc/config_docusaurus.yml"]
48
49
  fmt = "ruff check --fix {args}; ruff format {args}"
49
50
  fmt-check = "ruff check {args} && ruff format --check {args}"
50
51
 
@@ -62,7 +63,8 @@ dependencies = [
62
63
  unit = 'pytest -m "not integration" {args:tests}'
63
64
  integration = 'pytest -m "integration" {args:tests}'
64
65
  all = 'pytest {args:tests}'
65
- cov-retry = 'pytest --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x {args:tests}'
66
+ unit-cov-retry = 'pytest --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x -m "not integration" {args:tests}'
67
+ integration-cov-append-retry = 'pytest --cov=haystack_integrations --cov-append --reruns 3 --reruns-delay 30 -x -m "integration" {args:tests}'
66
68
  types = """mypy -p haystack_integrations.components.connectors.weave \
67
69
  -p haystack_integrations.tracing.weave {args}"""
68
70
 
@@ -78,9 +80,17 @@ line-length = 120
78
80
  [tool.ruff.lint]
79
81
  select = [
80
82
  "A",
83
+ "ANN",
81
84
  "ARG",
82
85
  "B",
83
86
  "C",
87
+ "D102", # Missing docstring in public method
88
+ "D103", # Missing docstring in public function
89
+ "D205", # 1 blank line required between summary line and description
90
+ "D209", # Closing triple quotes go to new line
91
+ "D213", # summary lines must be positioned on the second physical line of the docstring
92
+ "D417", # Missing argument descriptions in the docstring
93
+ "D419", # Docstring is empty
84
94
  "DTZ",
85
95
  "E",
86
96
  "EM",
@@ -105,6 +115,7 @@ select = [
105
115
  ]
106
116
  ignore = [
107
117
  # Allow non-abstract empty methods in abstract base classes
118
+ "ANN401",
108
119
  "B027",
109
120
  # Allow boolean positional values in function calls, like `dict.get(... True)`
110
121
  "FBT003",
@@ -128,11 +139,13 @@ ban-relative-imports = "parents"
128
139
 
129
140
  [tool.ruff.lint.per-file-ignores]
130
141
  # Tests can use magic values, assertions, and relative imports
131
- "tests/**/*" = ["PLR2004", "S101", "TID252"]
142
+ "example/**/*" = ["D", "ANN"]
143
+ "tests/**/*" = ["D", "ANN", "PLR2004", "S101", "TID252"]
132
144
 
133
145
  [tool.coverage.run]
134
146
  source = ["haystack_integrations"]
135
147
  branch = true
148
+ relative_files = true
136
149
  parallel = false
137
150
 
138
151
 
@@ -1,4 +1,4 @@
1
- # SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
@@ -1,6 +1,12 @@
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from dataclasses import asdict, is_dataclass
1
6
  from typing import Any
2
7
 
3
8
  from haystack import component, default_from_dict, default_to_dict, logging, tracing
9
+ from pydantic import BaseModel
4
10
 
5
11
  from haystack_integrations.tracing.weave import WeaveTracer
6
12
  from weave.trace.settings import UserSettings
@@ -90,6 +96,9 @@ class WeaveConnector:
90
96
 
91
97
  @component.output_types(pipeline_name=str)
92
98
  def run(self) -> dict[str, str]:
99
+ """Run the WeaveConnector, initializing the tracer if needed."""
100
+ if self.tracer is None:
101
+ self.warm_up()
93
102
  # NOTE: this is a no-op component - it simply triggers the Tracer to sends traces to Weights & Biases
94
103
  return {"pipeline_name": self.pipeline_name}
95
104
 
@@ -103,7 +112,10 @@ class WeaveConnector:
103
112
  weave_init_kwargs = self.weave_init_kwargs.copy()
104
113
  settings = weave_init_kwargs.get("settings", None)
105
114
  if isinstance(settings, UserSettings):
106
- weave_init_kwargs["settings"] = settings.model_dump(mode="json", exclude_defaults=True)
115
+ if isinstance(settings, BaseModel):
116
+ weave_init_kwargs["settings"] = settings.model_dump(mode="json", exclude_defaults=True)
117
+ elif is_dataclass(settings):
118
+ weave_init_kwargs["settings"] = asdict(settings)
107
119
 
108
120
  return default_to_dict(self, pipeline_name=self.pipeline_name, weave_init_kwargs=weave_init_kwargs)
109
121
 
@@ -1,4 +1,4 @@
1
- # SPDX-FileCopyrightText: 2023-present deepset GmbH <info@deepset.ai>
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
2
  #
3
3
  # SPDX-License-Identifier: Apache-2.0
4
4
 
@@ -1,3 +1,7 @@
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  import contextlib
2
6
  import os
3
7
  from collections.abc import Iterator
@@ -38,6 +42,7 @@ class WeaveSpan(Span):
38
42
  self._attributes[key] = value
39
43
 
40
44
  def set_tags(self, tags: dict[str, Any]) -> None:
45
+ """Set multiple tags at once by iterating over the provided dictionary."""
41
46
  for k, v in tags.items():
42
47
  self.set_tag(k, v)
43
48
 
@@ -52,9 +57,11 @@ class WeaveSpan(Span):
52
57
  return {"weave.call_id": self._call.id, "weave.run_id": getattr(self._call, "run_id", "")}
53
58
 
54
59
  def set_call(self, call: Call) -> None:
60
+ """Set the underlying Weave Call object for this span."""
55
61
  self._call = call
56
62
 
57
63
  def get_attributes(self) -> dict[str, Any]:
64
+ """Return the accumulated attributes dictionary for this span."""
58
65
  return self._attributes
59
66
 
60
67
 
@@ -88,6 +95,7 @@ class WeaveTracer(Tracer):
88
95
 
89
96
  @staticmethod
90
97
  def create_call(attributes: dict, client: WeaveClient, parent_span: WeaveSpan | None, operation_name: str) -> Call:
98
+ """Create and return a Weave Call from the given span attributes and client."""
91
99
  comp_name = attributes.pop("haystack.component.name", "")
92
100
  comp_type = attributes.pop("haystack.component.type", "")
93
101
  comp_input = attributes.pop("haystack.component.input", {})
@@ -1,3 +1,7 @@
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  import logging
2
6
  from unittest.mock import patch
3
7
 
@@ -1,3 +1,7 @@
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
1
5
  import os
2
6
  from collections.abc import Generator
3
7
  from typing import Any
@@ -21,7 +25,7 @@ class FailingComponent:
21
25
  def run(self) -> dict[str, Any]:
22
26
  """Execute the component's logic - always raises an exception."""
23
27
  msg = "Test error"
24
- raise PipelineRuntimeError(msg)
28
+ raise PipelineRuntimeError(component_name="FailingComponent", component_type=FailingComponent, message=msg)
25
29
 
26
30
 
27
31
  @pytest.fixture
@@ -93,9 +97,7 @@ class TestWeaveConnector:
93
97
  serialized: dict[str, Any] = connector.to_dict()
94
98
 
95
99
  assert serialized["init_parameters"]["pipeline_name"] == "test_pipeline"
96
- assert serialized["init_parameters"]["weave_init_kwargs"] == {
97
- "settings": {"implicitly_patch_integrations": False}
98
- }
100
+ assert serialized["init_parameters"]["weave_init_kwargs"]["settings"]["implicitly_patch_integrations"] is False
99
101
  assert "type" in serialized
100
102
  assert serialized["type"] == "haystack_integrations.components.connectors.weave.weave_connector.WeaveConnector"
101
103
 
@@ -104,7 +106,7 @@ class TestWeaveConnector:
104
106
  assert isinstance(deserialized, WeaveConnector)
105
107
  assert deserialized.pipeline_name == "test_pipeline"
106
108
  assert deserialized.tracer is None # tracer is only initialized with warm_up
107
- assert deserialized.weave_init_kwargs == {"settings": {"implicitly_patch_integrations": False}}
109
+ assert deserialized.weave_init_kwargs["settings"]["implicitly_patch_integrations"] is False
108
110
 
109
111
  def test_pipeline_tracing(self, mock_weave_client: Mock, sample_pipeline: Pipeline) -> None:
110
112
  """Test that pipeline operations are correctly traced"""
@@ -146,6 +148,11 @@ class TestWeaveConnector:
146
148
  error_traces = [args for args in finish_call_args if args[1].get("exception") is not None]
147
149
  assert len(error_traces) > 0
148
150
 
151
+ @pytest.mark.skipif(
152
+ not os.environ.get("WANDB_API_KEY", None),
153
+ reason="Export an env var called WANDB_API_KEY containing the Weights & Bias API key to run this test.",
154
+ )
155
+ @pytest.mark.integration
149
156
  def test_run_method(self) -> None:
150
157
  """Test the basic run method of WeaveConnector"""
151
158
  connector = WeaveConnector(pipeline_name="test_pipeline")
@@ -1,36 +0,0 @@
1
- # Changelog
2
-
3
- ## [integrations/weights_and_biases_weave-v2.0.0] - 2025-09-16
4
-
5
- ### 🐛 Bug Fixes
6
-
7
- - Weave - pin gql (#2198)
8
-
9
- ### 🚜 Refactor
10
-
11
- - [**breaking**] Weave - update patching support and unpin gql (#2272)
12
-
13
- ### 🧹 Chores
14
-
15
- - Standardize readmes - part 2 (#2205)
16
-
17
-
18
- ## [integrations/weights_and_biases_weave-v1.0.0] - 2025-07-01
19
-
20
- ### 🐛 Bug Fixes
21
-
22
- - [**breaking**] Weave - move Connector, fix types, add py.typed (#2038)
23
-
24
- ### 🧹 Chores
25
-
26
- - Align core-integrations Hatch scripts (#1898)
27
- - Remove black (#1985)
28
-
29
-
30
- ## [integrations/weights_and_biases_weave-v0.0.1] - 2025-03-28
31
-
32
- ### 🚜 Refactor
33
-
34
- - Renaming the project/package to weights_biases_weave (#1565)
35
-
36
- <!-- generated by git-cliff -->
@@ -1,29 +0,0 @@
1
- loaders:
2
- - ignore_when_discovered:
3
- - __init__
4
- modules:
5
- - haystack_integrations.components.connectors.weave.weave_connector
6
- - haystack_integrations.tracing.weave.tracer
7
- search_path:
8
- - ../src
9
- type: haystack_pydoc_tools.loaders.CustomPythonLoader
10
- processors:
11
- - do_not_filter_modules: false
12
- documented_only: true
13
- expression: null
14
- skip_empty_modules: true
15
- type: filter
16
- - type: smart
17
- - type: crossref
18
- renderer:
19
- description: Weights & Bias integration for Haystack
20
- id: integrations-weights-bias
21
- markdown:
22
- add_member_class_prefix: false
23
- add_method_class_prefix: true
24
- classdef_code_block: false
25
- descriptive_class_title: false
26
- descriptive_module_title: true
27
- filename: weights_and_bias.md
28
- title: weights and bias
29
- type: haystack_pydoc_tools.renderers.DocusaurusRenderer
File without changes