Skip to main content

🔥 superreload

True hot reload for Django and Python web frameworks — no server restart needed.

superreload watches your Python files and automatically reloads modules when they change, then refreshes your browser via WebSocket. This dramatically speeds up the development feedback loop.

Features

  • Instant reload: Python modules reload without restarting the server
  • Browser auto-refresh: WebSocket-based browser refresh on file changes
  • CSS hot reload: Stylesheets update without page refresh
  • Error overlay: Beautiful error display with stack traces and local variables
  • Keyboard shortcuts: Manual reload via Ctrl+Shift+R (browser) or 'r' + Enter (console)
  • Django-first: Deep Django integration with view, template, and URL cache clearing
  • Script mode: Run any Python script with hot reloading via CLI
  • Gitignore support: Automatically exclude files matching .gitignore patterns
  • Extensible: Framework-agnostic core with pluggable framework adapters
  • Zero config: Works out of the box with sensible defaults

Installation

pip install superreload[django]

Or with uv:

uv add superreload[django]

Quick Start (Django)

1. Add to INSTALLED_APPS

# settings.py

INSTALLED_APPS = [
    # ...
    'superreload.frameworks.django',
    # ...
]

2. Add the Middleware

# settings.py

MIDDLEWARE = [
    'superreload.frameworks.django.SuperReloadMiddleware',
    # ... other middleware
]

3. Run the Development Server

python manage.py superreload

Or with an address:

python manage.py superreload 0.0.0.0:8000

That's it! Edit any Python, HTML, CSS, or JS file and watch your browser update automatically.

How It Works

  1. File Watcher: Monitors your project for .py, .html, .css, .js changes
  2. Module Reloader: Intelligently reloads changed Python modules and their dependents
  3. WebSocket Server: Notifies connected browsers to refresh
  4. Middleware: Injects a tiny JavaScript client into HTML responses
  5. CSS Hot Reload: Swaps stylesheets without full page refresh
  6. Error Overlay: Shows reload errors with full stack traces in the browser

Configuration

WebSocket Host and Port

Default is localhost:9877. Change it via:

python manage.py superreload --ws-host 0.0.0.0:9999

WebSocket Path

Default path is /superreload. Useful for Docker/reverse proxy setups:

python manage.py superreload --ws-path /my-custom-path

Disable superreload

Run without hot reloading:

python manage.py superreload --no-reload

Manual Reload

Trigger a manual reload at any time:

  • Browser: Press Ctrl+Shift+R (or Cmd+Shift+R on Mac)
  • Console: Press r + Enter in the terminal running superreload

Production

The middleware only activates when DEBUG = True. In production, it does nothing.

Running Python Scripts

Run any Python script with hot reloading (no framework required):

superreload run script.py

By default, superreload uses jurigged for surgical code patching - your functions and classes are updated in-place while preserving state.

Watch Directories

# Watch additional directories
superreload run script.py --watch src/ --watch lib/

# Watch project, respecting .gitignore
superreload run script.py --watch . --gitignore

Reload Modes

# Default: jurigged (surgical patching, preserves state)
superreload run script.py

# Simple mode: re-execute on change (no state preservation)
superreload run script.py --simple

# Full restart: restart process on any change
superreload run script.py --full-reload

Pass Arguments to Your Script

superreload run server.py -- --port 8080 --debug
Mode Behavior State Preserved
Default (jurigged) Surgical code patching Yes
--simple Re-execute script No
--full-reload Process restart No

Supported Frameworks

  • ✅ Django (4.2+)
  • 🔜 Flask (coming soon)
  • 🔜 FastAPI (coming soon)

Requirements

  • Python 3.9+
  • Django 4.2+ (for Django integration)

Development

# Clone the repo
git clone https://github.com/aareman/superreload.git
cd superreload

# Install dependencies
uv sync --dev

# Run tests
uv run pytest

# Lint
uv run ruff check src tests

# Type check
uv run mypy src

Architecture

superreload/
├── cli.py              # CLI entry point ('run' command)
├── core/
│   ├── errors.py       # Error formatting with local variables
│   ├── framework.py    # Base framework abstraction
│   ├── gitignore.py    # Parse .gitignore files for filtering
│   ├── reloader.py     # Python module reloading
│   ├── script_runner.py # Run scripts with hot reload/restart
│   ├── watcher.py      # File system watching
│   └── websocket.py    # WebSocket server
└── frameworks/
    └── django/
        ├── framework.py      # Django-specific reload logic
        ├── middleware.py     # Auto-inject JS client + error overlay
        └── reload_server.py  # Orchestrates everything

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

Metadata

Release files for superreload 2.0.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 superreload 2.0.0
File Size Uploaded Provenance
superreload-2.0.0.tar.gz 36.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 74.4 kB

Release files / superreload-2.0.0.tar.gz

Download URL superreload-2.0.0.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5334ab837a17dbf7baa6740393fcb1827f7ddcf2b7ad49bd95a5331c35ef604f
BLAKE2b-256 checksum
How to use checksums
22db256fcfc636b1c8587fb8fcd92a5b28d4b1486072d1b498a6e416f5b2cdd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 5, 2026.

Transparency log

Release files / superreload-2.0.0-py3-none-any.whl

Download URL superreload-2.0.0-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67342fbbe3f27d7b97709609f784c8c3330d2d7134dcbbd16c266c274c3bfb0a
BLAKE2b-256 checksum
How to use checksums
51d0fc7543db199a170a0a868ddd2240d04605896f28ce0536b7e7fbb41778ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 5, 2026.

Transparency log

Security for superreload 2.0.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for superreload-2.0.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 Mar 5, 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