def add_env_spec(project_dir, name, packages, channels):
    """Add an environment with packages from specified channels to the project."""
    project = load_project(project_dir)
    status = project_ops.add_env_spec(project,
                                      name=name,
                                      packages=packages,
                                      channels=channels)
    return _handle_status(
        status, "Added environment {} to the project file.".format(name))
Exemple #2
0
    def add_env_spec(self, project, name, packages, channels):
        """Attempt to create the environment spec and add it to anaconda-project.yml.

        The returned ``Status`` will be an instance of ``SimpleStatus``. A False
        status will have an ``errors`` property with a list of error
        strings.

        Args:
            project (Project): the project
            name (str): environment name
            packages (list of str): packages (with optional version info, as for conda install)
            channels (list of str): channels (as they should be passed to conda --channel)

        Returns:
            ``Status`` instance
        """
        return project_ops.add_env_spec(project=project, name=name, packages=packages, channels=channels)