Skybolt Python
Python adapter for Skybolt - High-performance asset caching for multi-page applications.
Installation
pip install skybolt
Or with uv:
uv add skybolt
Prerequisites
- Install and configure the Vite plugin:
npm install @skybolt/vite-plugin - Build your project:
npm run build - Ensure
render-map.jsonis generated in your build output
Usage
from skybolt import Skybolt
# Initialize with render map path and cookies
sb = Skybolt("dist/.skybolt/render-map.json", cookies=request.cookies)
<!DOCTYPE html>
<html>
<head>
{{ sb.css("src/css/critical.css")|safe }}
{{ sb.launch_script()|safe }}
{{ sb.css("src/css/main.css")|safe }}
</head>
<body>
<h1>Hello Skybolt!</h1>
{{ sb.script("src/js/app.js")|safe }}
</body>
</html>
API
Skybolt(render_map_path, cookies=None, cdn_url=None)
Create a new Skybolt instance.
render_map_path- Path torender-map.jsongenerated by Vite plugincookies- Cookie dictionary (defaults toNone)cdn_url- Optional CDN URL prefix (e.g.,'https://cdn.example.com')
# Basic usage
sb = Skybolt("dist/.skybolt/render-map.json", cookies=request.cookies)
# With CDN
sb = Skybolt(
"dist/.skybolt/render-map.json",
cookies=request.cookies,
cdn_url="https://cdn.example.com"
)
css(entry: str, async_load: bool = False) -> str
Render CSS asset.
- First visit: Inlines CSS with caching attributes
- Repeat visit: Outputs
<link>tag (Service Worker serves from cache)
When async_load is True, CSS loads non-blocking:
- First visit: Uses
media="print"trick, swaps toallon load - Repeat visit: Uses
<link rel="preload">withonload
# Blocking (default) - for critical CSS
sb.css("src/css/critical.css")
# Non-blocking - for non-critical CSS
sb.css("src/css/main.css", async_load=True)
script(entry: str, module: bool = True) -> str
Render JavaScript asset.
- First visit: Inlines JS with caching attributes
- Repeat visit: Outputs
<script>tag (Service Worker serves from cache)
# ES module (default)
sb.script("src/js/app.js")
# Classic script
sb.script("src/js/legacy.js", module=False)
launch_script() -> str
Render the Skybolt client launcher. Call once in <head> before other assets.
<head>
{{ sb.launch_script()|safe }}
</head>
get_asset_url(entry: str) -> str | None
Get the URL for an asset (for manual use cases).
url = sb.get_asset_url("src/css/main.css")
# "/assets/main-Pw3rT8vL.css"
get_asset_hash(entry: str) -> str | None
Get the content hash for an asset.
hash = sb.get_asset_hash("src/css/main.css")
# "Pw3rT8vL"
preload(entry, as_type, mime_type=None, crossorigin=None, fetchpriority=None) -> str
Render preload link for critical resources like fonts and images.
# Preload hero image with high priority
sb.preload("images/hero.jpg", as_type="image", fetchpriority="high")
# Preload font
sb.preload("fonts/inter.woff2", as_type="font", mime_type="font/woff2", crossorigin="anonymous")
# Preload a Vite-built asset (resolved from render-map)
sb.preload("src/css/main.css", as_type="style")
Parameters:
entry- Source file path or direct URLas_type- Resource type ('image','font','style','script','fetch')mime_type- MIME type (e.g.,'font/woff2','image/webp')crossorigin- Crossorigin attribute ('anonymous','use-credentials')fetchpriority- Fetch priority ('high','low','auto')
Service Worker Setup
The Service Worker must be served from your domain root. Configure your web server:
Nginx:
location = /skybolt-sw.js {
alias /path/to/dist/skybolt-sw.js;
}
Apache (.htaccess):
RewriteRule ^skybolt-sw\.js$ dist/skybolt-sw.js [L]
Framework Integration
Django
# views.py
from skybolt import Skybolt
def index(request):
sb = Skybolt("static/.skybolt/render-map.json", cookies=request.COOKIES)
return render(request, "index.html", {"sb": sb})
<!-- templates/index.html -->
<!DOCTYPE html>
<html>
<head>
{{ sb.css("src/css/critical.css")|safe }}
{{ sb.launch_script()|safe }}
{{ sb.css("src/css/app.css")|safe }}
</head>
<body>
<!-- content -->
{{ sb.script("src/js/app.js")|safe }}
</body>
</html>
Flask
from flask import Flask, render_template, request
from skybolt import Skybolt
app = Flask(__name__)
@app.route("/")
def index():
sb = Skybolt("static/.skybolt/render-map.json", cookies=request.cookies)
return render_template("index.html", sb=sb)
FastAPI
from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
from skybolt import Skybolt
app = FastAPI()
templates = Jinja2Templates(directory="templates")
@app.get("/", response_class=HTMLResponse)
async def index(request: Request):
sb = Skybolt("static/.skybolt/render-map.json", cookies=request.cookies)
return templates.TemplateResponse("index.html", {"request": request, "sb": sb})
Requirements
- Python 3.10+
- Vite with
@skybolt/vite-plugin
License
MIT
Metadata
Release files for skybolt 3.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| skybolt-3.4.0.tar.gz | 7.6 kB | With provenance | Details for skybolt-3.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| skybolt-3.4.0-py3-none-any.whl | Python 3 | none | any | Details for skybolt-3.4.0-py3-none-any.whl |
Total release size: 16.8 kB
Release files / skybolt-3.4.0.tar.gz
| Download URL | skybolt-3.4.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0e6a1ea52415f224de377a43570f7545c6b381c785886174ffe64c4d481643c2
|
|
BLAKE2b-256 checksum How to use checksums |
0dc96ae4b4612ff8eda87e7e490d3990fa7136c3696d43eff51da400b15d90f1
|
| 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 Dec 1, 2025.
Transparency logRelease files / skybolt-3.4.0-py3-none-any.whl
| Download URL | skybolt-3.4.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f89ed4f43313b09de607459fe6a8015f815ffe3a9396dae42a757ca6799b7257
|
|
BLAKE2b-256 checksum How to use checksums |
b5bebbe6bed0383238dbf26640ff9633127bcac40ddf86518195752cd5cc2737
|
| 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 Dec 1, 2025.
Transparency logSecurity for skybolt 3.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.
Attestation for skybolt-3.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 Dec 1, 2025.
Transparency logA 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.