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.3.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.3.0
File Size Uploaded Provenance Actions
crumpet-0.3.0.tar.gz 71.2 kB With provenance Details for crumpet-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 84.7 kB

Release files / crumpet-0.3.0.tar.gz

Download URL crumpet-0.3.0.tar.gz
Size 71.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1930ac41c43b72b84e3bc847003748f8e05db2502aa5e65708768fdac2f4116f
BLAKE2b-256 checksum
How to use checksums
f11c51681299055327192603b04fb0c0ce79d4e1d56fed5a2f1ea734a57cdb34
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.3.0-py3-none-any.whl

Download URL crumpet-0.3.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
851cf3eb6f444f9d251bd8d764d14fb06ec3505c577acd09615c25046184056c
BLAKE2b-256 checksum
How to use checksums
bbca40424762ca024025f4022d718e8d3cc2b3ee8a0bcd0b39900edcd38fb739
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.3.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.3.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