Given a requirements.txt (or similar style file), returns a list of requirements.

    Assumes anything after a single '#' on a line is a comment, and ignores
    empty lines.

def read_requirements(*parts):
    """
    Given a requirements.txt (or similar style file), returns a list of requirements.

    Assumes anything after a single '#' on a line is a comment, and ignores
    empty lines.
    """
    requirements = []
    for line in read(*parts).splitlines():
        new_line = re.sub(r'(\s*)?#.*$',  # the space immediately before the
                                          # hash mark, the hash mark, and
                                          # anything that follows it
                          '',  # replace with a blank string
                          line)
        if new_line:  # i.e. we have a non-zero-length string
            requirements.append(new_line)
    return requirements