Skip to content

Commit f90d251

Browse files
fix(accessor): correct v1.2.1 entry point return type
Fix get_entry_point() method in PackageAccessorV1_2_1 to return the full entry_point dict instead of just the mcp_server value. Root cause: Method was returning metadata.get('entry_point').get('mcp_server') which only returned the string value, but callers expected the full dict with both mcp_server and hatch_mcp_server keys. Solution: Return metadata.get('entry_point', {}) to provide full dict. Update get_mcp_entry_point() to extract mcp_server value from the dict. This fixes test failures in test_package_service.py where entry_point was expected to be a dict but received a string.
1 parent d129b65 commit f90d251

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

hatch_validator/package/v1_2_1/accessor.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,31 @@ def can_handle(self, schema_version: str) -> bool:
3030
return schema_version == "1.2.1"
3131

3232
def get_entry_point(self, metadata):
33-
"""From v1.2.1, returns the same as get_mcp_entry_point().
33+
"""Get the full entry point dict for v1.2.1.
34+
35+
In v1.2.1, entry_point is a dict with mcp_server and hatch_mcp_server keys.
36+
This method returns the full dict to maintain backward compatibility with
37+
code that expects to access both entry points.
3438
3539
Args:
3640
metadata (dict): Package metadata
3741
3842
Returns:
39-
Any: Dual entry point value
43+
dict: Dual entry point dict with mcp_server and hatch_mcp_server keys
4044
"""
41-
return metadata.get('entry_point').get('mcp_server')
42-
45+
return metadata.get('entry_point', {})
46+
4347
def get_mcp_entry_point(self, metadata):
4448
"""Get MCP entry point from metadata.
4549
4650
Args:
4751
metadata (dict): Package metadata
4852
4953
Returns:
50-
Any: MCP entry point value
54+
str: MCP entry point value (e.g., "mcp_server.py")
5155
"""
52-
return self.get_entry_point(metadata)
56+
entry_point = metadata.get('entry_point', {})
57+
return entry_point.get('mcp_server') if isinstance(entry_point, dict) else None
5358

5459
def get_hatch_mcp_entry_point(self, metadata):
5560
"""Get Hatch MCP entry point from metadata.

0 commit comments

Comments
 (0)