weave-haystack 2.0.0__tar.gz → 3.1.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.1.0/CHANGELOG.md +9 -0
  2. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/LICENSE.txt +1 -1
  3. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/PKG-INFO +5 -6
  4. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/README.md +1 -1
  5. weave_haystack-3.1.0/pydoc/config_docusaurus.yml +29 -0
  6. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/pyproject.toml +8 -14
  7. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/src/haystack_integrations/components/connectors/weave/__init__.py +1 -1
  8. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/src/haystack_integrations/components/connectors/weave/weave_connector.py +9 -3
  9. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/src/haystack_integrations/tracing/weave/__init__.py +1 -1
  10. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/src/haystack_integrations/tracing/weave/tracer.py +17 -19
  11. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/tests/test_tracer.py +4 -0
  12. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/tests/test_weave_connector.py +10 -1
  13. weave_haystack-2.0.0/CHANGELOG.md +0 -21
  14. weave_haystack-2.0.0/pydoc/config.yml +0 -30
  15. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/.gitignore +0 -0
  16. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/example/README.md +0 -0
  17. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/example/hybrid_retrieval.py +0 -0
  18. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/src/haystack_integrations/components/connectors/py.typed +0 -0
  19. {weave_haystack-2.0.0 → weave_haystack-3.1.0}/src/haystack_integrations/tracing/py.typed +0 -0
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## [integrations/weave-v3.0.0] - 2026-01-13
4
+
5
+ ### 🧹 Chores
6
+
7
+ - Standardize Weave integration (#2738)
8
+
9
+ <!-- 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,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weave-haystack
3
- Version: 2.0.0
3
+ Version: 3.1.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
- Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weights_and_biases_weave/README.md
6
+ Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weave/README.md
7
7
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
8
8
  Author-email: deepset GmbH <info@deepset.ai>
9
9
  License-Expression: Apache-2.0
@@ -11,15 +11,14 @@ License-File: LICENSE.txt
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
19
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
19
  Classifier: Programming Language :: Python :: Implementation :: PyPy
21
- Requires-Python: >=3.9
22
- Requires-Dist: haystack-ai
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: haystack-ai>=2.22.0
23
22
  Requires-Dist: weave>=0.52.7
24
23
  Description-Content-Type: text/markdown
25
24
 
@@ -29,7 +28,7 @@ Description-Content-Type: text/markdown
29
28
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/weave-haystack)](https://pypi.org/project/weave-haystack)
30
29
 
31
30
  - [Integration page](https://haystack.deepset.ai/integrations/weights-and-bias-tracer)
32
- - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weights_and_biases_weave/CHANGELOG.md)
31
+ - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weave/CHANGELOG.md)
33
32
 
34
33
  ---
35
34
 
@@ -4,7 +4,7 @@
4
4
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/weave-haystack)](https://pypi.org/project/weave-haystack)
5
5
 
6
6
  - [Integration page](https://haystack.deepset.ai/integrations/weights-and-bias-tracer)
7
- - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weights_and_biases_weave/CHANGELOG.md)
7
+ - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weave/CHANGELOG.md)
8
8
 
9
9
  ---
10
10
 
@@ -0,0 +1,29 @@
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-weave
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: weave.md
28
+ title: Weave
29
+ type: haystack_pydoc_tools.renderers.DocusaurusRenderer
@@ -7,7 +7,7 @@ name = "weave-haystack"
7
7
  dynamic = ["version"]
8
8
  description = "An integration of Weights & Biases Weave tracer with Haystack"
9
9
  readme = "README.md"
10
- requires-python = ">=3.9"
10
+ requires-python = ">=3.10"
11
11
  license = "Apache-2.0"
12
12
  keywords = []
13
13
  authors = [{ name = "deepset GmbH", email = "info@deepset.ai" }]
