def generate_requirements_file(path, imports):
    with open(path, 'w') as out_file:
        logging.debug('Writing {num} requirements: {imports} to {file}'.format(num=len(imports), file=path, imports=', '.join([x['name'] for x in imports])))
        fmt = '{name}=={version}'
        out_file.write(('\n'.join(((fmt.format(**item) if item['version'] else '{name}'.format(**item)) for item in imports)) + '\n'))
def generate_requirements_file(path, imports):
    with open(path, 'w') as out_file:
        logging.debug('Writing {num} requirements: {imports} to {file}'.format(num=len(imports), file=path, imports=', '.join([x['name'] for x in imports])))
        fmt = '{name}=={version}'
        out_file.write(('\n'.join(((fmt.format(**item) if item['version'] else '{name}'.format(**item)) for item in imports)) + '\n'))