def upgrade(bin_env=None,
            user=None,
            cwd=None,
            use_vt=False):
    ret = {'changes': {},
           'result': True,
           'comment': '',
           }
    pip_bin = _get_pip_bin(bin_env)

    old = list_(bin_env=bin_env, user=user, cwd=cwd)

    cmd = [pip_bin, 'install', '-U']
    cmd_kwargs = dict(cwd=cwd, use_vt=use_vt)
    if bin_env and os.path.isdir(bin_env):
        cmd_kwargs['env'] = {'VIRTUAL_ENV': bin_env}
    errors = False
    for pkg in list_upgrades(bin_env=bin_env, user=user, cwd=cwd):
        result = __salt__['cmd.run_all'](cmd + [pkg], **cmd_kwargs)
        if result['retcode'] != 0:
            errors = True
        if 'stderr' in result:
            ret['comment'] += result['stderr']
    if errors:
        ret['result'] = False

    new = list_(bin_env=bin_env, user=user, cwd=cwd)

    ret['changes'] = salt.utils.compare_dicts(old, new)

    return ret
.. versionadded:: 2015.5.0
dataset/ETHPy150Open saltstack/salt/salt/modules/pip.py/upgrade