Example #1
0
    def remove_packages(self, project, env_spec_name, packages):
        """Attempt to remove packages from an environment spec in anaconda-project.yml.

        If the environment spec name is None rather than an env
        name, packages are removed from the global
        packages section (from all environments).

        The returned ``Status`` should be a ``RequirementStatus`` for
        the environment requirement if it evaluates to True (on success),
        but may be another subtype of ``Status`` on failure. A False
        status will have an ``errors`` property with a list of error
        strings.

        Args:
            project (Project): the project
            env_spec_name (str): environment name or None for all environments
            packages (list of str): packages

        Returns:
            ``Status`` instance

        """
        return project_ops.remove_packages(project=project,
                                           env_spec_name=env_spec_name,
                                           packages=packages)
Example #2
0
def remove_packages(project, environment, packages):
    """Remove packages from the project."""
    project = load_project(project)
    status = project_ops.remove_packages(project, env_spec_name=environment, packages=packages)
    package_list = ", ".join(packages)
    if environment is None:
        success_message = "Removed packages from project file: %s." % (package_list)
    else:
        success_message = "Removed packages from environment %s in project file: %s." % (environment, package_list)
    return _handle_status(status, success_message)