def is_local_pip_requirement(line):
    """Return whether a pip requirement (e.g. in requirements.txt file) references a local file"""
    # trim comments and skip empty lines
    line = line.split("#", 1)[0].strip()
    if not line:
        return False
    if line.startswith(("-r", "-c")):
        # local -r or -c references break isolation
        return True
    if line.startswith(("--requirement", "--constraint")):
        # as above but flags are spelt out
        return True
    # strip off things like `--editable=`. Long form arguments require a =
    if line.startswith("--"):
        line = line.split("=", 1)[1]
    # strip off short form arguments like `-e`. Short form arguments can be
    # followed by a space `-e foo` or use `-e=foo`. The latter is not handled
    # here. We can deal with it when we see someone using it.
    if line.startswith("-"):
        line = line.split(None, 1)[1]
    if "file://" in line:
        # file references break isolation
        return True
    if "://" in line:
        # handle git://../local/file
        path = line.split("://", 1)[1]
    else:
        path = line
    if path.startswith("."):
        # references a local file
        return True
    return False