from pathlib import Path from pathspec import PathSpec DEFAULT_IGNORE = [ ".git", "node_modules", ".venv", "__pycache__", ] def create_ignore(basepath: Path) -> PathSpec: lines = DEFAULT_IGNORE.copy() gitignore = basepath / ".gitignore" if gitignore.exists(): with open(gitignore, "r") as fd: lines += fd.readlines() return PathSpec.from_lines("gitignore", lines)