Metadata-Version: 2.4
Name: wilco
Version: 0.4.0
Summary: Serve React components from Python backends
Project-URL: Homepage, https://github.com/msqd/wilco
Project-URL: Documentation, https://python-wilco.readthedocs.io/
Project-URL: Repository, https://github.com/msqd/wilco
Project-URL: Issues, https://github.com/msqd/wilco/issues
License: # Makersquad Source License 1.0
        
        ## Acceptance
        
        By using the software, you agree to all of the terms and conditions below.
        
        ## Definitions
        
        **"License"** means this Makersquad Source License.
        
        **"Licensor"** means Makersquad, the copyright holder offering these terms.
        
        **"Software"** means the software the Licensor makes available under these terms,
        including any portion of it.
        
        **"You"** means the individual or entity agreeing to these terms.
        
        **"Your Company"** means any legal entity, sole proprietorship, or other kind of
        organization that you work for, plus all organizations that have control over,
        are under the control of, or are under common control with that organization.
        Control means ownership of substantially all the assets of an entity, or the
        power to direct its management and policies by vote, contract, or otherwise.
        
        **"Commercial Purpose"** means any use intended for or directed toward commercial
        advantage or monetary compensation. This includes, but is not limited to:
        - Using the Software in a product or service you sell
        - Using the Software to provide paid services to third parties
        - Using the Software in internal business operations that generate revenue
        - Using the Software to develop commercial products, even if the Software itself
          is not distributed
        
        **"Competing Use"** means making the Software available to third parties as a
        commercial product or service that substitutes for the Software, or using the
        Software to develop a product or service that competes with the Software.
        
        **"Change Date"** means the date that is five (5) years after the release date
        of each version of the Software.
        
        **"Change License"** means the Apache License, Version 2.0, as published by the
        Apache Software Foundation.
        
        ## License Grant
        
        Subject to the terms and conditions of this License, the Licensor grants you a
        non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable
        license to use, copy, modify, and distribute the Software, for any purpose that
        is not a Commercial Purpose and is not a Competing Use.
        
        ## Permitted Uses
        
        You **may**, without a commercial license:
        
        1. **Evaluate** the Software to determine whether it meets your needs
        2. **Use** the Software for personal, educational, or research purposes
        3. **Read** and study the source code to learn from it
        4. **Modify** the Software and create derivative works for non-commercial purposes
        5. **Contribute** patches, bug fixes, and improvements back to the project
        6. **Use** the Software in non-profit organizations for non-commercial activities
        
        ## Prohibited Uses
        
        You **may not**, without a commercial license or written exception:
        
        1. Use the Software for any Commercial Purpose
        2. Use the Software for any Competing Use
        3. Remove or obscure any licensing, copyright, or other notices
        4. Use the Licensor's trademarks without permission
        
        ## Open Source and Non-Profit Exceptions
        
        If you wish to use the Software in an open source project or for non-profit
        purposes that may have indirect commercial implications, you must obtain a
        written exception from the Licensor. Such exceptions may be granted at the
        Licensor's sole discretion and may include additional terms.
        
        To request an exception, contact: licensing@makersquad.fr
        
        ## Commercial Licenses
        
        Commercial licenses are available for use of the Software in commercial products
        and services. Commercial licenses may include:
        
        - Technical support
        - Bug fixes and security updates
        - Priority feature development
        
        For commercial licensing inquiries, contact: licensing@makersquad.fr
        
        ## Change Date License Conversion
        
        On the Change Date for each version of the Software, this License will
        automatically convert to the Change License for that version only. After the
        Change Date:
        
        - That specific version becomes available under the Change License
        - You may use that version for any purpose, including Commercial Purpose
        - Newer versions released after the Change Date remain under this License until
          their own Change Date
        
        For clarity: if you obtain a commercial license for a version, you may continue
        using that version indefinitely. Five years after that version's release, you
        may also use it under the Change License without the commercial license.
        
        ## Notices
        
        You must ensure that anyone who gets a copy of any part of the Software from
        you also gets a copy of these terms, or the URL for this License:
        https://github.com/msqd/wilco/blob/main/LICENSE.md
        
        ## No Trademark Rights
        
        This License does not grant you any right to use the Licensor's name, logo,
        or trademarks.
        
        ## Patents
        
        The Licensor grants you a license, under any patent claims the Licensor can
        license or becomes able to license, to make, have made, use, sell, offer for
        sale, import and have imported the Software, only for the purposes permitted
        under this License. This license does not cover any patent claims that you
        cause to be infringed by modifications or additions to the Software.
        
        ## No Other Rights
        
        These terms do not imply any licenses other than those expressly granted in
        this License.
        
        ## Termination
        
        If you violate any terms of this License, your rights under it terminate
        immediately. The Licensor may, at its sole discretion, reinstate your rights
        upon written notice.
        
        ## No Liability
        
        ***To the maximum extent permitted by applicable law, the Software is provided
        "as is", without any warranty or condition of any kind, express or implied,
        including but not limited to warranties of merchantability, fitness for a
        particular purpose, or non-infringement.***
        
        ***To the maximum extent permitted by applicable law, the Licensor shall not be
        liable for any direct, indirect, incidental, special, consequential, or
        exemplary damages arising out of or in connection with these terms or the use
        of the Software, regardless of the cause of action or the theory of liability.***
        
        ***Nothing in this License shall limit or exclude liability that cannot be
        limited or excluded under applicable law, including mandatory consumer
        protection laws.***
        
        ## Moral Rights
        
        The Licensor retains all moral rights in the Software as recognized under
        applicable law, including under French intellectual property law (Code de la
        propriété intellectuelle). These rights are personal, perpetual, inalienable,
        and imprescriptible.
        
        ## Severability
        
        If any provision of this License is held to be invalid, illegal, or
        unenforceable, the remaining provisions shall continue in full force and
        effect. The invalid provision shall be modified to the minimum extent necessary
        to make it valid and enforceable while preserving the parties' original intent.
        
        ## Governing Law and Jurisdiction
        
        This License shall be governed by and construed in accordance with the laws of
        France, without regard to its conflict of law provisions. Any dispute arising
        out of or in connection with this License shall be submitted to the exclusive
        jurisdiction of the courts of Paris, France.
        
        ---
        
        Copyright (c) 2025-present Makersquad
        
        For licensing inquiries: licensing@makersquad.fr
