Skip to content

Commit d129b65

Browse files
feat(service): add conda channel retrieval to PackageService
Add get_python_dependency_channel() method to PackageService to expose conda channel information through the service layer. This method delegates to the version-specific accessor, enabling clients to retrieve channel information for conda packages in v1.2.2 schema while maintaining backward compatibility with earlier versions that return None.
1 parent bf73160 commit d129b65

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

hatch_validator/package/package_service.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,23 @@ def get_tools(self) -> Any:
160160
if not self.is_loaded():
161161
raise ValueError("Package metadata is not loaded.")
162162
return self._accessor.get_tools(self._metadata)
163+
164+
def get_python_dependency_channel(self, dependency: Dict[str, Any]) -> Any:
165+
"""Get channel from a Python dependency.
166+
167+
This method is only available for schema versions >= 1.2.2 which support
168+
conda package manager with channel specification.
169+
170+
Args:
171+
dependency (Dict[str, Any]): Python dependency object
172+
173+
Returns:
174+
Any: Channel value (e.g., "conda-forge", "bioconda"), or None if not specified
175+
176+
Raises:
177+
ValueError: If metadata is not loaded.
178+
NotImplementedError: If the schema version does not support channels.
179+
"""
180+
if not self.is_loaded():
181+
raise ValueError("Package metadata is not loaded.")
182+
return self._accessor.get_python_dependency_channel(dependency)

0 commit comments

Comments
 (0)