github-haystack 1.0.0__tar.gz → 1.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.
- github_haystack-1.1.0/CHANGELOG.md +20 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/PKG-INFO +1 -1
- {github_haystack-1.0.0 → github_haystack-1.1.0}/pyproject.toml +27 -43
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/repo_forker.py +1 -2
- github_haystack-1.1.0/src/haystack_integrations/components/connectors/py.typed +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/issue_commenter_prompt.py +7 -5
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/issue_viewer_prompt.py +6 -6
- github_haystack-1.1.0/src/haystack_integrations/prompts/py.typed +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/file_editor_tool.py +0 -3
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/issue_commenter_tool.py +0 -3
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/issue_viewer_tool.py +0 -3
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/pr_creator_tool.py +0 -3
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/repo_viewer_tool.py +0 -3
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/utils.py +11 -5
- github_haystack-1.1.0/src/haystack_integrations/tools/py.typed +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/.gitignore +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/LICENSE.txt +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/README.md +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/pydoc/config.yml +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/__init__.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/file_editor.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/issue_commenter.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/issue_viewer.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/pr_creator.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/components/connectors/github/repo_viewer.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/__init__.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/context_prompt.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/file_editor_prompt.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/pr_creator_prompt.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/repo_viewer_prompt.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/system_prompt.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/__init__.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/__init__.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_file_editor.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_file_editor_tool.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_issue_commenter.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_issue_commenter_tool.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_issue_viewer.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_issue_viewer_tool.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_pr_creator.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_pr_creator_tool.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_repo_forker.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_repo_viewer.py +0 -0
- {github_haystack-1.0.0 → github_haystack-1.1.0}/tests/test_repo_viewer_tool.py +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [integrations/github-v1.0.1] - 2025-06-12
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes
|
|
6
|
+
|
|
7
|
+
- Prompts and schemas of GitHubIssueCommenterTool and GitHubIssueViewerTool now properly explain url parameter (#1929)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 🧹 Chores
|
|
11
|
+
|
|
12
|
+
- Align core-integrations Hatch scripts (#1898)
|
|
13
|
+
|
|
14
|
+
## [integrations/github-v1.0.0] - 2025-05-28
|
|
15
|
+
|
|
16
|
+
### 🚀 Features
|
|
17
|
+
|
|
18
|
+
- Add GitHub integration with components, tools, and prompts (#1637)
|
|
19
|
+
|
|
20
|
+
<!-- generated by git-cliff -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: github-haystack
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: Haystack components for interacting with GitHub repositories
|
|
5
5
|
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/github
|
|
6
6
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/github/README.md
|
|
@@ -43,41 +43,38 @@ git_describe_command = 'git describe --tags --match="integrations/github-v[0-9]*
|
|
|
43
43
|
|
|
44
44
|
[tool.hatch.envs.default]
|
|
45
45
|
installer = "uv"
|
|
46
|
-
dependencies = [
|
|
47
|
-
|
|
48
|
-
"pytest",
|
|
49
|
-
"pytest-rerunfailures",
|
|
50
|
-
"haystack-pydoc-tools",
|
|
51
|
-
"pytz",
|
|
52
|
-
]
|
|
53
|
-
|
|
46
|
+
dependencies = ["haystack-pydoc-tools", "ruff"]
|
|
47
|
+
|
|
54
48
|
[tool.hatch.envs.default.scripts]
|
|
55
|
-
test = "pytest {args:tests}"
|
|
56
|
-
test-cov = "coverage run -m pytest {args:tests}"
|
|
57
|
-
test-cov-retry = "test-cov --reruns 3 --reruns-delay 30 -x"
|
|
58
|
-
cov-report = ["- coverage combine", "coverage report"]
|
|
59
|
-
cov = ["test-cov", "cov-report"]
|
|
60
|
-
cov-retry = ["test-cov-retry", "cov-report"]
|
|
61
49
|
docs = ["pydoc-markdown pydoc/config.yml"]
|
|
62
|
-
|
|
50
|
+
fmt = "ruff check --fix {args} && ruff format {args}"
|
|
51
|
+
fmt-check = "ruff check {args} && ruff format --check {args}"
|
|
63
52
|
|
|
64
|
-
[tool.hatch.envs.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"black --check --diff {args:.}",
|
|
53
|
+
[tool.hatch.envs.test]
|
|
54
|
+
dependencies = [
|
|
55
|
+
"pytest",
|
|
56
|
+
"pytest-asyncio",
|
|
57
|
+
"pytest-cov",
|
|
58
|
+
"pytest-rerunfailures",
|
|
59
|
+
"mypy",
|
|
60
|
+
"pip"
|
|
73
61
|
]
|
|
74
|
-
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
|
|
75
|
-
all = ["style", "typing"]
|
|
76
62
|
|
|
77
|
-
[tool.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
[tool.hatch.envs.test.scripts]
|
|
64
|
+
unit = 'pytest -m "not integration" {args:tests}'
|
|
65
|
+
integration = 'pytest -m "integration" {args:tests}'
|
|
66
|
+
all = 'pytest {args:tests}'
|
|
67
|
+
cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x'
|
|
68
|
+
|
|
69
|
+
types = """mypy -p haystack_integrations.components.connectors.github \
|
|
70
|
+
-p haystack_integrations.prompts.github \
|
|
71
|
+
-p haystack_integrations.tools.github {args}"""
|
|
72
|
+
|
|
73
|
+
[tool.mypy]
|
|
74
|
+
install_types = true
|
|
75
|
+
non_interactive = true
|
|
76
|
+
check_untyped_defs = true
|
|
77
|
+
disallow_incomplete_defs = true
|
|
81
78
|
|
|
82
79
|
[tool.ruff]
|
|
83
80
|
target-version = "py38"
|
|
@@ -155,22 +152,9 @@ omit = ["*/tests/*", "*/__init__.py"]
|
|
|
155
152
|
show_missing = true
|
|
156
153
|
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
|
|
157
154
|
|
|
158
|
-
|
|
159
|
-
[[tool.mypy.overrides]]
|
|
160
|
-
module = [
|
|
161
|
-
"github.*",
|
|
162
|
-
"haystack.*",
|
|
163
|
-
"haystack_integrations.*",
|
|
164
|
-
"openai.*",
|
|
165
|
-
"pytest.*",
|
|
166
|
-
"numpy.*",
|
|
167
|
-
]
|
|
168
|
-
ignore_missing_imports = true
|
|
169
|
-
|
|
170
155
|
[tool.pytest.ini_options]
|
|
171
156
|
addopts = "--strict-markers"
|
|
172
157
|
markers = [
|
|
173
158
|
"integration: integration tests",
|
|
174
|
-
"unit: unit tests",
|
|
175
159
|
]
|
|
176
160
|
log_cli = true
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
import re
|
|
5
|
+
import time
|
|
5
6
|
from typing import Any, Dict, Optional
|
|
6
7
|
|
|
7
8
|
import requests
|
|
@@ -274,8 +275,6 @@ class GitHubRepoForker:
|
|
|
274
275
|
|
|
275
276
|
# Wait for fork completion if requested
|
|
276
277
|
if self.wait_for_completion:
|
|
277
|
-
import time
|
|
278
|
-
|
|
279
278
|
start_time = time.time()
|
|
280
279
|
|
|
281
280
|
while time.time() - start_time < self.max_wait_seconds:
|
|
File without changes
|
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
ISSUE_COMMENTER_PROMPT = """Haystack-Agent uses this tool to post a comment to a GitHub-issue discussion.
|
|
5
5
|
|
|
6
6
|
<usage>
|
|
7
|
-
Pass a `comment` string to post a comment.
|
|
7
|
+
Pass a `comment` string and a `url` string to post a comment to a GitHub issue.
|
|
8
8
|
</usage>
|
|
9
9
|
|
|
10
10
|
IMPORTANT
|
|
11
|
-
Haystack-Agent MUST pass "comment" to this tool. Otherwise, comment creation fails.
|
|
12
|
-
Haystack-Agent always passes the contents of the comment to the "comment" parameter
|
|
11
|
+
Haystack-Agent MUST pass "comment" and "url" to this tool. Otherwise, comment creation fails.
|
|
12
|
+
Haystack-Agent always passes the contents of the comment to the "comment" parameter and
|
|
13
|
+
the URL of the GitHub issue to the "url" parameter when calling this tool.
|
|
13
14
|
"""
|
|
14
15
|
|
|
15
16
|
ISSUE_COMMENTER_SCHEMA = {
|
|
16
17
|
"properties": {
|
|
17
|
-
"comment": {"type": "string", "description": "The contents of the comment that you want to create."}
|
|
18
|
+
"comment": {"type": "string", "description": "The contents of the comment that you want to create."},
|
|
19
|
+
"url": {"type": "string", "description": "URL of the GitHub issue to comment on."},
|
|
18
20
|
},
|
|
19
|
-
"required": ["comment"],
|
|
21
|
+
"required": ["comment", "url"],
|
|
20
22
|
"type": "object",
|
|
21
23
|
}
|
|
@@ -5,21 +5,21 @@ ISSUE_VIEWER_PROMPT = """Haystack-Agent uses this tool to view a GitHub issue.
|
|
|
5
5
|
Haystack-Agent can view one issue at a time.
|
|
6
6
|
|
|
7
7
|
<usage>
|
|
8
|
-
Pass an `
|
|
9
|
-
It is required to pass `
|
|
8
|
+
Pass an `url` string for the GitHub issue that you want to view.
|
|
9
|
+
It is required to pass `url` to use this tool.
|
|
10
10
|
The structure is "https://github.com/repo-owner/repo-name/issues/issue-number".
|
|
11
11
|
|
|
12
12
|
Examples:
|
|
13
13
|
|
|
14
|
-
- {"
|
|
14
|
+
- {"url": "https://github.com/deepset-ai/haystack/issues/9343"}
|
|
15
15
|
- will show you the issue 9343 of the haystack repository
|
|
16
|
-
- {"
|
|
16
|
+
- {"url": "https://github.com/deepset-ai/haystack-core-integrations/issues/1685"}
|
|
17
17
|
- will show you the issue 1685 of the haystack-core-integrations repository
|
|
18
18
|
</usage>
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
ISSUE_VIEWER_SCHEMA = {
|
|
22
|
-
"properties": {"
|
|
23
|
-
"required": ["
|
|
22
|
+
"properties": {"url": {"type": "string", "description": "URL of the GitHub issue to link the PR to."}},
|
|
23
|
+
"required": ["url"],
|
|
24
24
|
"type": "object",
|
|
25
25
|
}
|
|
File without changes
|
|
@@ -62,9 +62,6 @@ class GitHubFileEditorTool(ComponentTool):
|
|
|
62
62
|
"documents": {"handler": custom_handler}
|
|
63
63
|
}
|
|
64
64
|
"""
|
|
65
|
-
self.name = name
|
|
66
|
-
self.description = description
|
|
67
|
-
self.parameters = parameters
|
|
68
65
|
self.github_token = github_token
|
|
69
66
|
self.repo = repo
|
|
70
67
|
self.branch = branch
|
|
@@ -60,9 +60,6 @@ class GitHubIssueCommenterTool(ComponentTool):
|
|
|
60
60
|
"documents": {"handler": custom_handler}
|
|
61
61
|
}
|
|
62
62
|
"""
|
|
63
|
-
self.name = name
|
|
64
|
-
self.description = description
|
|
65
|
-
self.parameters = parameters
|
|
66
63
|
self.github_token = github_token
|
|
67
64
|
self.raise_on_failure = raise_on_failure
|
|
68
65
|
self.retry_attempts = retry_attempts
|
|
@@ -60,9 +60,6 @@ class GitHubIssueViewerTool(ComponentTool):
|
|
|
60
60
|
"documents": {"handler": custom_handler}
|
|
61
61
|
}
|
|
62
62
|
"""
|
|
63
|
-
self.name = name
|
|
64
|
-
self.description = description
|
|
65
|
-
self.parameters = parameters
|
|
66
63
|
self.github_token = github_token
|
|
67
64
|
self.raise_on_failure = raise_on_failure
|
|
68
65
|
self.retry_attempts = retry_attempts
|
|
@@ -58,9 +58,6 @@ class GitHubPRCreatorTool(ComponentTool):
|
|
|
58
58
|
"documents": {"handler": custom_handler}
|
|
59
59
|
}
|
|
60
60
|
"""
|
|
61
|
-
self.name = name
|
|
62
|
-
self.description = description
|
|
63
|
-
self.parameters = parameters
|
|
64
61
|
self.github_token = github_token
|
|
65
62
|
self.raise_on_failure = raise_on_failure
|
|
66
63
|
self.outputs_to_string = outputs_to_string
|
|
@@ -67,9 +67,6 @@ class GitHubRepoViewerTool(ComponentTool):
|
|
|
67
67
|
"documents": {"handler": custom_handler}
|
|
68
68
|
}
|
|
69
69
|
"""
|
|
70
|
-
self.name = name
|
|
71
|
-
self.description = description
|
|
72
|
-
self.parameters = parameters
|
|
73
70
|
self.github_token = github_token
|
|
74
71
|
self.repo = repo
|
|
75
72
|
self.branch = branch
|
{github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/utils.py
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
-
from typing import Any, Callable, Dict, List, Union
|
|
5
|
+
from typing import Any, Callable, Dict, List, Optional, Union
|
|
6
6
|
|
|
7
7
|
from haystack import Document
|
|
8
8
|
from haystack.utils.callable_serialization import deserialize_callable, serialize_callable
|
|
@@ -20,10 +20,10 @@ def message_handler(documents: List[Document], max_length: int = 150_000) -> str
|
|
|
20
20
|
result_str = ""
|
|
21
21
|
for document in documents:
|
|
22
22
|
if document.meta["type"] in ["file", "dir", "error"]:
|
|
23
|
-
result_str += document.content + "\n"
|
|
23
|
+
result_str += document.content or "" + "\n"
|
|
24
24
|
else:
|
|
25
25
|
result_str += f"File Content for {document.meta['path']}\n\n"
|
|
26
|
-
result_str += document.content
|
|
26
|
+
result_str += document.content or ""
|
|
27
27
|
|
|
28
28
|
if len(result_str) > max_length:
|
|
29
29
|
result_str = result_str[:max_length] + "...(large file can't be fully displayed)"
|
|
@@ -33,8 +33,8 @@ def message_handler(documents: List[Document], max_length: int = 150_000) -> str
|
|
|
33
33
|
|
|
34
34
|
def serialize_handlers(
|
|
35
35
|
serialized: Dict[str, Any],
|
|
36
|
-
outputs_to_state: Dict[str, Dict[str, Union[str, Callable]]],
|
|
37
|
-
outputs_to_string: Dict[str, Union[str, Callable[[Any], str]]],
|
|
36
|
+
outputs_to_state: Optional[Dict[str, Dict[str, Union[str, Callable]]]],
|
|
37
|
+
outputs_to_string: Optional[Dict[str, Union[str, Callable[[Any], str]]]],
|
|
38
38
|
) -> None:
|
|
39
39
|
"""
|
|
40
40
|
Serializes callable handlers in outputs_to_state and outputs_to_string.
|
|
@@ -48,12 +48,18 @@ def serialize_handlers(
|
|
|
48
48
|
for key, config in outputs_to_state.items():
|
|
49
49
|
serialized_config = config.copy()
|
|
50
50
|
if "handler" in config:
|
|
51
|
+
if not callable(config["handler"]):
|
|
52
|
+
msg = f"Handler for outputs_to_state[{key}] is not a callable"
|
|
53
|
+
raise ValueError(msg)
|
|
51
54
|
serialized_config["handler"] = serialize_callable(config["handler"])
|
|
52
55
|
serialized_outputs[key] = serialized_config
|
|
53
56
|
serialized["outputs_to_state"] = serialized_outputs
|
|
54
57
|
|
|
55
58
|
if outputs_to_string is not None and "handler" in outputs_to_string:
|
|
56
59
|
serialized_string = outputs_to_string.copy()
|
|
60
|
+
if not callable(outputs_to_string["handler"]):
|
|
61
|
+
msg = "Handler for outputs_to_string is not a callable"
|
|
62
|
+
raise ValueError(msg)
|
|
57
63
|
serialized_string["handler"] = serialize_callable(outputs_to_string["handler"])
|
|
58
64
|
serialized["outputs_to_string"] = serialized_string
|
|
59
65
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/prompts/github/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{github_haystack-1.0.0 → github_haystack-1.1.0}/src/haystack_integrations/tools/github/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|