from __future__ import annotations
from enum import Enum
__all__ = ["ReqSpec", "CondaReqSpec", "PyPIReqSpec"]
class Repository(Enum):
Conda = "conda"
PyPI = "pypi"
[docs]class ReqSpec:
def __init__(
self,
package: str,
repository: Repository,
channel: list[str],
constraints: list[str],
):
self.package = package
self.repository = repository
self.channel = channel
self.constraints = constraints
[docs]class CondaReqSpec(ReqSpec):
def __init__(self, package: str, channel: list[str], constraints: list[str]):
super().__init__(
package=package,
repository=Repository.Conda,
channel=channel,
constraints=constraints,
)
[docs]class PyPIReqSpec(ReqSpec):
def __init__(self, package: str, channel: list[str], constraints: list[str]):
super().__init__(
package=package,
repository=Repository.PyPI,
channel=None,
constraints=constraints,
)