Skip to content

Commit 277d123

Browse files
julian-rischclaude
andauthored
chore: enforce ruff docstring rules (D102/D103/D205/D209/D213/D417/D419) in integrations 41-47 (#3012)
Adds D102, D103, D205, D209, D213, D417, D419 ruff rules to pyproject.toml for: stackit, togetherai, unstructured, valkey, watsonx, weave, weaviate. Fixes all resulting docstring violations. Part of #2947 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f64d6e9 commit 277d123

File tree

19 files changed

+105
-20
lines changed

19 files changed

+105
-20
lines changed

integrations/stackit/pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ select = [
8484
"ARG",
8585
"B",
8686
"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
8794
"DTZ",
8895
"E",
8996
"EM",
@@ -132,7 +139,7 @@ ban-relative-imports = "parents"
132139

133140
[tool.ruff.lint.per-file-ignores]
134141
# Tests can use magic values, assertions, and relative imports
135-
"tests/**/*" = ["ANN", "PLR2004", "S101", "TID252"]
142+
"tests/**/*" = ["D", "ANN", "PLR2004", "S101", "TID252"]
136143

137144
[tool.coverage.run]
138145
source = ["haystack_integrations"]

integrations/stackit/src/haystack_integrations/components/embedders/stackit/document_embedder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
class STACKITDocumentEmbedder(OpenAIDocumentEmbedder):
1313
"""
1414
A component for computing Document embeddings using STACKIT as model provider.
15+
1516
The embedding of each Document is stored in the `embedding` field of the Document.
1617
1718
Usage example:
@@ -110,6 +111,7 @@ def __init__(
110111
def to_dict(self) -> dict[str, Any]:
111112
"""
112113
Serializes the component to a dictionary.
114+
113115
:returns:
114116
Dictionary with serialized data.
115117
"""

integrations/stackit/src/haystack_integrations/components/embedders/stackit/text_embedder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def __init__(
8686
def to_dict(self) -> dict[str, Any]:
8787
"""
8888
Serializes the component to a dictionary.
89+
8990
:returns:
9091
Dictionary with serialized data.
9192
"""

integrations/togetherai/pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ select = [
9191
"ARG",
9292
"B",
9393
"C",
94+
"D102", # Missing docstring in public method
95+
"D103", # Missing docstring in public function
96+
"D205", # 1 blank line required between summary line and description
97+
"D209", # Closing triple quotes go to new line
98+
"D213", # summary lines must be positioned on the second physical line of the docstring
99+
"D417", # Missing argument descriptions in the docstring
100+
"D419", # Docstring is empty
94101
"DTZ",
95102
"E",
96103
"EM",
@@ -136,10 +143,10 @@ ban-relative-imports = "parents"
136143

137144
[tool.ruff.lint.per-file-ignores]
138145
# Tests can use magic values, assertions, and relative imports
139-
"examples/**/*" = ["ANN"]
140-
"tests/**/*" = ["ANN", "PLR2004", "S101", "TID252"]
146+
"examples/**/*" = ["D", "ANN"]
147+
"tests/**/*" = ["D", "ANN", "PLR2004", "S101", "TID252"]
141148
# Examples can print their output
142-
"examples/**" = ["T201"]
149+
"examples/**" = ["D", "T201"]
143150

144151

145152
[tool.coverage.run]

integrations/togetherai/src/haystack_integrations/components/generators/togetherai/chat/chat_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
class TogetherAIChatGenerator(OpenAIChatGenerator):
2121
"""
2222
Enables text generation using Together AI generative models.
23+
2324
For supported models, see [Together AI docs](https://docs.together.ai/docs).
2425
2526
Users can pass any text generation parameters valid for the Together AI chat completion API
@@ -72,8 +73,7 @@ def __init__(
7273
http_client_kwargs: dict[str, Any] | None = None,
7374
) -> None:
7475
"""
75-
Creates an instance of TogetherAIChatGenerator. Unless specified otherwise,
76-
the default model is `meta-llama/Llama-3.3-70B-Instruct-Turbo`.
76+
Creates an instance of TogetherAIChatGenerator.
7777
7878
:param api_key:
7979
The Together API key.

integrations/unstructured/pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ select = [
9191
"ARG",
9292
"B",
9393
"C",
94+
"D102", # Missing docstring in public method
95+
"D103", # Missing docstring in public function
96+
"D205", # 1 blank line required between summary line and description
97+
"D209", # Closing triple quotes go to new line
98+
"D213", # summary lines must be positioned on the second physical line of the docstring
99+
"D417", # Missing argument descriptions in the docstring
100+
"D419", # Docstring is empty
94101
"DTZ",
95102
"E",
96103
"EM",
@@ -139,7 +146,7 @@ ban-relative-imports = "parents"
139146

140147
[tool.ruff.lint.per-file-ignores]
141148
# Tests can use magic values, assertions, and relative imports
142-
"tests/**/*" = ["ANN", "PLR2004", "S101", "TID252"]
149+
"tests/**/*" = ["D", "ANN", "PLR2004", "S101", "TID252"]
143150

144151
[tool.coverage.run]
145152
source = ["haystack_integrations"]

integrations/unstructured/src/haystack_integrations/components/converters/unstructured/converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def to_dict(self) -> dict[str, Any]:
115115
def from_dict(cls, data: dict[str, Any]) -> "UnstructuredFileConverter":
116116
"""
117117
Deserializes the component from a dictionary.
118+
118119
:param data:
119120
Dictionary to deserialize from.
120121
:returns:

integrations/valkey/pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ select = [
8989
"ARG",
9090
"B",
9191
"C",
92+
"D102", # Missing docstring in public method
93+
"D103", # Missing docstring in public function
94+
"D205", # 1 blank line required between summary line and description
95+
"D209", # Closing triple quotes go to new line
96+
"D213", # summary lines must be positioned on the second physical line of the docstring
97+
"D417", # Missing argument descriptions in the docstring
98+
"D419", # Docstring is empty
9299
"DTZ",
93100
"E",
94101
"EM",
@@ -146,8 +153,8 @@ ban-relative-imports = "parents"
146153

147154
[tool.ruff.lint.per-file-ignores]
148155
# Tests can use magic values, assertions, and relative imports
149-
"examples/**/*" = ["ANN", "T201"]
150-
"tests/**/*" = ["ANN", "PLR2004", "S101", "TID252"]
156+
"examples/**/*" = ["D", "ANN", "T201"]
157+
"tests/**/*" = ["D", "ANN", "PLR2004", "S101", "TID252"]
151158

152159
[tool.coverage.run]
153160
source = ["haystack_integrations"]

integrations/valkey/src/haystack_integrations/components/retrievers/valkey/embedding_retriever.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def __init__(
9191
def to_dict(self) -> dict[str, Any]:
9292
"""
9393
Serializes the component to a dictionary.
94+
9495
:returns:
9596
Dictionary with serialized data.
9697
"""
@@ -106,6 +107,7 @@ def to_dict(self) -> dict[str, Any]:
106107
def from_dict(cls, data: dict[str, Any]) -> "ValkeyEmbeddingRetriever":
107108
"""
108109
Deserializes the component from a dictionary.
110+
109111
:param data:
110112
Dictionary to deserialize from.
111113
:returns:

integrations/valkey/src/haystack_integrations/document_stores/valkey/document_store.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ async def _get_connection_async(self) -> GlideClient | GlideClusterClient:
280280
raise ValkeyDocumentStoreError(msg) from e
281281

282282
def close(self) -> None:
283+
"""Close the synchronous Valkey client connection."""
283284
if self._client:
284285
try:
285286
self._client.close()
@@ -289,6 +290,7 @@ def close(self) -> None:
289290
self._client = None
290291

291292
async def close_async(self) -> None:
293+
"""Close the asynchronous Valkey client connection."""
292294
if self._async_client:
293295
try:
294296
await self._async_client.close()

0 commit comments

Comments
 (0)