License-File: LICENSE.md
Keywords: components,django,esbuild,fastapi,react,typescript
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: FastAPI
Classifier: Framework :: Flask
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: django>=4.2.0; extra == 'dev'
Requires-Dist: fastapi>=0.115.0; extra == 'dev'
Requires-Dist: flask>=3.0.0; extra == 'dev'
Requires-Dist: furo>=2024.0.0; extra == 'dev'
Requires-Dist: httpx>=0.27.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
Requires-Dist: pytest-benchmark>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Requires-Dist: sphinx-autobuild>=2024.0.0; extra == 'dev'
Requires-Dist: sphinx>=7.0.0; extra == 'dev'
Requires-Dist: starlette>=0.40.0; extra == 'dev'
Requires-Dist: twine>=6.0.0; extra == 'dev'
Requires-Dist: uvicorn[standard]>=0.32.0; extra == 'dev'
Provides-Extra: django
Requires-Dist: django>=4.2.0; extra == 'django'
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.115.0; extra == 'fastapi'
Provides-Extra: flask
Requires-Dist: flask>=3.0.0; extra == 'flask'
Provides-Extra: starlette
Requires-Dist: starlette>=0.40.0; extra == 'starlette'
Description-Content-Type: text/markdown

# wilco

**Server-defined React components for Python backends.**

[![PyPI version](https://img.shields.io/pypi/v/wilco.svg)](https://pypi.org/project/wilco/)
[![Python versions](https://img.shields.io/pypi/pyversions/wilco.svg)](https://pypi.org/project/wilco/)
[![CI](https://github.com/msqd/wilco/actions/workflows/cicd.yml/badge.svg)](https://github.com/msqd/wilco/actions/workflows/cicd.yml)
[![Documentation](https://readthedocs.org/projects/python-wilco/badge/?version=latest)](https://python-wilco.readthedocs.io/)
[![License](https://img.shields.io/badge/license-MSL--1.0-blue.svg)](LICENSE.md)

**Documentation:** [FastAPI Guide](https://python-wilco.readthedocs.io/en/latest/how-to/fastapi.html) | [Django Guide](https://python-wilco.readthedocs.io/en/latest/how-to/django.html) | [Flask Guide](https://python-wilco.readthedocs.io/en/latest/how-to/flask.html) | [Starlette Guide](https://python-wilco.readthedocs.io/en/latest/how-to/starlette.html)

## 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
- **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

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

### Create a component

```
my_components/
└── greeting/
    ├── __init__.py
    ├── index.tsx
    └── schema.json
```

```tsx
// 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

```python
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

```tsx
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](https://python-wilco.readthedocs.io/).

## 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 18+ on the frontend

## Development

This project follows strict TDD methodology.

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

## License

Makersquad Source License 1.0 — see [LICENSE.md](LICENSE.md) for details.

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