pagefind
Python API for Pagefind
What it is and what it does
Pagefind is an async Python wrapper that lets you build searchable indexes from HTML files and custom content records. It exposes a clean async API for adding HTML files, custom records, or entire directories, and retrieving indexed file metadata. The package handles communication with an underlying binary process, letting you control output paths, logging, and which DOM elements to index through the IndexConfig object.
You use it when you need full-text search on static content—typically for documentation sites, blogs, or knowledge bases where you want to avoid running a separate search service. The async design means you can index multiple sources concurrently, making it suitable for batch indexing pipelines and build-time content processing.
Use it for:
- Index a static documentation site and expose search to readers without a backend search service.
- Build a searchable archive of HTML pages or exported content in a batch indexing pipeline.
- Add full-text search to a static site by pre-indexing content during the build step.
- Index custom metadata records alongside HTML files to create a unified search index.
- Programmatically index and re-index content as part of a content management workflow.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides an async Python API to index and search HTML content, enabling full-text search indexing of static sites and custom content.
Yes. Low install friction, no runtime dependencies, active maintenance, MIT license, and zero known vulnerabilities make it a safe choice. Install it if you need to index HTML or custom content for search—particularly valuable for static site generators and documentation platforms where you want search without infrastructure overhead.
Install
pagefind on PyPI
pip
pip install pagefinduv
uv add pagefindpoetry
poetry add pagefindInstalling pagefind
Before you install
Low friction install with no runtime dependencies. Active maintenance status with recent releases.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install 'pagefind[bin]'
import asyncio
from pagefind.index import PagefindIndex, IndexConfig
async def main():
config = IndexConfig(output_path="./output")
async with PagefindIndex(config=config) as index:
result = await index.add_html_file(
content="<html><body>Example</body></html>",
url="https://example.com"
)
asyncio.run(main())
Requires Python 3.9 or later; the [bin] extra installs the underlying binary.
Verify before relying
- Whether the binary is automatically downloaded or requires separate installation when using the [bin] extra.
- Performance characteristics when indexing large HTML document collections.
- Search query syntax and filtering capabilities available through the API.
- Whether add_directory, add_html_file, and add_custom_record methods support concurrent execution beyond the example shown.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 124 days since the last release |
| First released | |
| Downloads | 2,707,561/month — #2,930 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pagefind-1.5.2-py3-none-any.whl
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
pagefind-binPagefind-bin provides a precompiled binary…
permissive · top 5,000 on PyPI
typesensePython client library for Typesense search…
permissive · top 5,000 on PyPI
algoliasearchA Python HTTP client for interacting with…
permissive · top 5,000 on PyPI
Whoosh-ReloadedWhoosh-Reloaded is a pure-Python full-text…
permissive · top 15,000 on PyPI
meilisearch-python-sdkProvides both async and sync Python clients for…
permissive · top 15,000 on PyPI
WhooshWhoosh is a pure-Python full-text search and…
permissive · top 5,000 on PyPI
turbopufferProvides a Python client library for the…
permissive · top 5,000 on PyPI
lunrLunr is a lightweight, in-memory full-text…
permissive · top 15,000 on PyPI
readable-contentExtracts the main article content from web…
permissive · top 15,000 on PyPI
meilisearchPython client library for the Meilisearch API,…
permissive · top 5,000 on PyPI