def publish(idx=None):
    """Publish packaged distributions to pypi index"""
    if idx is None:
        idx = ''
    else:
        idx = '-r ' + idx
    run('python setup.py register {}'.format(idx))
    run('twine upload {} dist/*.whl dist/*.egg dist/*.tar.gz'.format(idx))