Metadata-Version: 2.4
Name: pytypehintweb
Version: 1.2.3
Summary: Framework-free browser form layer for pytypehint
Author: Beltran Offerrall
License-Expression: MIT
Project-URL: Homepage, https://github.com/offerrall/pytypehintweb
Project-URL: Documentation, https://offerrall.github.io/pytypehintweb/
Project-URL: Repository, https://github.com/offerrall/pytypehintweb
Project-URL: Issues, https://github.com/offerrall/pytypehintweb/issues
Keywords: forms,type-hints,dataclasses,schema,web,html
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: JavaScript
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pytypehint==1.0.0
Provides-Extra: demo
Requires-Dist: fastapi; extra == "demo"
Requires-Dist: uvicorn; extra == "demo"
Requires-Dist: python-multipart; extra == "demo"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: mypy; extra == "test"
Dynamic: license-file

# pytypehintweb

Python schemas in. Portable form plans and browser widgets out.

pytypehintweb turns a [pytypehint](https://offerrall.github.io/pytypehint/)
schema into a self-contained, JSON-serializable form plan, and renders that plan
in the browser with plain JavaScript widgets: no framework, no build step, no
npm. The browser side reads plans, not Python, so hand-written plans and plans
from another backend render the same way.

It is the rendering layer only. Routing, serving, submission and running the
function stay with the host application, or with
[func-to-web](https://offerrall.github.io/func-to-web/), which builds the whole
request cycle on top of it.

```python
from typing import Annotated

from pytypehint import Label, Min
from pytypehintweb import plan_of


def create_user(
    username: Annotated[str, Min(3), Label("Username")],
    age: Annotated[int, Min(0), Label("Age")],
) -> None:
    pass


plan = plan_of(create_user)  # a JSON-ready dict; compileForm(plan) renders it
```

The full documentation is at https://offerrall.github.io/pytypehintweb/.

## Documentation

- [Overview](https://offerrall.github.io/pytypehintweb/): what the library does, where it stops, its features and its stability promise.
- [Getting started](https://offerrall.github.io/pytypehintweb/getting-started/): one complete form, from a Python function to the built result.
- [Plan contract](https://offerrall.github.io/pytypehintweb/plan/): the plan format, every property, default and invariant.
- [Python API](https://offerrall.github.io/pytypehintweb/python/): `plan_of()`, `decode()`, `WebConfig` and how each annotation maps to a node.
- [JavaScript API](https://offerrall.github.io/pytypehintweb/javascript/): `compileForm()`, widgets, reading, accessibility, styling and themes.
- [Architecture](https://offerrall.github.io/pytypehintweb/architecture/): the layers and which layer owns each rule.
- [Limitations](https://offerrall.github.io/pytypehintweb/limitations/): what a plan cannot represent and why.

### Maintaining

- [Testing](https://offerrall.github.io/pytypehintweb/testing/): how to run the suites, what they guarantee, and CI and release.
