Skip to main content

Staticware

PyPI version

ASGI middleware for static file serving with content-based cache busting. Zero runtime dependencies.

Features

  • Serves static files over ASGI with content-hashed filenames for cache busting
  • Hashed filenames get Cache-Control: public, max-age=31536000, immutable
  • Original filenames still work, without aggressive caching
  • StaticRewriteMiddleware automatically rewrites static paths in HTML responses
  • static.url() resolves cache-busted URLs for use in templates
  • Works with any ASGI framework: Starlette, FastAPI, Air, Litestar, Django, or raw ASGI
  • Zero runtime dependencies

Quick Start

from staticware import HashedStatic, StaticRewriteMiddleware

# Point at your static files directory
static = HashedStatic("static")

# Mount it however your framework mounts sub-apps:
app.mount("/static", static)

# Wrap any ASGI app to rewrite static paths in HTML responses
app = StaticRewriteMiddleware(app, static=static)

# In templates, resolve cache-busted URLs:
static.url("styles.css")       # /static/styles.a1b2c3d4.css
static.url("images/logo.png")  # /static/images/logo.7e4f9a01.png

Documentation

Documentation is built with Zensical and deployed to GitHub Pages.

API documentation is auto-generated from docstrings using mkdocstrings.

Docs deploy automatically on push to main via GitHub Actions. To enable this, go to your repo's Settings > Pages and set the source to GitHub Actions.

Development

To set up for local development:

git clone git@github.com:feldroy/staticware.git
cd staticware
uv sync

Run tests:

uv run pytest

Run quality checks (format, lint, type check, test):

just qa

Author

Staticware was created in 2026 by Audrey M. Roy Greenfeld.

Built with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.

Metadata

Release files for staticware 0.2.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 staticware 0.2.0
File Size Uploaded Provenance Actions
staticware-0.2.0.tar.gz 53.9 kB With provenance Details for staticware-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 60.8 kB

Release files / staticware-0.2.0.tar.gz

Download URL staticware-0.2.0.tar.gz
Size 53.9 kB
Tags Source
SHA-256 checksum
How to use checksums
991c4d0c74a5173b5f058b8e7e81314a569f95d8497a3120811d62fc30629838
BLAKE2b-256 checksum
How to use checksums
9a47f3effaeff071e7d87b64ded37073e1728fbdc432bc166b689ba442050fb2
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 13, 2026.

Transparency log

Release files / staticware-0.2.0-py3-none-any.whl

Download URL staticware-0.2.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
679c612a30eb50a7c77b07978acebf34496f4a41921a1b49ab8d98473f1f1069
BLAKE2b-256 checksum
How to use checksums
378969c791f2bb2b5fa6d7bf8e2fd236e6a10490b06dacfd8e4e9f48d8a8ae0a
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 13, 2026.

Transparency log

Security for staticware 0.2.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 staticware-0.2.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 13, 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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