Skip to content

Commit fee28e5

Browse files
authored
Merge pull request #252 from AgentOps-AI/neon-fix
[bug] add version to neon dependency and add check
2 parents de17eaf + c80b727 commit fee28e5

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

agentstack/_tools/neon/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"dependencies": [
99
"neon-api>=0.1.5",
10-
"psycopg2-binary"
10+
"psycopg2-binary==2.9.10"
1111
],
1212
"tools": ["create_database", "execute_sql_ddl", "run_sql_query"],
1313
"cta": "Create an API key at https://www.neon.tech"

tests/test_tool_config.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import json
22
import unittest
3+
import re
34
from pathlib import Path
45
from agentstack._tools import ToolConfig, get_all_tool_paths, get_all_tool_names
56

67
BASE_PATH = Path(__file__).parent
78

8-
99
class ToolConfigTest(unittest.TestCase):
1010
def test_minimal_json(self):
1111
config = ToolConfig.from_json(BASE_PATH / "fixtures/tool_config_min.json")
@@ -29,6 +29,20 @@ def test_maximal_json(self):
2929
assert config.post_install == "install.sh"
3030
assert config.post_remove == "remove.sh"
3131

32+
def test_dependency_versions(self):
33+
"""Test that all dependencies specify a version constraint."""
34+
for tool_name in get_all_tool_names():
35+
config = ToolConfig.from_tool_name(tool_name)
36+
37+
if hasattr(config, 'dependencies') and config.dependencies:
38+
version_pattern = r'[><=~!]=|[@><=~!]'
39+
for dep in config.dependencies:
40+
if not re.search(version_pattern, dep):
41+
raise AssertionError(
42+
f"Dependency '{dep}' in {config.name} does not specify a version constraint. "
43+
"All dependencies must include version specifications."
44+
)
45+
3246
def test_all_json_configs_from_tool_name(self):
3347
for tool_name in get_all_tool_names():
3448
config = ToolConfig.from_tool_name(tool_name)
@@ -41,8 +55,8 @@ def test_all_json_configs_from_tool_path(self):
4155
config = ToolConfig.from_json(f"{path}/config.json")
4256
except json.decoder.JSONDecodeError:
4357
raise Exception(
44-
f"Failed to decode tool json at {path}. Does your tool config fit the required formatting? https://github.com/AgentOps-AI/AgentStack/blob/main/agentstack/tools/~README.md"
58+
f"Failed to decode tool json at {path}. Does your tool config fit the required formatting? "
59+
"https://github.com/AgentOps-AI/AgentStack/blob/main/agentstack/tools/~README.md"
4560
)
4661

4762
assert config.name == path.stem
48-
# We can assume that pydantic validation caught any other issues

0 commit comments

Comments
 (0)