Skip to content

Commit e69711b

Browse files
feat(core): add base accessor method for conda channel support
Add get_python_dependency_channel() method to PackageAccessorBase to support retrieving conda channel information from package metadata. This provides the foundation for v1.2.2 schema which introduces conda package manager support with optional channel specification. The method returns None by default, allowing version-specific accessors to override with appropriate implementation.
1 parent 3e7df1e commit e69711b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

hatch_validator/core/pkg_accessor_base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,23 @@ def get_citations(self, metadata: Dict[str, Any]) -> Any:
347347
if self.next_accessor:
348348
return self.next_accessor.get_citations(metadata)
349349
raise NotImplementedError("Citations accessor not implemented for this schema version")
350+
351+
def get_python_dependency_channel(self, dependency: Dict[str, Any]) -> Any:
352+
"""Get channel from a Python dependency.
353+
354+
This method is only available for schema versions >= 1.2.2 which support
355+
conda package manager with channel specification.
356+
357+
Args:
358+
dependency (Dict[str, Any]): Python dependency object
359+
360+
Returns:
361+
Any: Channel value (e.g., "conda-forge", "bioconda")
362+
363+
Raises:
364+
NotImplementedError: If there is no next accessor and this method is not overridden,
365+
or if the schema version does not support channels
366+
"""
367+
if self.next_accessor:
368+
return self.next_accessor.get_python_dependency_channel(dependency)
369+
raise NotImplementedError("Python dependency channel accessor not implemented for this schema version")

0 commit comments

Comments
 (0)