Skip to content

Installation

searchpath requires Python 3.10 or later.

Basic installation

pip install searchpath
uv add searchpath
poetry add searchpath

Dependencies

searchpath has minimal dependencies to keep your dependency tree lean:

Package Purpose
typing-extensions Backports of typing features for Python < 3.12

Optional dependencies

gitignore patterns

For full gitignore-style pattern matching via the GitignoreMatcher class, install with the extra:

pip install 'searchpath[gitignore]'
uv add 'searchpath[gitignore]'
poetry add 'searchpath[gitignore]'

This adds the pathspec library, which provides full gitignore compatibility including negation patterns (!pattern), directory-only patterns (pattern/), and anchored patterns (/pattern).

When to use GitignoreMatcher

The default GlobMatcher handles most use cases. Use GitignoreMatcher when you need:

  • Negation patterns to un-ignore previously matched paths
  • Directory-only patterns that match only directories
  • Anchored patterns that match from the root only
  • Full gitignore file compatibility

Install from repository

To install the latest development version directly from GitHub:

pip install git+https://github.com/tbhb/searchpath.git
uv add git+https://github.com/tbhb/searchpath.git
poetry add git+https://github.com/tbhb/searchpath.git