skillfed

pagefind

Python API for Pagefind

pagefind v1.5.2 2.7M downloads/30d#2,930 on PyPI
Permissive license MIT Active released

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 pagefind

uv

uv add pagefind

poetry

poetry add pagefind

Installing 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

License :: OSI Approved :: MIT LicenseTopic :: Text Processing :: IndexingTopic :: Text Processing :: Markup :: HTML

Tags

static site search indexingfull-text search pythonhtml content indexingasync search indexsite search enginepython indexing api
search-indexingasync-apistatic-sites

More HTML packages