Skip to main content

Serve React components from Python backends

Project description

wilco

Server-defined React components for Python backends.

PyPI version Python versions CI Documentation License

Documentation: FastAPI Guide | Django Guide | Flask Guide | Starlette Guide

Features

  • Co-locate components with backend logic — Keep UI components next to the Python code that powers them
  • No frontend build pipeline — Components bundled on-the-fly with esbuild when requested
  • Production-ready — Pre-compile bundles with wilco build for static file serving
  • Full source map support — Debug TypeScript directly in browser devtools
  • Component composition — Components can dynamically load other components
  • Framework agnostic — Works with FastAPI, Django, Flask, Starlette, or any ASGI/WSGI-compatible framework

Quick Start

pip install wilco[fastapi]  # or wilco[django], wilco[flask], wilco[starlette]

Create a component

my_components/
└── greeting/
    ├── __init__.py
    ├── index.tsx
    └── schema.json
// index.tsx
interface GreetingProps {
  name: string;
  formal?: boolean;
}

export default function Greeting({ name, formal = false }: GreetingProps) {
  const message = formal ? `Good day, ${name}.` : `Hey ${name}!`;
  return <p>{message}</p>;
}

Mount the API

from pathlib import Path
from fastapi import FastAPI
from wilco import ComponentRegistry
from wilco.bridges.fastapi import create_router

app = FastAPI()
registry = ComponentRegistry(Path("./my_components"))
app.include_router(create_router(registry), prefix="/api")

Load in React

import { useComponent } from '@wilcojs/react';

function App() {
  const Greeting = useComponent('greeting');
  return <Greeting name="World" />;
}

For component schemas, composition patterns, and framework-specific guides, see the documentation.

API Endpoints

Endpoint Description
GET /api/bundles List available components
GET /api/bundles/{name}.js Get bundled JavaScript
GET /api/bundles/{name}/metadata Get component metadata

Requirements

  • Python 3.10+
  • Node.js (for esbuild bundling)
  • React 19 on the frontend (bundled in the standalone loader)

CLI

wilco serve                        # Start development server (default)
wilco build --output dist/wilco/   # Pre-compile bundles for production
wilco build --output dist/wilco/ --prefix store --no-minify --sourcemap

See the CLI reference for all options.

Development

This project follows strict TDD methodology.

make test    # Run all tests
make docs    # Build documentation
make help    # Show all available commands

License

Makersquad Source License 1.0 — see LICENSE.md for details.

Free for non-commercial use. Commercial use requires a license. Contact licensing@makersquad.fr for inquiries.

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

wilco-0.5.2.tar.gz (4.9 MB view details)

Uploaded Source

Built Distribution

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

wilco-0.5.2-py3-none-any.whl (112.1 kB view details)

Uploaded Python 3

File details

Details for the file wilco-0.5.2.tar.gz.

File metadata

  • Download URL: wilco-0.5.2.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wilco-0.5.2.tar.gz
Algorithm Hash digest
SHA256 5cf8d09460af9ac2a7bb3a3225cfc1b057d660a7e30e36442dd45d7cc9a9f2bb
MD5 4b2170c84980de441b210d84cb450390
BLAKE2b-256 48812e20b01ccddae9dce21224b8732b1c7db0478ac1e4d20682baf9f77e00da

See more details on using hashes here.

Provenance

The following attestation bundles were made for wilco-0.5.2.tar.gz:

Publisher: cicd.yml on msqd/wilco

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

File details

Details for the file wilco-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: wilco-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 112.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for wilco-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e3c75e434c974bd8be5a6ea3ddaf9b726b7eba937ff7c297e655d342e5f6707a
MD5 5fd68b0d3af4ba59ef6b608515fdd4ce
BLAKE2b-256 e135625de201cd270f39bd249a7e01a59172f114b606702b74d69fe81ec3078e

See more details on using hashes here.

Provenance

The following attestation bundles were made for wilco-0.5.2-py3-none-any.whl:

Publisher: cicd.yml on msqd/wilco

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