Skip to main content

We are the Superlative Components! — a streaming HTML/web-component bundler.

Project description

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 the full HTML output as `bytes`. Releases the GIL while it
# runs, so other threads keep working.
html = wesc.build(["./index.html"], minify=True)

# 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

html = await asyncio.to_thread(wesc.build, ["./index.html"], minify=True)

API

  • build(entry_points, *, outcss=None, outjs=None, minify=False) -> bytes
  • build_stream(entry_points, callback, *, outcss=None, outjs=None, minify=False) -> None
Argument Type Notes
entry_points 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.
outjs str | None Path to write the bundled JS file.
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-server demo 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wesc-0.6.1.tar.gz (58.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

wesc-0.6.1-cp38-abi3-win_amd64.whl (6.8 MB view details)

Uploaded CPython 3.8+Windows x86-64

wesc-0.6.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

wesc-0.6.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

wesc-0.6.1-cp38-abi3-macosx_11_0_arm64.whl (6.4 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

wesc-0.6.1-cp38-abi3-macosx_10_12_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file wesc-0.6.1.tar.gz.

File metadata

  • Download URL: wesc-0.6.1.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wesc-0.6.1.tar.gz
Algorithm Hash digest
SHA256 0a5382edb52eec1265eb99490506ad6ab96a2dd5c2f0f63d6fd5717e456ba3f7
MD5 6806b642b492e325ad94be02b364ec8c
BLAKE2b-256 e06fa45faf991accadef6ac120dd0b30113e2718f50157d6e09a1047907038fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for wesc-0.6.1.tar.gz:

Publisher: cd.yml on luwes/wesc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wesc-0.6.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: wesc-0.6.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wesc-0.6.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bcdb83609a3928ae74d0f74b5609e12c6ac5db2a9236c39a869efa5bb42ab36f
MD5 78a9c741c264aa289564d4ba484e4614
BLAKE2b-256 23a6253072a5494eb987bb5107385fa48e02d7c8bfad12c74bbeae6c407d9d07

See more details on using hashes here.

Provenance

The following attestation bundles were made for wesc-0.6.1-cp38-abi3-win_amd64.whl:

Publisher: cd.yml on luwes/wesc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wesc-0.6.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for wesc-0.6.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 039eff6d3547acd937e8e6f2933a80aa4a3becfe860bd0e4a239f99e5f18c822
MD5 47e12793563c005842a1a70e38c41d94
BLAKE2b-256 da0ca1616eedf8e61c75a070acc65d2de28342648443ebccdc05ea367e32a797

See more details on using hashes here.

Provenance

The following attestation bundles were made for wesc-0.6.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: cd.yml on luwes/wesc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wesc-0.6.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for wesc-0.6.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0d16fc14c23c355cf3f0dff9e7bfe78650ca2f842d0f5e2905def0745af08639
MD5 3ded77b0b1b81640c16c7f013643d07f
BLAKE2b-256 677d89ecb9c94cc52662c846f875484b3639526e6dd36df9cf05f0025f1f0a05

See more details on using hashes here.

Provenance

The following attestation bundles were made for wesc-0.6.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: cd.yml on luwes/wesc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wesc-0.6.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: wesc-0.6.1-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 6.4 MB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for wesc-0.6.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a53ccf5846f4f61acd2f70c34e7500294a37603dd51985d32498055cc900e68b
MD5 88f281b42d057111849bebe69da11af3
BLAKE2b-256 90b85fa33d776c17e107e787328f1c0b2c93c40142c1ac66677f613561d921d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for wesc-0.6.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: cd.yml on luwes/wesc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wesc-0.6.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for wesc-0.6.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1c83324099b06c75a03d92b621ed625f74551d347c90baa68bd0e3497eb4a65d
MD5 3f45def6958f2634137afe6f2b8a7357
BLAKE2b-256 596be8b21e7df572f80871f4ad04df782025355f010e4fa8bf7ef9e8a3aff715

See more details on using hashes here.

Provenance

The following attestation bundles were made for wesc-0.6.1-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: cd.yml on luwes/wesc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page