func-to-web 2.7.2__tar.gz → 2.7.4__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.
- func_to_web-2.7.4/PKG-INFO +122 -0
- func_to_web-2.7.4/README.md +58 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/pyproject.toml +2 -1
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/config.py +1 -1
- func_to_web-2.7.4/src/func_to_web.egg-info/PKG-INFO +122 -0
- func_to_web-2.7.2/PKG-INFO +0 -631
- func_to_web-2.7.2/README.md +0 -568
- func_to_web-2.7.2/src/func_to_web.egg-info/PKG-INFO +0 -631
- {func_to_web-2.7.2 → func_to_web-2.7.4}/LICENSE +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/setup.cfg +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/__init__.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/models/__init__.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/models/file_defaults.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/models/function.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/models/functions.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/models/return_parser.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/models/submit_defaults.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/outputs/__init__.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/outputs/download.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/outputs/form.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/outputs/image.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/outputs/table.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/outputs/text.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/py.typed +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/emit.js +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/icons/alert.svg +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/icons/check.svg +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/icons/clock.svg +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/icons/copy.svg +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/icons/download.svg +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/output.js +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/page.css +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/page.js +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/sdk.js +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/static/upload.js +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/__init__.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/doc.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/index.html +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/index.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/page.html +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/page.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/templates/theme.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/__init__.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/execution.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/messages.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/pending.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/print_capture.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/references.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/returned_files.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/router.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/run.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/stream.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web/web/upload.py +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web.egg-info/SOURCES.txt +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web.egg-info/dependency_links.txt +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web.egg-info/requires.txt +0 -0
- {func_to_web-2.7.2 → func_to_web-2.7.4}/src/func_to_web.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: func-to-web
|
|
3
|
+
Version: 2.7.4
|
|
4
|
+
Summary: Expose typed Python functions as web interfaces.
|
|
5
|
+
Author: Beltrán Offerrall
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Beltrán Offerrall
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/offerrall/FuncToWeb
|
|
29
|
+
Project-URL: Documentation, https://offerrall.github.io/func-to-web/
|
|
30
|
+
Project-URL: Repository, https://github.com/offerrall/FuncToWeb
|
|
31
|
+
Keywords: web,forms,type-hints,ui
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Typing :: Typed
|
|
41
|
+
Requires-Python: >=3.11
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: pytypehintweb==1.2.0
|
|
45
|
+
Requires-Dist: starlette==0.49.3
|
|
46
|
+
Requires-Dist: uvicorn==0.38.0
|
|
47
|
+
Provides-Extra: test
|
|
48
|
+
Requires-Dist: pytest; extra == "test"
|
|
49
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
50
|
+
Requires-Dist: pytest-asyncio; extra == "test"
|
|
51
|
+
Requires-Dist: httpx; extra == "test"
|
|
52
|
+
Requires-Dist: build; extra == "test"
|
|
53
|
+
Requires-Dist: twine; extra == "test"
|
|
54
|
+
Requires-Dist: fastapi==0.121.1; extra == "test"
|
|
55
|
+
Provides-Extra: test-outputs
|
|
56
|
+
Requires-Dist: pandas; extra == "test-outputs"
|
|
57
|
+
Requires-Dist: polars; extra == "test-outputs"
|
|
58
|
+
Requires-Dist: numpy; extra == "test-outputs"
|
|
59
|
+
Requires-Dist: pillow; extra == "test-outputs"
|
|
60
|
+
Requires-Dist: matplotlib; extra == "test-outputs"
|
|
61
|
+
Provides-Extra: test-browser
|
|
62
|
+
Requires-Dist: playwright; extra == "test-browser"
|
|
63
|
+
Dynamic: license-file
|
|
64
|
+
|
|
65
|
+
# FuncToWeb
|
|
66
|
+
|
|
67
|
+
**Turn typed Python functions into web interfaces.**
|
|
68
|
+
|
|
69
|
+
Write a normal Python function with type hints. FuncToWeb turns it into a
|
|
70
|
+
ready-to-use web form, validates its input and runs it over HTTP. No models, no
|
|
71
|
+
duplicated schemas, no hand-written forms.
|
|
72
|
+
|
|
73
|
+
The same function is also an HTTP endpoint, a contract published at `/doc` for
|
|
74
|
+
people and agents, an application you mount inside FastAPI, and a page your own
|
|
75
|
+
frontend opens in a modal.
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from func_to_web import run
|
|
79
|
+
|
|
80
|
+
def divide(a: float, b: float) -> float:
|
|
81
|
+
return a / b # Any exception becomes a clean error in the page and the API
|
|
82
|
+
|
|
83
|
+
run(divide) # http://127.0.0.1:8000
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The full documentation is at https://offerrall.github.io/func-to-web/.
|
|
87
|
+
|
|
88
|
+
## Documentation
|
|
89
|
+
|
|
90
|
+
- [Overview](docs/overview.md): the same function as a form, an API, a contract and a modal; how it works, what it offers and how it compares.
|
|
91
|
+
- [Getting started](docs/getting-started.md): write your first function and run it.
|
|
92
|
+
- [Examples](docs/examples.md): the runnable examples and mini-apps, how to run them, and what each folder teaches.
|
|
93
|
+
- [`run()`](docs/run.md): the standalone application and the space index.
|
|
94
|
+
- [`app_of()`](docs/router.md): mounting the application in an existing FastAPI host application.
|
|
95
|
+
- [Types and validation](docs/types.md): constraints, dataclasses, lists, unions, optionals and defaults.
|
|
96
|
+
- [Prefill and hidden parameters](docs/prefill.md): open a form with initial values, from Python or from the URL.
|
|
97
|
+
- [Files](docs/files.md): uploads, reusable file references, and which layer applies each limit.
|
|
98
|
+
- [`WebFunction` and `WebFunctions`](docs/web-function.md): the name, description and slug of a function; prepared spaces.
|
|
99
|
+
- [Execution over HTTP](docs/http.md): `/invoke`, the request body, the envelope and the status codes.
|
|
100
|
+
- [Streaming](docs/streaming.md): `/invoke-stream`, SSE events and `print()` capture.
|
|
101
|
+
- [Outputs](docs/outputs.md): text, images, tables and downloads with `Download`.
|
|
102
|
+
- [`OpenForm`](docs/open-form.md): open another function's form with the return value as prefill.
|
|
103
|
+
- [`/doc`](docs/api-docs.md): the published contract that a client or an agent consumes.
|
|
104
|
+
- [`sdk.js`](docs/sdk.md): the helpers that call a space from your own frontend, and how to embed a function's page in another site.
|
|
105
|
+
- [Static assets](docs/static-assets.md): `/static`, the icons, the theme and how they are cached.
|
|
106
|
+
- [Security](docs/security.md): what FuncToWeb covers and what belongs to the host application.
|
|
107
|
+
- [Architecture](docs/architecture.md): the layers and what each one solves.
|
|
108
|
+
- [Limitations](docs/limitations.md): the known limits, in a single list.
|
|
109
|
+
|
|
110
|
+
### Maintaining
|
|
111
|
+
|
|
112
|
+
- [The space index](docs/design/run.md): why the page `run()` adds at `/` navigates with `location.replace()` and carries no form logic of its own.
|
|
113
|
+
- [The application](docs/design/router.md): why both storage TTLs default to one hour, and why the theme is resolved in pure CSS.
|
|
114
|
+
- [Prefill: from the query parameter to the plan](docs/design/prefill.md): what happens between the `prefill` query parameter and the HTML that is served.
|
|
115
|
+
- [Files: the upload endpoint, the reference and custody](docs/design/files.md): why `/upload` does not apply `FileHint.max_size`, why a second upload of the same reference is a `409`, and where custody of a promoted file ends up.
|
|
116
|
+
- [`WebFunction` metadata](docs/design/web-function.md): why the description is passed through `cleandoc()`, and why only the first letter of a displayed name is uppercased.
|
|
117
|
+
- [Streaming and print capture](docs/design/streaming.md): how `print()` capture works, why it is experimental, and why the transport polls.
|
|
118
|
+
- [Outputs](docs/design/outputs.md): why table rows are read with `itertuples()`, why a matplotlib figure is closed, and why a union cannot mix a download with an ordinary branch.
|
|
119
|
+
- [The iframe channel: three decisions](docs/design/sdk.md): why the modal does not close itself by default, why `error` is not about validation, and why the payload of `result` is the envelope of `/invoke` again.
|
|
120
|
+
- [Frontend: assets, icons and color](docs/design/frontend.md): why the content type is decided rather than guessed, why every icon is a file, and why the page adds almost no color of its own.
|
|
121
|
+
- [Architecture: what counts as public contract](docs/design/architecture.md): why the line between the public API and the merely visible internals falls where it does.
|
|
122
|
+
- [What changed underneath, from 1.6 to 2.0](docs/design/history-1.6-to-2.0.md): why 2.0 breaks what it breaks: the two layers underneath were rewritten, and what that widened, lost and left as a limit.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# FuncToWeb
|
|
2
|
+
|
|
3
|
+
**Turn typed Python functions into web interfaces.**
|
|
4
|
+
|
|
5
|
+
Write a normal Python function with type hints. FuncToWeb turns it into a
|
|
6
|
+
ready-to-use web form, validates its input and runs it over HTTP. No models, no
|
|
7
|
+
duplicated schemas, no hand-written forms.
|
|
8
|
+
|
|
9
|
+
The same function is also an HTTP endpoint, a contract published at `/doc` for
|
|
10
|
+
people and agents, an application you mount inside FastAPI, and a page your own
|
|
11
|
+
frontend opens in a modal.
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from func_to_web import run
|
|
15
|
+
|
|
16
|
+
def divide(a: float, b: float) -> float:
|
|
17
|
+
return a / b # Any exception becomes a clean error in the page and the API
|
|
18
|
+
|
|
19
|
+
run(divide) # http://127.0.0.1:8000
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The full documentation is at https://offerrall.github.io/func-to-web/.
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
- [Overview](docs/overview.md): the same function as a form, an API, a contract and a modal; how it works, what it offers and how it compares.
|
|
27
|
+
- [Getting started](docs/getting-started.md): write your first function and run it.
|
|
28
|
+
- [Examples](docs/examples.md): the runnable examples and mini-apps, how to run them, and what each folder teaches.
|
|
29
|
+
- [`run()`](docs/run.md): the standalone application and the space index.
|
|
30
|
+
- [`app_of()`](docs/router.md): mounting the application in an existing FastAPI host application.
|
|
31
|
+
- [Types and validation](docs/types.md): constraints, dataclasses, lists, unions, optionals and defaults.
|
|
32
|
+
- [Prefill and hidden parameters](docs/prefill.md): open a form with initial values, from Python or from the URL.
|
|
33
|
+
- [Files](docs/files.md): uploads, reusable file references, and which layer applies each limit.
|
|
34
|
+
- [`WebFunction` and `WebFunctions`](docs/web-function.md): the name, description and slug of a function; prepared spaces.
|
|
35
|
+
- [Execution over HTTP](docs/http.md): `/invoke`, the request body, the envelope and the status codes.
|
|
36
|
+
- [Streaming](docs/streaming.md): `/invoke-stream`, SSE events and `print()` capture.
|
|
37
|
+
- [Outputs](docs/outputs.md): text, images, tables and downloads with `Download`.
|
|
38
|
+
- [`OpenForm`](docs/open-form.md): open another function's form with the return value as prefill.
|
|
39
|
+
- [`/doc`](docs/api-docs.md): the published contract that a client or an agent consumes.
|
|
40
|
+
- [`sdk.js`](docs/sdk.md): the helpers that call a space from your own frontend, and how to embed a function's page in another site.
|
|
41
|
+
- [Static assets](docs/static-assets.md): `/static`, the icons, the theme and how they are cached.
|
|
42
|
+
- [Security](docs/security.md): what FuncToWeb covers and what belongs to the host application.
|
|
43
|
+
- [Architecture](docs/architecture.md): the layers and what each one solves.
|
|
44
|
+
- [Limitations](docs/limitations.md): the known limits, in a single list.
|
|
45
|
+
|
|
46
|
+
### Maintaining
|
|
47
|
+
|
|
48
|
+
- [The space index](docs/design/run.md): why the page `run()` adds at `/` navigates with `location.replace()` and carries no form logic of its own.
|
|
49
|
+
- [The application](docs/design/router.md): why both storage TTLs default to one hour, and why the theme is resolved in pure CSS.
|
|
50
|
+
- [Prefill: from the query parameter to the plan](docs/design/prefill.md): what happens between the `prefill` query parameter and the HTML that is served.
|
|
51
|
+
- [Files: the upload endpoint, the reference and custody](docs/design/files.md): why `/upload` does not apply `FileHint.max_size`, why a second upload of the same reference is a `409`, and where custody of a promoted file ends up.
|
|
52
|
+
- [`WebFunction` metadata](docs/design/web-function.md): why the description is passed through `cleandoc()`, and why only the first letter of a displayed name is uppercased.
|
|
53
|
+
- [Streaming and print capture](docs/design/streaming.md): how `print()` capture works, why it is experimental, and why the transport polls.
|
|
54
|
+
- [Outputs](docs/design/outputs.md): why table rows are read with `itertuples()`, why a matplotlib figure is closed, and why a union cannot mix a download with an ordinary branch.
|
|
55
|
+
- [The iframe channel: three decisions](docs/design/sdk.md): why the modal does not close itself by default, why `error` is not about validation, and why the payload of `result` is the envelope of `/invoke` again.
|
|
56
|
+
- [Frontend: assets, icons and color](docs/design/frontend.md): why the content type is decided rather than guessed, why every icon is a file, and why the page adds almost no color of its own.
|
|
57
|
+
- [Architecture: what counts as public contract](docs/design/architecture.md): why the line between the public API and the merely visible internals falls where it does.
|
|
58
|
+
- [What changed underneath, from 1.6 to 2.0](docs/design/history-1.6-to-2.0.md): why 2.0 breaks what it breaks: the two layers underneath were rewritten, and what that widened, lost and left as a limit.
|
|
@@ -57,7 +57,8 @@ test-browser = [
|
|
|
57
57
|
|
|
58
58
|
[project.urls]
|
|
59
59
|
Homepage = "https://github.com/offerrall/FuncToWeb"
|
|
60
|
-
|
|
60
|
+
Documentation = "https://offerrall.github.io/func-to-web/"
|
|
61
|
+
Repository = "https://github.com/offerrall/FuncToWeb"
|
|
61
62
|
|
|
62
63
|
[tool.pytest.ini_options]
|
|
63
64
|
testpaths = ["tests"]
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: func-to-web
|
|
3
|
+
Version: 2.7.4
|
|
4
|
+
Summary: Expose typed Python functions as web interfaces.
|
|
5
|
+
Author: Beltrán Offerrall
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Beltrán Offerrall
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/offerrall/FuncToWeb
|
|
29
|
+
Project-URL: Documentation, https://offerrall.github.io/func-to-web/
|
|
30
|
+
Project-URL: Repository, https://github.com/offerrall/FuncToWeb
|
|
31
|
+
Keywords: web,forms,type-hints,ui
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Typing :: Typed
|
|
41
|
+
Requires-Python: >=3.11
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
License-File: LICENSE
|
|
44
|
+
Requires-Dist: pytypehintweb==1.2.0
|
|
45
|
+
Requires-Dist: starlette==0.49.3
|
|
46
|
+
Requires-Dist: uvicorn==0.38.0
|
|
47
|
+
Provides-Extra: test
|
|
48
|
+
Requires-Dist: pytest; extra == "test"
|
|
49
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
50
|
+
Requires-Dist: pytest-asyncio; extra == "test"
|
|
51
|
+
Requires-Dist: httpx; extra == "test"
|
|
52
|
+
Requires-Dist: build; extra == "test"
|
|
53
|
+
Requires-Dist: twine; extra == "test"
|
|
54
|
+
Requires-Dist: fastapi==0.121.1; extra == "test"
|
|
55
|
+
Provides-Extra: test-outputs
|
|
56
|
+
Requires-Dist: pandas; extra == "test-outputs"
|
|
57
|
+
Requires-Dist: polars; extra == "test-outputs"
|
|
58
|
+
Requires-Dist: numpy; extra == "test-outputs"
|
|
59
|
+
Requires-Dist: pillow; extra == "test-outputs"
|
|
60
|
+
Requires-Dist: matplotlib; extra == "test-outputs"
|
|
61
|
+
Provides-Extra: test-browser
|
|
62
|
+
Requires-Dist: playwright; extra == "test-browser"
|
|
63
|
+
Dynamic: license-file
|
|
64
|
+
|
|
65
|
+
# FuncToWeb
|
|
66
|
+
|
|
67
|
+
**Turn typed Python functions into web interfaces.**
|
|
68
|
+
|
|
69
|
+
Write a normal Python function with type hints. FuncToWeb turns it into a
|
|
70
|
+
ready-to-use web form, validates its input and runs it over HTTP. No models, no
|
|
71
|
+
duplicated schemas, no hand-written forms.
|
|
72
|
+
|
|
73
|
+
The same function is also an HTTP endpoint, a contract published at `/doc` for
|
|
74
|
+
people and agents, an application you mount inside FastAPI, and a page your own
|
|
75
|
+
frontend opens in a modal.
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from func_to_web import run
|
|
79
|
+
|
|
80
|
+
def divide(a: float, b: float) -> float:
|
|
81
|
+
return a / b # Any exception becomes a clean error in the page and the API
|
|
82
|
+
|
|
83
|
+
run(divide) # http://127.0.0.1:8000
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The full documentation is at https://offerrall.github.io/func-to-web/.
|
|
87
|
+
|
|
88
|
+
## Documentation
|
|
89
|
+
|
|
90
|
+
- [Overview](docs/overview.md): the same function as a form, an API, a contract and a modal; how it works, what it offers and how it compares.
|
|
91
|
+
- [Getting started](docs/getting-started.md): write your first function and run it.
|
|
92
|
+
- [Examples](docs/examples.md): the runnable examples and mini-apps, how to run them, and what each folder teaches.
|
|
93
|
+
- [`run()`](docs/run.md): the standalone application and the space index.
|
|
94
|
+
- [`app_of()`](docs/router.md): mounting the application in an existing FastAPI host application.
|
|
95
|
+
- [Types and validation](docs/types.md): constraints, dataclasses, lists, unions, optionals and defaults.
|
|
96
|
+
- [Prefill and hidden parameters](docs/prefill.md): open a form with initial values, from Python or from the URL.
|
|
97
|
+
- [Files](docs/files.md): uploads, reusable file references, and which layer applies each limit.
|
|
98
|
+
- [`WebFunction` and `WebFunctions`](docs/web-function.md): the name, description and slug of a function; prepared spaces.
|
|
99
|
+
- [Execution over HTTP](docs/http.md): `/invoke`, the request body, the envelope and the status codes.
|
|
100
|
+
- [Streaming](docs/streaming.md): `/invoke-stream`, SSE events and `print()` capture.
|
|
101
|
+
- [Outputs](docs/outputs.md): text, images, tables and downloads with `Download`.
|
|
102
|
+
- [`OpenForm`](docs/open-form.md): open another function's form with the return value as prefill.
|
|
103
|
+
- [`/doc`](docs/api-docs.md): the published contract that a client or an agent consumes.
|
|
104
|
+
- [`sdk.js`](docs/sdk.md): the helpers that call a space from your own frontend, and how to embed a function's page in another site.
|
|
105
|
+
- [Static assets](docs/static-assets.md): `/static`, the icons, the theme and how they are cached.
|
|
106
|
+
- [Security](docs/security.md): what FuncToWeb covers and what belongs to the host application.
|
|
107
|
+
- [Architecture](docs/architecture.md): the layers and what each one solves.
|
|
108
|
+
- [Limitations](docs/limitations.md): the known limits, in a single list.
|
|
109
|
+
|
|
110
|
+
### Maintaining
|
|
111
|
+
|
|
112
|
+
- [The space index](docs/design/run.md): why the page `run()` adds at `/` navigates with `location.replace()` and carries no form logic of its own.
|
|
113
|
+
- [The application](docs/design/router.md): why both storage TTLs default to one hour, and why the theme is resolved in pure CSS.
|
|
114
|
+
- [Prefill: from the query parameter to the plan](docs/design/prefill.md): what happens between the `prefill` query parameter and the HTML that is served.
|
|
115
|
+
- [Files: the upload endpoint, the reference and custody](docs/design/files.md): why `/upload` does not apply `FileHint.max_size`, why a second upload of the same reference is a `409`, and where custody of a promoted file ends up.
|
|
116
|
+
- [`WebFunction` metadata](docs/design/web-function.md): why the description is passed through `cleandoc()`, and why only the first letter of a displayed name is uppercased.
|
|
117
|
+
- [Streaming and print capture](docs/design/streaming.md): how `print()` capture works, why it is experimental, and why the transport polls.
|
|
118
|
+
- [Outputs](docs/design/outputs.md): why table rows are read with `itertuples()`, why a matplotlib figure is closed, and why a union cannot mix a download with an ordinary branch.
|
|
119
|
+
- [The iframe channel: three decisions](docs/design/sdk.md): why the modal does not close itself by default, why `error` is not about validation, and why the payload of `result` is the envelope of `/invoke` again.
|
|
120
|
+
- [Frontend: assets, icons and color](docs/design/frontend.md): why the content type is decided rather than guessed, why every icon is a file, and why the page adds almost no color of its own.
|
|
121
|
+
- [Architecture: what counts as public contract](docs/design/architecture.md): why the line between the public API and the merely visible internals falls where it does.
|
|
122
|
+
- [What changed underneath, from 1.6 to 2.0](docs/design/history-1.6-to-2.0.md): why 2.0 breaks what it breaks: the two layers underneath were rewritten, and what that widened, lost and left as a limit.
|