func-to-web 2.6.2__tar.gz → 2.7.0__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.6.2/src/func_to_web.egg-info → func_to_web-2.7.0}/PKG-INFO +4 -4
- {func_to_web-2.6.2 → func_to_web-2.7.0}/README.md +2 -2
- {func_to_web-2.6.2 → func_to_web-2.7.0}/pyproject.toml +1 -1
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/config.py +1 -1
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/functions.py +28 -3
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/page.js +4 -5
- {func_to_web-2.6.2 → func_to_web-2.7.0/src/func_to_web.egg-info}/PKG-INFO +4 -4
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/requires.txt +1 -1
- {func_to_web-2.6.2 → func_to_web-2.7.0}/LICENSE +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/setup.cfg +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/__init__.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/__init__.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/file_defaults.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/function.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/return_parser.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/models/submit_defaults.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/__init__.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/download.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/form.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/image.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/table.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/outputs/text.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/py.typed +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/emit.js +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/alert.svg +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/check.svg +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/clock.svg +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/copy.svg +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/icons/download.svg +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/output.js +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/page.css +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/sdk.js +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/static/upload.js +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/__init__.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/doc.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/index.html +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/index.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/page.html +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/page.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/templates/theme.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/__init__.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/execution.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/messages.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/pending.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/print_capture.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/references.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/returned_files.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/router.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/run.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/stream.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web/web/upload.py +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/SOURCES.txt +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/dependency_links.txt +0 -0
- {func_to_web-2.6.2 → func_to_web-2.7.0}/src/func_to_web.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: func-to-web
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: Expose typed Python functions as web interfaces.
|
|
5
5
|
Author: Beltrán Offerrall
|
|
6
6
|
License: MIT License
|
|
@@ -40,7 +40,7 @@ Classifier: Typing :: Typed
|
|
|
40
40
|
Requires-Python: >=3.11
|
|
41
41
|
Description-Content-Type: text/markdown
|
|
42
42
|
License-File: LICENSE
|
|
43
|
-
Requires-Dist: pytypehintweb==1.
|
|
43
|
+
Requires-Dist: pytypehintweb==1.2.0
|
|
44
44
|
Requires-Dist: starlette==0.49.3
|
|
45
45
|
Requires-Dist: uvicorn==0.38.0
|
|
46
46
|
Provides-Extra: test
|
|
@@ -61,7 +61,7 @@ Provides-Extra: test-browser
|
|
|
61
61
|
Requires-Dist: playwright; extra == "test-browser"
|
|
62
62
|
Dynamic: license-file
|
|
63
63
|
|
|
64
|
-
# FuncToWeb 2.
|
|
64
|
+
# FuncToWeb 2.7.0
|
|
65
65
|
|
|
66
66
|
[](https://pypi.org/project/func-to-web/)
|
|
67
67
|
[](https://pypi.org/project/func-to-web/)
|
|
@@ -584,7 +584,7 @@ practice.
|
|
|
584
584
|
|
|
585
585
|
## Status
|
|
586
586
|
|
|
587
|
-
**FuncToWeb 2.
|
|
587
|
+
**FuncToWeb 2.7.0 is stable, used daily and actively maintained.**
|
|
588
588
|
|
|
589
589
|
The public API is the one described in
|
|
590
590
|
[`docs/`](docs/index.md), and the known limitations are listed in
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# FuncToWeb 2.
|
|
1
|
+
# FuncToWeb 2.7.0
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/func-to-web/)
|
|
4
4
|
[](https://pypi.org/project/func-to-web/)
|
|
@@ -521,7 +521,7 @@ practice.
|
|
|
521
521
|
|
|
522
522
|
## Status
|
|
523
523
|
|
|
524
|
-
**FuncToWeb 2.
|
|
524
|
+
**FuncToWeb 2.7.0 is stable, used daily and actively maintained.**
|
|
525
525
|
|
|
526
526
|
The public API is the one described in
|
|
527
527
|
[`docs/`](docs/index.md), and the known limitations are listed in
|
|
@@ -148,16 +148,41 @@ def _target_of(
|
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
def _check_hidden(mark: OpenForm, target: WebFunction) -> None:
|
|
151
|
-
names = {param.name for param in target.schema.params}
|
|
152
|
-
|
|
153
151
|
for name in mark.hidden:
|
|
154
|
-
if
|
|
152
|
+
if not _has_hidden_path(target.plan, name):
|
|
155
153
|
raise ReturnContractError(
|
|
156
154
|
f"unknown hidden field {name!r} for OpenForm target "
|
|
157
155
|
f"{target.slug!r}"
|
|
158
156
|
)
|
|
159
157
|
|
|
160
158
|
|
|
159
|
+
def _has_hidden_path(node: dict[str, Any], path: str) -> bool:
|
|
160
|
+
"""Resolve visibility against the same plan the browser compiles.
|
|
161
|
+
|
|
162
|
+
Optional and choice wrappers do not add path components. A list consumes
|
|
163
|
+
'*', so its rule also applies to items created later in the browser.
|
|
164
|
+
"""
|
|
165
|
+
kind = node["kind"]
|
|
166
|
+
if kind in ("form", "object"):
|
|
167
|
+
return any(
|
|
168
|
+
path == field["name"] or (
|
|
169
|
+
path.startswith(field["name"] + ".")
|
|
170
|
+
and _has_hidden_path(field["node"], path[len(field["name"]) + 1:])
|
|
171
|
+
)
|
|
172
|
+
for field in node["fields"]
|
|
173
|
+
)
|
|
174
|
+
if kind == "list":
|
|
175
|
+
return path == "*" or (
|
|
176
|
+
path.startswith("*.") and _has_hidden_path(node["item"], path[2:])
|
|
177
|
+
)
|
|
178
|
+
if kind == "optional":
|
|
179
|
+
return _has_hidden_path(node["node"], path)
|
|
180
|
+
if kind == "choice":
|
|
181
|
+
return any(_has_hidden_path(branch["node"], path)
|
|
182
|
+
for branch in node["branches"])
|
|
183
|
+
return False
|
|
184
|
+
|
|
185
|
+
|
|
161
186
|
FunctionEntry: TypeAlias = Callable[..., Any] | WebFunction
|
|
162
187
|
FunctionInput: TypeAlias = (
|
|
163
188
|
WebFunctions | FunctionEntry | Iterable[FunctionEntry]
|
|
@@ -8,19 +8,18 @@ import { runUploads } from "./upload.js";
|
|
|
8
8
|
|
|
9
9
|
const plan = JSON.parse(
|
|
10
10
|
document.getElementById("functoweb-plan").textContent);
|
|
11
|
-
const
|
|
11
|
+
const hidden = JSON.parse(
|
|
12
|
+
document.getElementById("functoweb-hidden").textContent);
|
|
13
|
+
const form = compileForm(plan, { hidden });
|
|
12
14
|
|
|
13
15
|
const labels = new Map(plan.fields.map((field) => [field.name, field.label]));
|
|
14
16
|
|
|
15
|
-
const hidden = new Set(JSON.parse(
|
|
16
|
-
document.getElementById("functoweb-hidden").textContent));
|
|
17
|
-
|
|
18
17
|
const autorun = JSON.parse(
|
|
19
18
|
document.getElementById("functoweb-autorun").textContent);
|
|
20
19
|
|
|
21
20
|
const fields = document.getElementById("fields");
|
|
22
21
|
for (const field of form.fields) {
|
|
23
|
-
|
|
22
|
+
fields.append(field.widget.el);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
const result = document.getElementById("result");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: func-to-web
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: Expose typed Python functions as web interfaces.
|
|
5
5
|
Author: Beltrán Offerrall
|
|
6
6
|
License: MIT License
|
|
@@ -40,7 +40,7 @@ Classifier: Typing :: Typed
|
|
|
40
40
|
Requires-Python: >=3.11
|
|
41
41
|
Description-Content-Type: text/markdown
|
|
42
42
|
License-File: LICENSE
|
|
43
|
-
Requires-Dist: pytypehintweb==1.
|
|
43
|
+
Requires-Dist: pytypehintweb==1.2.0
|
|
44
44
|
Requires-Dist: starlette==0.49.3
|
|
45
45
|
Requires-Dist: uvicorn==0.38.0
|
|
46
46
|
Provides-Extra: test
|
|
@@ -61,7 +61,7 @@ Provides-Extra: test-browser
|
|
|
61
61
|
Requires-Dist: playwright; extra == "test-browser"
|
|
62
62
|
Dynamic: license-file
|
|
63
63
|
|
|
64
|
-
# FuncToWeb 2.
|
|
64
|
+
# FuncToWeb 2.7.0
|
|
65
65
|
|
|
66
66
|
[](https://pypi.org/project/func-to-web/)
|
|
67
67
|
[](https://pypi.org/project/func-to-web/)
|
|
@@ -584,7 +584,7 @@ practice.
|
|
|
584
584
|
|
|
585
585
|
## Status
|
|
586
586
|
|
|
587
|
-
**FuncToWeb 2.
|
|
587
|
+
**FuncToWeb 2.7.0 is stable, used daily and actively maintained.**
|
|
588
588
|
|
|
589
589
|
The public API is the one described in
|
|
590
590
|
[`docs/`](docs/index.md), and the known limitations are listed in
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|