Skip to main content

Crumpet

CI Coverage

A cosy web server for local files.

Crumpet previews a static site while you build it, and reloads open pages when files change. Run it from the command line, or from inside your own Python program.

Quick start

pip install crumpet
crumpet ./public

Open http://localhost:8000/, and every page reloads whenever anything in the public directory changes.

Or, serve from your own script, and reload pages when you're ready:

from pathlib import Path

from crumpet import Server

site = Path("public")
site.mkdir(exist_ok=True)

with Server(site, port=8000) as server:
    input(f"Open {server.url}, then press Enter to build: ")
    (site / "index.html").write_text("<h1>Built</h1>")
    server.reload()  # The open page reloads, and shows "Built"
    input("Press Enter to stop: ")

Features

  • Reloads open pages when files change. Crumpet waits for a burst of changes to settle, so pages only show the finished build.
  • Runs inside your program. Serve in a with block, rebuild, and call server.reload().
  • Works with a strict Content Security Policy. The reload script loads from the server, not inline.
  • Lists directories, like python -m http.server, and reloads them too.
  • Never shows stale files. Every response is sent with Cache-Control: no-store.
  • Small and typed. It's built on Python's own http.server, checked with strict pyright, and tested on Linux, macOS, and Windows.

See how Crumpet compares with livereload and http.server.

Why NOT use Crumpet?

  • You want to host a public website. Crumpet is a local development server only.
  • You use Python earlier than 3.14. Crumpet supports modern Python only.
  • You want efficient replacement of style sheets. livereload is clever about replacing style sheets without reloading pages. Crumpet will just reload the page.

Usage

Preview a directory from the command line

crumpet [DIRECTORY] [--port PORT]

DIRECTORY defaults to the current working directory, and PORT to 8000. Crumpet serves until you press Ctrl+C.

For example, to preview your public subdirectory on port 8001:

crumpet public --port 8001

Preview a directory from a Python script

watch=True reloads every open page whenever anything in the directory changes:

from crumpet import Server

with Server("public", port=8001, watch=True) as server:
    print(f"Serving at {server.url}")
    server.wait()  # Serve until Ctrl+C

Documentation

The full documentation, including the Python API, is at cariad.github.io/crumpet.

Contributing

Ideas, questions and bug reports are always welcome as issues, even if you don't want to write the code yourself.

If you'd like to make a change, please open an issue first so we can agree on the approach. I'm unlikely to accept a pull request for work that hasn't been discussed.

AI-assisted contributions are welcome. CONTRIBUTING.md explains how to set up a development environment with mise, and how to lint and test.

Licence

MIT. See LICENSE.

Metadata

Release files for crumpet 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crumpet 0.4.0
File Size Uploaded Provenance Actions
crumpet-0.4.0.tar.gz 72.0 kB With provenance Details for crumpet-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for crumpet 0.4.0
File Interpreter ABI Platform Actions
crumpet-0.4.0-py3-none-any.whl Python 3 none any Details for crumpet-0.4.0-py3-none-any.whl

Total release size: 85.7 kB

Release files / crumpet-0.4.0.tar.gz

Download URL crumpet-0.4.0.tar.gz
Size 72.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bdfc5139e177c4f2941795f7d8fa573e7e716c463ecff5cfaad8fd3fa9108790
BLAKE2b-256 checksum
How to use checksums
d4cfca5047d3c94d1efd77b241a653fd5009a2ef267616e679f84a34b3ca4680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / crumpet-0.4.0-py3-none-any.whl

Download URL crumpet-0.4.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
243db422d74ebb8cfd5a869f8fe2723d28e4eac2f28fa60c6c2ee08731131d51
BLAKE2b-256 checksum
How to use checksums
b6fe9dd079b2a9e779f80ef08225028ca940eea59c9e0120efcecdfc080ffb65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for crumpet 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for crumpet-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page