from pathlib import Path


def get_non_empty_lines_stripping_comments(path: Path):
    """
    :param path: file to read
    :return: Lines in the file, stripping off any thing from "#" onwards, then discarding whitespace-only lines.
    """
    with path.open() as fh:
        env_lines = [line.split("#", 1)[0].rstrip() for line in fh]
        return [line for line in env_lines if line]