def main(conda_fname, pip_fname, compare=False):
with open(conda_fname) as conda_fd:<EOL><INDENT>deps = yaml.safe_load(conda_fd)['<STR_LIT>']<EOL><DEDENT>pip_deps = []<EOL>for dep in deps:<EOL><INDENT>if isinstance(dep, str):<EOL><INDENT>conda_dep = conda_package_to_pip(dep)<EOL>if conda_dep:<EOL><INDENT>pip_deps.append(conda_dep)<EOL><DEDENT><DEDENT>elif isinstance(dep, dict) and len(dep) == <NUM_LIT:1> and '<STR_LIT>' in dep:<EOL><INDENT>pip_deps += dep['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(dep))<EOL><DEDENT><DEDENT>pip_content = '<STR_LIT:\n>'.join(pip_deps)<EOL>if compare:<EOL><INDENT>with open(pip_fname) as pip_fd:<EOL><INDENT>return pip_content != pip_fd.read()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>with open(pip_fname, '<STR_LIT:w>') as pip_fd:<EOL><INDENT>pip_fd.write(pip_content)<EOL><DEDENT>return False<EOL><DEDENT>
Generate the pip dependencies file from the conda file, or compare that
they are synchronized (``compare=True``).

Parameters
----------
conda_fname : str
    Path to the conda file with dependencies (e.g. `environment.yml`).
pip_fname : str
    Path to the pip file with dependencies (e.g. `requirements-dev.txt`).
compare : bool, default False
    Whether to generate the pip file (``False``) or to compare if the
    pip file has been generated with this script and the last version
    of the conda file (``True``).

Returns
-------
bool
    True if the comparison fails, False otherwise