wesc (Python)
Python bindings for wesc's streaming
HTML/web-component bundler. The Rust core runs in-process — no subprocess, no
WASM — so you can build and server-render web components straight from a Python
backend (Flask, FastAPI, Django, plain http.server, …).
pip install wesc
Prebuilt abi3 wheels ship for macOS, Linux, and Windows and work on CPython
3.8+. No Rust toolchain needed to install.
Usage
import wesc
# One-shot: returns a `BuildResult`. `result.html` is the full HTML output as
# `bytes`; `result.css` / `result.js` are the bundled assets as `str` (or
# `None`). Releases the GIL while it runs, so other threads keep working.
result = wesc.build(["./index.html"], minify=True)
html, css, js = result.html, result.css, result.js
# Streaming: low memory, chunk by chunk. The callback receives each `bytes`
# chunk, then `None` once to signal end-of-stream.
def on_chunk(chunk):
if chunk is None:
finish()
else:
write(chunk)
wesc.build_stream(["./index.html"], on_chunk)
Async servers
build releases the GIL, so the idiomatic way to await it from asyncio
(FastAPI, etc.) is a worker thread:
import asyncio, wesc
result = await asyncio.to_thread(wesc.build, ["./index.html"], minify=True)
API
build(input, *, outcss=None, outjs=None, minify=False) -> BuildResultbuild_stream(input, callback, *, outcss=None, outjs=None, minify=False) -> None
build returns a BuildResult with html: bytes, css: str | None, and
js: str | None. build_stream streams HTML only (it still writes
outcss/outjs to disk).
| Argument | Type | Notes |
|---|---|---|
input |
list[str] |
First entry is the host document. |
callback |
Callable[[bytes | None], object] |
build_stream only. None ends the stream. |
outcss |
str | None |
Path to write the bundled CSS file ("" = in-memory only). |
outjs |
str | None |
Path to write the bundled JS file ("" = in-memory only). |
minify |
bool |
Minify generated assets. Defaults to False. |
The bundler keeps a process-global file/template cache, so builds should not run concurrently within a single process — serialize them (the
examples/python-serverdemo does exactly this).
Building from source
This is a maturin project. From this directory:
pip install maturin
maturin develop # build + install into the active virtualenv
maturin build --release # produce a wheel in target/wheels/
See the repo README's Python section for the broader
project and crates/wesc-py/src/lib.rs for the binding source.
Metadata
Release files for wesc 0.7.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 | |
|---|---|---|---|
| wesc-0.7.0.tar.gz | 69.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| wesc-0.7.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| wesc-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| wesc-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| wesc-0.7.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| wesc-0.7.0-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 33.6 MB
Release files / wesc-0.7.0.tar.gz
| Download URL | wesc-0.7.0.tar.gz |
|---|---|
| Size | 69.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca4f7ef8a982e1f37b3f0603515c3896e6305c7354bb649ece15251f7936e9ee
|
|
BLAKE2b-256 checksum How to use checksums |
85bf434de38e58c1ea790d6e9469902e0e673778609fdee5da02d9ece5dd025d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 19, 2026.
Transparency logRelease files / wesc-0.7.0-cp38-abi3-win_amd64.whl
| Download URL | wesc-0.7.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 6.9 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a7cfd08dc7b0fdc5dc47f6ef2c3945fb63bbd08b136e9801c12a09ced447ca0c
|
|
BLAKE2b-256 checksum How to use checksums |
df595f744099c0202fcb6263741cf4c8c7e54f452e8796b2592862d10c3442b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 19, 2026.
Transparency logRelease files / wesc-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | wesc-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 7.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7176f3910b4c7c6c1a164289483e1c24476471122d2b4a43676c7c8df449f02f
|
|
BLAKE2b-256 checksum How to use checksums |
69a7ae2135bf7224f34dbd9acdcc09f0e5e52041452cb765f707e97560b5674f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 19, 2026.
Transparency logRelease files / wesc-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | wesc-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
134a8558b1d3cb0a6315cc9340a9d830c575e3c2e17b7c06128515c0258efba9
|
|
BLAKE2b-256 checksum How to use checksums |
d1c5f3bf7835e4cdf317dab63fdb764da2e85472f7835f60397a92b1fd1d0c25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 19, 2026.
Transparency logRelease files / wesc-0.7.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | wesc-0.7.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c8dbd5784fd050ed952f5db9ef5a4c22818a22f77e830b0772a65c295d299a89
|
|
BLAKE2b-256 checksum How to use checksums |
7f843fcf76e1ee018ad145cf3dc9fea2cf072ad38ad0961fbb76423f78e24433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 19, 2026.
Transparency logRelease files / wesc-0.7.0-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | wesc-0.7.0-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
75692934727a12473dea423478260099c004265183f6001a6ac235331efea06c
|
|
BLAKE2b-256 checksum How to use checksums |
760e08e5ef005562bac4d2beeeabdd51fd51e30c8017bfe6a7e2b0962ffb05cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 19, 2026.
Transparency log