pathspec
https://pypi.org/project/pathspec/
pathspec is a utility library for pattern matching of file paths.
So far this only includes Git’s wildmatch pattern matching which itself is derived from Rsync’s wildmatch.
.gitignoreのファイルパスを除く、というようなことができそう(触りたい)