@@ -15,7 +15,6 @@ classifiers = [
15
15
  "License :: OSI Approved :: Apache Software License",
16
16
  "Development Status :: 4 - Beta",
17
17
  "Programming Language :: Python",
18
- "Programming Language :: Python :: 3.9",
19
18
  "Programming Language :: Python :: 3.10",
20
19
  "Programming Language :: Python :: 3.11",
21
20
  "Programming Language :: Python :: 3.12",
@@ -23,11 +22,11 @@ classifiers = [
23
22
  "Programming Language :: Python :: Implementation :: CPython",
24
23
  "Programming Language :: Python :: Implementation :: PyPy",
25
24
  ]
26
- dependencies = ["haystack-ai", "weave>=0.52.7"]
25
+ dependencies = ["haystack-ai>=2.22.0", "weave>=0.52.7"]
27
26
 
28
27
  [project.urls]
29
28
  Source = "https://github.com/deepset-ai/haystack-core-integrations"
30
- Documentation = "https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weights_and_biases_weave/README.md"
29
+ Documentation = "https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weave/README.md"
31
30
  Issues = "https://github.com/deepset-ai/haystack-core-integrations/issues"
32
31
 
33
32
  [tool.hatch.build.targets.wheel]
@@ -35,18 +34,18 @@ packages = ["src/haystack_integrations"]
35
34
 
36
35
  [tool.hatch.version]
37
36
  source = "vcs"
38
- tag-pattern = 'integrations\/weights_and_biases_weave-v(?P<version>.*)'
37
+ tag-pattern = 'integrations\/weave-v(?P<version>.*)'
39
38
 
40
39
  [tool.hatch.version.raw-options]
41
40
  root = "../.."
42
- git_describe_command = 'git describe --tags --match="integrations/weights_and_biases_weave-v[0-9]*"'
41
+ git_describe_command = 'git describe --tags --match="integrations/weave-v[0-9]*"'
43
42
 
44
43
  [tool.hatch.envs.default]
45
44
  installer = "uv"
46
45
  dependencies = ["haystack-pydoc-tools", "ruff"]
47
46
  [tool.hatch.envs.default.scripts]
48
- docs = ["pydoc-markdown pydoc/config.yml"]
49
- fmt = "ruff check --fix {args} && ruff format {args}"
47
+ docs = ["pydoc-markdown pydoc/config_docusaurus.yml"]
48
+ fmt = "ruff check --fix {args}; ruff format {args}"
50
49
  fmt-check = "ruff check {args} && ruff format --check {args}"
51
50
 
52
51
  [tool.hatch.envs.test]
@@ -63,7 +62,7 @@ dependencies = [
63
62
  unit = 'pytest -m "not integration" {args:tests}'
64
63
  integration = 'pytest -m "integration" {args:tests}'
65
64
  all = 'pytest {args:tests}'
66
- cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x'
65
+ cov-retry = 'pytest --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x {args:tests}'
67
66
  types = """mypy -p haystack_integrations.components.connectors.weave \
68
67
  -p haystack_integrations.tracing.weave {args}"""
69
68
 
@@ -74,7 +73,6 @@ check_untyped_defs = true
74
73
  disallow_incomplete_defs = true
75
74
 
76
75
  [tool.ruff]
77
- target-version = "py39"
78
76
  line-length = 120
79
77
 
80
78
  [tool.ruff.lint]
@@ -121,10 +119,6 @@ ignore = [
121
119
  "PLR0913",
122
120
  "PLR0915",
123
121
  ]
124
- unfixable = [
125
- # Don't touch unused imports
126
- "F401",
127
- ]
128
122
 
129
123
  [tool.ruff.lint.isort]
130
124
  known-first-party = ["haystack_integrations"]
@@ -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,4 +1,8 @@
1
- from typing import Any, Optional
1
+ # SPDX-FileCopyrightText: 2025-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from typing import Any
2
6
 
3
7
  from haystack import component, default_from_dict, default_to_dict, logging, tracing
4
8
 
@@ -71,7 +75,7 @@ class WeaveConnector:
71
75
 
72
76
  """
73
77
 
74
- def __init__(self, pipeline_name: str, weave_init_kwargs: Optional[dict[str, Any]] = None) -> None:
78
+ def __init__(self, pipeline_name: str, weave_init_kwargs: dict[str, Any] | None = None) -> None:
75
79
  """
76
80
  Initialize WeaveConnector.
77
81
 
@@ -80,7 +84,7 @@ class WeaveConnector:
80
84
  """
81
85
  self.pipeline_name = pipeline_name
82
86
  self.weave_init_kwargs = weave_init_kwargs or {}
83
- self.tracer: Optional[WeaveTracer] = None
87
+ self.tracer: WeaveTracer | None = None
84
88
 
85
89
  def warm_up(self) -> None:
86
90
  """Initialize the WeaveTracer."""
@@ -90,6 +94,8 @@ class WeaveConnector:
90
94
 
91
95
  @component.output_types(pipeline_name=str)
92
96
  def run(self) -> dict[str, str]:
97
+ if self.tracer is None:
98
+ self.warm_up()
93
99
  # NOTE: this is a no-op component - it simply triggers the Tracer to sends traces to Weights & Biases
94
100
  return {"pipeline_name": self.pipeline_name}
95
101
 
@@ -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,7 +1,11 @@
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
4
- from typing import Any, Optional, Union
8
+ from typing import Any
5
9
 
6
10
  from haystack import logging
7
11
  from haystack.tracing import Span, Tracer
@@ -22,9 +26,7 @@ class WeaveSpan(Span):
22
26
  that describe the operation.
23
27
  """
24
28
 
25
- def __init__(
26
- self, call: Optional[Call] = None, parent: Optional[Call] = None, operation: Optional[str] = None
27
- ) -> None:
29
+ def __init__(self, call: Call | None = None, parent: Call | None = None, operation: str | None = None) -> None:
28
30
  self._call = call
29
31
  self._parent = parent
30
32
  self._operation = operation
@@ -86,12 +88,10 @@ class WeaveTracer(Tracer):
86
88
  )
87
89
 
88
90
  self._client = weave.init(project_name, **weave_init_kwargs)
89
- self._current_span: Optional[WeaveSpan] = None
91
+ self._current_span: WeaveSpan | None = None
90
92
 
91
93
  @staticmethod
92
- def create_call(
93
- attributes: dict, client: WeaveClient, parent_span: Union[WeaveSpan, None], operation_name: str
94
- ) -> Call:
94
+ def create_call(attributes: dict, client: WeaveClient, parent_span: WeaveSpan | None, operation_name: str) -> Call:
95
95
  comp_name = attributes.pop("haystack.component.name", "")
96
96
  comp_type = attributes.pop("haystack.component.type", "")
97
97
  comp_input = attributes.pop("haystack.component.input", {})
@@ -104,18 +104,16 @@ class WeaveTracer(Tracer):
104
104
  )
