Beautiful debugging page for Starlette and FastAPI apps.
Project description
Starception
Beautiful exception page for Starlette and FastAPI apps.
Screenshot
Dark theme
Features
- secrets masking with reveal button
- solution hints
- exception notes (Python 3.11+)
- exception chains
- code snippets with syntax highlighting
- request info: query params, headers, cookies
- session contents
- request and app state
- platform information
- environment variables
- open paths in editor (VSCode; extensible via custom link templates)
- dark theme
Installation
pip install starception
# or with uv
uv add starception
With syntax highlighting
Install with the highlight extra for syntax-highlighted code snippets:
pip install starception[highlight]
# or with uv
uv add starception[highlight]
Usage
Starception works only in debug mode — make sure debug=True is set on your app.
Call install_error_handler before creating your application instance:
Starlette
from starception import install_error_handler
from starlette.applications import Starlette
install_error_handler()
app = Starlette(debug=True)
FastAPI
from starception import install_error_handler
from fastapi import FastAPI
install_error_handler()
app = FastAPI(debug=True)
See the example application in the examples/ directory for a full demo of all features.
Integration with other frameworks
Starception exports starception.exception_handler(request, exc), which you can use directly.
Keep in mind that Starlette will not call custom exception
handlers in debug mode — it always uses its built-in one.
The snippet below will not work as expected:
from starlette.applications import Starlette
from starception import exception_handler
app = Starlette(
debug=True,
exception_handlers={Exception: exception_handler}
)
Use install_error_handler() instead (shown above).
Secrets masking
Starception automatically masks values whose key contains key, secret, token, or password,
and redacts passwords from URL-valued keys (e.g. database_url). Masked values are replaced with
******** and can be revealed by clicking the reveal button next to them.
Solution hints
If an exception class has a solution attribute, its content will be shown as a hint on the error page.
class DatabaseError(Exception):
solution = (
'The connection to the database cannot be established. '
'Either the database server is down or connection credentials are invalid.'
)
Exception notes
Python 3.11+ supports attaching notes to exceptions via add_note(). Starception displays them on the error page.
err = ValueError("something went wrong")
err.add_note("Check that the config file exists and is readable.")
raise err
Exception chains
When exceptions are chained — either explicitly (raise X from Y) or implicitly (raising inside an except block) —
Starception renders each exception in the chain as a separate block, so you can trace the full error path.
Opening files in editor
Pass your editor to install_error_handler to make file paths in stack frames clickable:
from starception import install_error_handler
install_error_handler(editor='vscode')
Supported editors:
| Editor | Value |
|---|---|
| VSCode | vscode |
Custom link templates
Register any editor with add_link_template:
from starception import install_error_handler, add_link_template
add_link_template('zed', 'zed://file/{path}:{lineno}')
install_error_handler(editor='zed')
Dark theme
The error page supports light, dark, and auto (follows system preference) themes. The toggle is in the top-right corner of the page and the chosen theme is persisted across page loads.
Credits
- Look and feel inspired by Phoenix Framework.
- Icons by Tabler Icons.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file starception-1.3.0.tar.gz.
File metadata
- Download URL: starception-1.3.0.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
091a1fb3454395164513b249c0f59b269d2a8d421f4cd0d9bef85521830dffee
|
|
| MD5 |
dabbe735d19ae6472aab2a3f799bcc74
|
|
| BLAKE2b-256 |
8069c56f91ee8d522cbbe0c62949cb636f555269e35c5f9a34f04bcaa959f2d0
|
File details
Details for the file starception-1.3.0-py3-none-any.whl.
File metadata
- Download URL: starception-1.3.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75389827a0d42a5a86ca6d4590cade830ada4325dbf7aadc248c7ca56b9c4572
|
|
| MD5 |
ebf422391d3825c7a7339c1975dd382e
|
|
| BLAKE2b-256 |
3c1320017ba7a5d667312909f5e8be9928929deb7626e1fc9a9c492d934871a9
|