Exemplo n.º 1
0
    def normalized(self):
        """Normalize the list of dependencies
        """
        channels, packages = self.get_channels_packages()

        return Dependencies(conda=packages,
                            pip=kconda.normalize_pip(list(self.pip)),
                            conda_channels=channels)
Exemplo n.º 2
0
    def to_env_dict(self, env_name):
        deps = self.normalized()
        channels, packages = deps.get_channels_packages()

        env_dict = OrderedDict(
            name=env_name,
            channels=channels,
            dependencies=packages +
            [OrderedDict(pip=kconda.normalize_pip(deps.pip))])
        return env_dict
Exemplo n.º 3
0
    def normalized(self):
        """Normalize the list of dependencies
        """
        channels, packages = self._get_channels_packages()
        if isinstance(packages, related.types.TypedSequence):
            packages = packages.list
        if isinstance(channels, related.types.TypedSequence):
            channels = channels.list

        return Dependencies(conda=packages,
                            pip=kconda.normalize_pip(list(self.pip)),
                            conda_channels=channels)
Exemplo n.º 4
0
    def to_env_dict(self, env_name):
        deps = self.normalized()
        channels, packages = deps._get_channels_packages()
        if isinstance(packages, related.types.TypedSequence):
            packages = packages.list
        if isinstance(channels, related.types.TypedSequence):
            channels = channels.list

        env_dict = OrderedDict(
            name=env_name,
            channels=channels,
            dependencies=packages +
            [OrderedDict(pip=kconda.normalize_pip(deps.pip))])
        return env_dict
Exemplo n.º 5
0
    def merge(self, dependencies):
        """Merge one dependencies with another one

        Use case: merging the dependencies of model and dataloader

        Args:
            dependencies: Dependencies instance

        Returns:
            new Dependencies instance
        """
        return Dependencies(
            conda=unique_list(list(self.conda) + list(dependencies.conda)),
            pip=kconda.normalize_pip(list(self.pip) + list(dependencies.pip)),
            conda_channels=unique_list(
                list(self.conda_channels) + list(dependencies.conda_channels)))