pytypehintweb 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytypehintweb-0.0.1/LICENSE +21 -0
- pytypehintweb-0.0.1/PKG-INFO +180 -0
- pytypehintweb-0.0.1/README.md +146 -0
- pytypehintweb-0.0.1/pyproject.toml +72 -0
- pytypehintweb-0.0.1/setup.cfg +4 -0
- pytypehintweb-0.0.1/src/pytypehintweb/__init__.py +23 -0
- pytypehintweb-0.0.1/src/pytypehintweb/decode.py +268 -0
- pytypehintweb-0.0.1/src/pytypehintweb/demo/__init__.py +0 -0
- pytypehintweb-0.0.1/src/pytypehintweb/demo/__main__.py +56 -0
- pytypehintweb-0.0.1/src/pytypehintweb/demo/app.py +701 -0
- pytypehintweb-0.0.1/src/pytypehintweb/demo/examples.py +1346 -0
- pytypehintweb-0.0.1/src/pytypehintweb/plan.py +1209 -0
- pytypehintweb-0.0.1/src/pytypehintweb/py.typed +0 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/contract.js +838 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/defaults.js +167 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/fields.js +841 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/form.js +281 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/inputs.js +1702 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/iso.js +42 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/normalize.js +733 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/slider.js +81 -0
- pytypehintweb-0.0.1/src/pytypehintweb/static/widgets.css +1243 -0
- pytypehintweb-0.0.1/src/pytypehintweb/types.py +25 -0
- pytypehintweb-0.0.1/src/pytypehintweb.egg-info/PKG-INFO +180 -0
- pytypehintweb-0.0.1/src/pytypehintweb.egg-info/SOURCES.txt +27 -0
- pytypehintweb-0.0.1/src/pytypehintweb.egg-info/dependency_links.txt +1 -0
- pytypehintweb-0.0.1/src/pytypehintweb.egg-info/entry_points.txt +2 -0
- pytypehintweb-0.0.1/src/pytypehintweb.egg-info/requires.txt +10 -0
- pytypehintweb-0.0.1/src/pytypehintweb.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Beltran Offerrall
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pytypehintweb
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Framework-free browser form layer for pytypehint
|
|
5
|
+
Author: Beltran Offerrall
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/offerrall/pytypehintweb
|
|
8
|
+
Project-URL: Repository, https://github.com/offerrall/pytypehintweb
|
|
9
|
+
Project-URL: Issues, https://github.com/offerrall/pytypehintweb/issues
|
|
10
|
+
Keywords: forms,type-hints,dataclasses,schema,web,html
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: JavaScript
|
|
19
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: pytypehint>=0.0.6
|
|
26
|
+
Provides-Extra: demo
|
|
27
|
+
Requires-Dist: fastapi; extra == "demo"
|
|
28
|
+
Requires-Dist: uvicorn; extra == "demo"
|
|
29
|
+
Requires-Dist: python-multipart; extra == "demo"
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
Requires-Dist: mypy; extra == "test"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# pytypehintweb
|
|
36
|
+
|
|
37
|
+
`pytypehintweb` is a framework-free browser form layer for
|
|
38
|
+
[`pytypehint`](https://github.com/offerrall/pytypehint). It converts compiled
|
|
39
|
+
Python type schemas into self-contained, JSON-serializable form plans and
|
|
40
|
+
renders them with plain JavaScript widgets. The browser runtime also consumes
|
|
41
|
+
hand-written plans or plans from another backend, so Python is not required at
|
|
42
|
+
render time. Everything around the form — routing, static-file delivery,
|
|
43
|
+
authentication, submission, function execution — belongs to the host
|
|
44
|
+
application. (For the whole request/response cycle instead of the rendering
|
|
45
|
+
layer, see [FuncToWeb](https://github.com/offerrall/FuncToWeb).)
|
|
46
|
+
|
|
47
|
+
Pre-1.0: the API is still settling, so breaking changes are expected between
|
|
48
|
+
releases.
|
|
49
|
+
|
|
50
|
+
## Features
|
|
51
|
+
|
|
52
|
+
- Self-contained, JSON-serializable plans from plain functions, dataclass types
|
|
53
|
+
or compiled `Signature`/`Struct` schemas — and hand-written plans need no
|
|
54
|
+
Python.
|
|
55
|
+
- Framework-free browser runtime (plain HTML, CSS and JS modules), with widgets
|
|
56
|
+
usable directly or from a plan; browser files ship inside the Python package
|
|
57
|
+
under `pytypehintweb.STATIC`.
|
|
58
|
+
- `str`, `int`, `float`, `date`, `time`, `bool` and `enum` composing through lists,
|
|
59
|
+
optional fields, unions and nested dataclasses, with constraints, static choices,
|
|
60
|
+
integer sliders, and configurable validation messages and labels.
|
|
61
|
+
- `file` fields (single or `list[File]`) that mint an upload reference the host
|
|
62
|
+
redeems through its own channel.
|
|
63
|
+
- Centralized plan normalization and validation before any widget is built, and
|
|
64
|
+
`plain` / `inline` / `wrapped` union transport.
|
|
65
|
+
- Plan text is always rendered as text, never parsed as markup.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install pytypehintweb # library
|
|
71
|
+
pip install "pytypehintweb[demo]" # + the local demo (pytypehintweb-demo)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Demo with all widgets, served by a local HTTP server on port 8000:
|
|
76
|
+
pytypehintweb-demo
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
There is no npm package: the browser modules live under `pytypehintweb.STATIC`
|
|
80
|
+
and can be served by any static-file mount.
|
|
81
|
+
|
|
82
|
+
## Quick start
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from typing import Annotated
|
|
86
|
+
|
|
87
|
+
from pytypehint import Label, Min
|
|
88
|
+
from pytypehintweb import plan_of
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def create_user(
|
|
92
|
+
username: Annotated[str, Min(3), Label("Username")],
|
|
93
|
+
age: Annotated[int, Min(0), Label("Age")],
|
|
94
|
+
) -> None:
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
plan = plan_of(create_user)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`plan_of()` returns ordinary Python dictionaries and lists — a single, fully
|
|
102
|
+
expanded, self-contained document where every non-conditional property is present
|
|
103
|
+
with an explicit value (`default` appears exactly when `hasDefault` is true),
|
|
104
|
+
carrying a top-level `"v": 1`:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"v": 1,
|
|
109
|
+
"kind": "form",
|
|
110
|
+
"name": "create_user",
|
|
111
|
+
"description": null,
|
|
112
|
+
"fields": [
|
|
113
|
+
{
|
|
114
|
+
"name": "username",
|
|
115
|
+
"label": "Username",
|
|
116
|
+
"description": null,
|
|
117
|
+
"optional": false,
|
|
118
|
+
"enabled": true,
|
|
119
|
+
"hasDefault": false,
|
|
120
|
+
"node": {
|
|
121
|
+
"kind": "str",
|
|
122
|
+
"options": {
|
|
123
|
+
"minLength": 3,
|
|
124
|
+
"maxLength": null,
|
|
125
|
+
"pattern": null,
|
|
126
|
+
"patternMessage": "Invalid format",
|
|
127
|
+
"minMessage": "Must contain at least {value} characters",
|
|
128
|
+
"maxMessage": "Must contain at most {value} characters",
|
|
129
|
+
"placeholder": null,
|
|
130
|
+
"password": false,
|
|
131
|
+
"rows": null,
|
|
132
|
+
"choices": null
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "age",
|
|
138
|
+
"label": "Age",
|
|
139
|
+
"description": null,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"enabled": true,
|
|
142
|
+
"hasDefault": false,
|
|
143
|
+
"node": {
|
|
144
|
+
"kind": "int",
|
|
145
|
+
"options": {
|
|
146
|
+
"min": 0,
|
|
147
|
+
"max": null,
|
|
148
|
+
"multipleOf": null,
|
|
149
|
+
"step": null,
|
|
150
|
+
"slider": false,
|
|
151
|
+
"showValue": false,
|
|
152
|
+
"placeholder": null,
|
|
153
|
+
"choices": null,
|
|
154
|
+
"safeMessage": "Must be a safe integer",
|
|
155
|
+
"invalidMessage": "Enter a valid integer",
|
|
156
|
+
"minMessage": "Must be at least {value}",
|
|
157
|
+
"maxMessage": "Must be at most {value}",
|
|
158
|
+
"multipleOfMessage": "Must be a multiple of {value}",
|
|
159
|
+
"increaseLabel": "Increase",
|
|
160
|
+
"decreaseLabel": "Decrease"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Transporting that document to the browser and compiling it with `compileForm()`
|
|
169
|
+
is walked through end to end in [Getting started](docs/getting-started.md).
|
|
170
|
+
|
|
171
|
+
## Documentation
|
|
172
|
+
|
|
173
|
+
- [Getting started](docs/getting-started.md) — the end-to-end tutorial.
|
|
174
|
+
- [Plan contract](docs/plan.md) — the plan format, every property and invariant.
|
|
175
|
+
- [Python API](docs/python.md) — `plan_of()`, `WebConfig`, annotation mappings.
|
|
176
|
+
- [JavaScript API](docs/javascript.md) — `compileForm()`, widgets, reading,
|
|
177
|
+
accessibility, styling.
|
|
178
|
+
- [Architecture](docs/architecture.md) — layers and which layer owns each rule.
|
|
179
|
+
- [Testing](docs/testing.md) — how to run the suites and what they guarantee.
|
|
180
|
+
- [Current limitations](docs/limitations.md).
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# pytypehintweb
|
|
2
|
+
|
|
3
|
+
`pytypehintweb` is a framework-free browser form layer for
|
|
4
|
+
[`pytypehint`](https://github.com/offerrall/pytypehint). It converts compiled
|
|
5
|
+
Python type schemas into self-contained, JSON-serializable form plans and
|
|
6
|
+
renders them with plain JavaScript widgets. The browser runtime also consumes
|
|
7
|
+
hand-written plans or plans from another backend, so Python is not required at
|
|
8
|
+
render time. Everything around the form — routing, static-file delivery,
|
|
9
|
+
authentication, submission, function execution — belongs to the host
|
|
10
|
+
application. (For the whole request/response cycle instead of the rendering
|
|
11
|
+
layer, see [FuncToWeb](https://github.com/offerrall/FuncToWeb).)
|
|
12
|
+
|
|
13
|
+
Pre-1.0: the API is still settling, so breaking changes are expected between
|
|
14
|
+
releases.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Self-contained, JSON-serializable plans from plain functions, dataclass types
|
|
19
|
+
or compiled `Signature`/`Struct` schemas — and hand-written plans need no
|
|
20
|
+
Python.
|
|
21
|
+
- Framework-free browser runtime (plain HTML, CSS and JS modules), with widgets
|
|
22
|
+
usable directly or from a plan; browser files ship inside the Python package
|
|
23
|
+
under `pytypehintweb.STATIC`.
|
|
24
|
+
- `str`, `int`, `float`, `date`, `time`, `bool` and `enum` composing through lists,
|
|
25
|
+
optional fields, unions and nested dataclasses, with constraints, static choices,
|
|
26
|
+
integer sliders, and configurable validation messages and labels.
|
|
27
|
+
- `file` fields (single or `list[File]`) that mint an upload reference the host
|
|
28
|
+
redeems through its own channel.
|
|
29
|
+
- Centralized plan normalization and validation before any widget is built, and
|
|
30
|
+
`plain` / `inline` / `wrapped` union transport.
|
|
31
|
+
- Plan text is always rendered as text, never parsed as markup.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install pytypehintweb # library
|
|
37
|
+
pip install "pytypehintweb[demo]" # + the local demo (pytypehintweb-demo)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Demo with all widgets, served by a local HTTP server on port 8000:
|
|
42
|
+
pytypehintweb-demo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
There is no npm package: the browser modules live under `pytypehintweb.STATIC`
|
|
46
|
+
and can be served by any static-file mount.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from typing import Annotated
|
|
52
|
+
|
|
53
|
+
from pytypehint import Label, Min
|
|
54
|
+
from pytypehintweb import plan_of
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def create_user(
|
|
58
|
+
username: Annotated[str, Min(3), Label("Username")],
|
|
59
|
+
age: Annotated[int, Min(0), Label("Age")],
|
|
60
|
+
) -> None:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
plan = plan_of(create_user)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`plan_of()` returns ordinary Python dictionaries and lists — a single, fully
|
|
68
|
+
expanded, self-contained document where every non-conditional property is present
|
|
69
|
+
with an explicit value (`default` appears exactly when `hasDefault` is true),
|
|
70
|
+
carrying a top-level `"v": 1`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"v": 1,
|
|
75
|
+
"kind": "form",
|
|
76
|
+
"name": "create_user",
|
|
77
|
+
"description": null,
|
|
78
|
+
"fields": [
|
|
79
|
+
{
|
|
80
|
+
"name": "username",
|
|
81
|
+
"label": "Username",
|
|
82
|
+
"description": null,
|
|
83
|
+
"optional": false,
|
|
84
|
+
"enabled": true,
|
|
85
|
+
"hasDefault": false,
|
|
86
|
+
"node": {
|
|
87
|
+
"kind": "str",
|
|
88
|
+
"options": {
|
|
89
|
+
"minLength": 3,
|
|
90
|
+
"maxLength": null,
|
|
91
|
+
"pattern": null,
|
|
92
|
+
"patternMessage": "Invalid format",
|
|
93
|
+
"minMessage": "Must contain at least {value} characters",
|
|
94
|
+
"maxMessage": "Must contain at most {value} characters",
|
|
95
|
+
"placeholder": null,
|
|
96
|
+
"password": false,
|
|
97
|
+
"rows": null,
|
|
98
|
+
"choices": null
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "age",
|
|
104
|
+
"label": "Age",
|
|
105
|
+
"description": null,
|
|
106
|
+
"optional": false,
|
|
107
|
+
"enabled": true,
|
|
108
|
+
"hasDefault": false,
|
|
109
|
+
"node": {
|
|
110
|
+
"kind": "int",
|
|
111
|
+
"options": {
|
|
112
|
+
"min": 0,
|
|
113
|
+
"max": null,
|
|
114
|
+
"multipleOf": null,
|
|
115
|
+
"step": null,
|
|
116
|
+
"slider": false,
|
|
117
|
+
"showValue": false,
|
|
118
|
+
"placeholder": null,
|
|
119
|
+
"choices": null,
|
|
120
|
+
"safeMessage": "Must be a safe integer",
|
|
121
|
+
"invalidMessage": "Enter a valid integer",
|
|
122
|
+
"minMessage": "Must be at least {value}",
|
|
123
|
+
"maxMessage": "Must be at most {value}",
|
|
124
|
+
"multipleOfMessage": "Must be a multiple of {value}",
|
|
125
|
+
"increaseLabel": "Increase",
|
|
126
|
+
"decreaseLabel": "Decrease"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Transporting that document to the browser and compiling it with `compileForm()`
|
|
135
|
+
is walked through end to end in [Getting started](docs/getting-started.md).
|
|
136
|
+
|
|
137
|
+
## Documentation
|
|
138
|
+
|
|
139
|
+
- [Getting started](docs/getting-started.md) — the end-to-end tutorial.
|
|
140
|
+
- [Plan contract](docs/plan.md) — the plan format, every property and invariant.
|
|
141
|
+
- [Python API](docs/python.md) — `plan_of()`, `WebConfig`, annotation mappings.
|
|
142
|
+
- [JavaScript API](docs/javascript.md) — `compileForm()`, widgets, reading,
|
|
143
|
+
accessibility, styling.
|
|
144
|
+
- [Architecture](docs/architecture.md) — layers and which layer owns each rule.
|
|
145
|
+
- [Testing](docs/testing.md) — how to run the suites and what they guarantee.
|
|
146
|
+
- [Current limitations](docs/limitations.md).
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pytypehintweb"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Framework-free browser form layer for pytypehint"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{name = "Beltran Offerrall"}]
|
|
13
|
+
requires-python = ">=3.11"
|
|
14
|
+
dependencies = ["pytypehint>=0.0.6"]
|
|
15
|
+
keywords = ["forms", "type-hints", "dataclasses", "schema", "web", "html"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: JavaScript",
|
|
25
|
+
"Topic :: Software Development :: User Interfaces",
|
|
26
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/offerrall/pytypehintweb"
|
|
32
|
+
Repository = "https://github.com/offerrall/pytypehintweb"
|
|
33
|
+
Issues = "https://github.com/offerrall/pytypehintweb/issues"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
demo = [
|
|
37
|
+
"fastapi",
|
|
38
|
+
"uvicorn",
|
|
39
|
+
"python-multipart",
|
|
40
|
+
]
|
|
41
|
+
test = [
|
|
42
|
+
"pytest",
|
|
43
|
+
"mypy",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
pytypehintweb-demo = "pytypehintweb.demo.__main__:main"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.dynamic]
|
|
50
|
+
version = {attr = "pytypehintweb.__version__"}
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.package-data]
|
|
56
|
+
pytypehintweb = ["static/*.js", "static/*.css", "py.typed"]
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
testpaths = ["tests/python"]
|
|
60
|
+
|
|
61
|
+
[tool.mypy]
|
|
62
|
+
mypy_path = "src"
|
|
63
|
+
explicit_package_bases = true
|
|
64
|
+
files = ["src/pytypehintweb"]
|
|
65
|
+
|
|
66
|
+
# The bundled demo is a showcase application (FastAPI glue and large hand-written
|
|
67
|
+
# example tables), not the typed public API that py.typed vouches for. Consumers
|
|
68
|
+
# import plan_of / decode / WebConfig / the type aliases, all of which type-check
|
|
69
|
+
# clean; the demo stays out of the typed contract.
|
|
70
|
+
[[tool.mypy.overrides]]
|
|
71
|
+
module = "pytypehintweb.demo.*"
|
|
72
|
+
ignore_errors = true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from pytypehintweb.decode import decode
|
|
4
|
+
from pytypehintweb.plan import INLINE, PLAIN, WRAPPED, WebConfig, plan_of
|
|
5
|
+
from pytypehintweb.types import COLOR_PATTERN, EMAIL_PATTERN, Color, Email
|
|
6
|
+
|
|
7
|
+
STATIC = Path(__file__).parent / "static"
|
|
8
|
+
|
|
9
|
+
__version__ = "0.0.1"
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"plan_of",
|
|
13
|
+
"decode",
|
|
14
|
+
"WebConfig",
|
|
15
|
+
"STATIC",
|
|
16
|
+
"PLAIN",
|
|
17
|
+
"INLINE",
|
|
18
|
+
"WRAPPED",
|
|
19
|
+
"Color",
|
|
20
|
+
"Email",
|
|
21
|
+
"COLOR_PATTERN",
|
|
22
|
+
"EMAIL_PATTERN",
|
|
23
|
+
]
|