105
105
  return call
106
106
 
107
- def current_span(self) -> Optional[Span]:
107
+ def current_span(self) -> Span | None:
108
108
  """Get the current active span."""
109
109
  return self._current_span
110
110
 
111
111
  @staticmethod
112
- def _create_component_span(parent_span: Optional[WeaveSpan], operation_name: str) -> WeaveSpan:
112
+ def _create_component_span(parent_span: WeaveSpan | None, operation_name: str) -> WeaveSpan:
113
113
  """Create a span for component runs with deferred call creation."""
114
114
  return WeaveSpan(parent=parent_span.raw_span() if parent_span else None, operation=operation_name)
115
115
 
116
- def _create_regular_span(
117
- self, operation_name: str, tags: Optional[dict], parent_span: Optional[WeaveSpan]
118
- ) -> WeaveSpan:
116
+ def _create_regular_span(self, operation_name: str, tags: dict | None, parent_span: WeaveSpan | None) -> WeaveSpan:
119
117
  """Create a span for regular operations with immediate call creation."""
120
118
  call = self._client.create_call(
121
119
  op=operation_name,
@@ -124,7 +122,7 @@ class WeaveTracer(Tracer):
124
122
  )
125
123
  return WeaveSpan(call=call)
126
124
 
127
- def _finish_component_call(self, span: WeaveSpan, parent_span: Optional[WeaveSpan], operation_name: str) -> None:
125
+ def _finish_component_call(self, span: WeaveSpan, parent_span: WeaveSpan | None, operation_name: str) -> None:
128
126
  """Create and finish call for component runs."""
129
127
  attributes = span.get_attributes()
130
128
  call = self.create_call(
@@ -149,14 +147,14 @@ class WeaveTracer(Tracer):
149
147
  output={key: coerce_tag_value(value) for key, value in pipeline_output.items()},
150
148
  )
151
149
 
150
+ # the current implementation violates the Liskov Substitution Principle by using WeaveSpan instead of Span
151
+ # unfortunately, it seems hard to fix without rewriting the Tracer
152
152
  @contextlib.contextmanager
153
- def trace(
153
+ def trace( # type: ignore[override]
154
154
  self,
155
155
  operation_name: str,
156
- tags: Optional[dict[str, Any]] = None,
157
- # the current implementation violates the Liskov Substitution Principle by using WeaveSpan instead of Span
158
- # unfortunately, it seems hard to fix without rewriting the Tracer
159
- parent_span: Optional[WeaveSpan] = None, # type: ignore[override]
156
+ tags: dict[str, Any] | None = None,
157
+ parent_span: WeaveSpan | None = None,
160
158
  ) -> Iterator[WeaveSpan]:
161
159
  """
162
160
  A context manager that creates and manages spans for tracking operations in Weights & Biases Weave.
@@ -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
@@ -146,6 +150,11 @@ class TestWeaveConnector:
146
150
  error_traces = [args for args in finish_call_args if args[1].get("exception") is not None]
147
151
  assert len(error_traces) > 0
148
152
 
153
+ @pytest.mark.skipif(
154
+ not os.environ.get("WANDB_API_KEY", None),
155
+ reason="Export an env var called WANDB_API_KEY containing the Weights & Bias API key to run this test.",
156
+ )
157
+ @pytest.mark.integration
149
158
  def test_run_method(self) -> None:
150
159
  """Test the basic run method of WeaveConnector"""
151
160
  connector = WeaveConnector(pipeline_name="test_pipeline")
@@ -1,21 +0,0 @@
1
- # Changelog
2
-
3
- ## [integrations/weights_and_biases_weave-v1.0.0] - 2025-07-01
4
-
5
- ### 🐛 Bug Fixes
6
-
7
- - [**breaking**] Weave - move Connector, fix types, add py.typed (#2038)
8
-
9
- ### 🧹 Chores
10
-
11
- - Align core-integrations Hatch scripts (#1898)
12
- - Remove black (#1985)
13
-
14
-
15
- ## [integrations/weights_and_biases_weave-v0.0.1] - 2025-03-28
16
-
17
- ### 🚜 Refactor
18
-
19
- - Renaming the project/package to weights_biases_weave (#1565)
20
-
21
- <!-- generated by git-cliff -->
@@ -1,30 +0,0 @@
1
- loaders:
2
- - type: haystack_pydoc_tools.loaders.CustomPythonLoader
3
- search_path: [../src]
4
- modules: [
5
- "haystack_integrations.components.connectors.weave.weave_connector",
6
- "haystack_integrations.tracing.weave.tracer",
7
- ]
8
- ignore_when_discovered: ["__init__"]
9
- processors:
10
- - type: filter
11
- expression:
12
- documented_only: true
13
- do_not_filter_modules: false
14
- skip_empty_modules: true
15
- - type: smart
16
- - type: crossref
17
- renderer:
18
- type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer
19
- excerpt: Weights & Bias integration for Haystack
20
- category_slug: integrations-api
21
- title: weights and bias
22
- slug: integrations-weights-bias
23
- order: 260
24
- markdown:
25
- descriptive_class_title: false
26
- classdef_code_block: false
27
- descriptive_module_title: true
28
- add_method_class_prefix: true
29
- add_member_class_prefix: false
30
- filename: _readme_weights_and_bias.md