flask-apcore 0.4.0__tar.gz → 0.4.2__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.
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/CHANGELOG.md +41 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/PKG-INFO +10 -9
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/README.md +4 -3
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/pyproject.toml +12 -5
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/cli.py +2 -2
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/extension.py +5 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/output/yaml_writer.py +2 -1
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/scanners/base.py +5 -4
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_cli_serve.py +1 -1
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_extension.py +51 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_yaml_writer.py +1 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/.github/workflows/ci.yml +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/.gitignore +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/.gitmessage +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/.pre-commit-config.yaml +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/flask-apcore/prd.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/flask-apcore/tech-design.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-23-redesign-design.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-23-redesign-implementation.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-23-schema-explorer-design.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-23-schema-explorer-implementation.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-24-explorer-simplify-design.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-24-explorer-simplify-implementation.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/acl_demo/README.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/acl_demo/__init__.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/acl_demo/acl.yaml +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/acl_demo/app.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/demo/.env.example +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/demo/Dockerfile +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/demo/README.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/demo/app.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/demo/docker-compose.yml +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/examples/demo/entrypoint.sh +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/ideas/flask-apcore-idea.md +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/__init__.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/config.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/context.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/observability.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/output/__init__.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/output/registry_writer.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/registry.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/scanners/__init__.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/scanners/native.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/schemas/__init__.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/schemas/_constants.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/schemas/marshmallow_backend.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/schemas/pydantic_backend.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/schemas/typehints_backend.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/src/flask_apcore/serializers.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/__init__.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/_test_target_module.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/conftest.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_acl_demo.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_cli_scan.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_config.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_context.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_integration.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_observability.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_public_api.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_registry.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_registry_writer.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_scanner_base.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_scanner_native.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_schema_dispatcher.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_schema_marshmallow.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_schema_pydantic.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_schema_typehints.py +0 -0
- {flask_apcore-0.4.0 → flask_apcore-0.4.2}/tests/test_serializers.py +0 -0
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.4.2] - 2026-11-23
|
|
6
|
+
|
|
7
|
+
Dependency uplift to the aligned apcore 0.33.0 / apcore-toolkit 0.15.0 /
|
|
8
|
+
apcore-mcp 0.23.4 release train. All 505 tests pass.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Dependency floors raised**: `apcore >= 0.33.0` (was `>= 0.32.2`),
|
|
13
|
+
`apcore-toolkit >= 0.15.0` (was `>= 0.14.1`), and `apcore-mcp >= 0.23.4`
|
|
14
|
+
(was `>= 0.23.3`). The README requirements list, the JWT/approval
|
|
15
|
+
installation hints, and their tests now name the same versions.
|
|
16
|
+
- **`Apcore` Pydantic flattening preserves `resources`.** apcore 0.33.0 added a
|
|
17
|
+
first-class `resources` block (including the per-module `timeout` budget).
|
|
18
|
+
When auto-discovery re-registers a module whose function takes Pydantic model
|
|
19
|
+
parameters, the rebuilt `FunctionModule` now forwards `resources`; previously
|
|
20
|
+
the declared budget was silently dropped and execution fell back to
|
|
21
|
+
`executor.default_timeout`. It also preserves `display` and `examples`
|
|
22
|
+
alongside the documentation, annotations and metadata it already kept.
|
|
23
|
+
|
|
24
|
+
### Notes
|
|
25
|
+
|
|
26
|
+
- No other code change was required. The toolkit 0.15.0 effective-parameter
|
|
27
|
+
scanning and proxy preflight are opt-in surfaces used by apcore-mcp's and
|
|
28
|
+
apcore-cli's standalone OpenAPI backends; Flask's native url-map scanner and
|
|
29
|
+
the CLI/extension surfaces this package calls are unchanged.
|
|
30
|
+
|
|
31
|
+
## [0.4.1] - 2026-11-03
|
|
32
|
+
|
|
33
|
+
Dependency uplift to the aligned apcore 0.32.2 / apcore-toolkit 0.14.1 / apcore-mcp 0.23.3 release train. All tests pass.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- **Dependency floors raised**: `apcore >= 0.32.2` (was `>= 0.26.0`), `apcore-toolkit >= 0.14.1` (was `>= 0.10.0`), `apcore-mcp >= 0.23.3` (was `>= 0.17.2`).
|
|
38
|
+
- **YAML bindings now declare `spec_version: "1.0"`** at the document root, matching `apcore-toolkit`'s `YAMLWriter` and satisfying apcore's `BindingLoader`, which warns when the key is absent.
|
|
39
|
+
- Missing-`apcore-mcp` error messages and README now name the current floor (`>= 0.23.3`) instead of the original feature floor.
|
|
40
|
+
- **Ruff rule selection pinned to `["E4", "E7", "E9", "F"]`** in `pyproject.toml`. Ruff 0.16 widened its implicit default set (SIM/UP/RUF/BLE/TRY/...), so an unpinned CI `pip install` failed while an older local ruff passed. Matches the convention already used by `apcore-python` and `apcore-toolkit-python`.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **`BaseScanner.infer_annotations_from_method` docstring** now documents that `HEAD` and `OPTIONS` map to `readonly=True` (without `cacheable`), matching apcore-toolkit 0.6.0+.
|
|
45
|
+
|
|
5
46
|
## [0.4.0] - 2026-07-15
|
|
6
47
|
|
|
7
48
|
Reachable role-based ACL governance for Flask routes + dependency uplift to the aligned apcore 0.26.0 / apcore-toolkit 0.10.0 / apcore-mcp 0.17.2 governance train. All tests pass.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: flask-apcore
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Flask Extension for apcore AI-Perceivable Core integration, exposes Flask routes as MCP tools with auto-discovery, schema inference, YAML binding, and built-in observability. Supports MCP server (stdio/HTTP) for LLM tool integration.
|
|
5
5
|
Project-URL: Homepage, https://github.com/aiperceivable/
|
|
6
6
|
Project-URL: Repository, https://github.com/aiperceivable/flask-apcore
|
|
@@ -10,13 +10,13 @@ Author-email: aiperceivable <tercel.yi@gmail.com>
|
|
|
10
10
|
License-Expression: Apache-2.0
|
|
11
11
|
Keywords: ai,apcore,auto-discovery,binding,cli,extension,flask,integration,llm,mcp,module,observability,pydantic,schema,tools,yaml
|
|
12
12
|
Requires-Python: >=3.11
|
|
13
|
-
Requires-Dist: apcore-toolkit>=0.
|
|
14
|
-
Requires-Dist: apcore>=0.
|
|
13
|
+
Requires-Dist: apcore-toolkit>=0.15.0
|
|
14
|
+
Requires-Dist: apcore>=0.33.0
|
|
15
15
|
Requires-Dist: flask>=3.0
|
|
16
16
|
Requires-Dist: pydantic>=2.0
|
|
17
17
|
Requires-Dist: pyyaml>=6.0
|
|
18
18
|
Provides-Extra: all
|
|
19
|
-
Requires-Dist: apcore-mcp>=0.
|
|
19
|
+
Requires-Dist: apcore-mcp>=0.23.4; extra == 'all'
|
|
20
20
|
Requires-Dist: flask-restx>=1.0; extra == 'all'
|
|
21
21
|
Requires-Dist: flask-smorest>=0.42; extra == 'all'
|
|
22
22
|
Provides-Extra: dev
|
|
@@ -29,7 +29,7 @@ Requires-Dist: pytest-flask>=1.0; extra == 'dev'
|
|
|
29
29
|
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
30
30
|
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
31
31
|
Provides-Extra: mcp
|
|
32
|
-
Requires-Dist: apcore-mcp>=0.
|
|
32
|
+
Requires-Dist: apcore-mcp>=0.23.4; extra == 'mcp'
|
|
33
33
|
Provides-Extra: restx
|
|
34
34
|
Requires-Dist: flask-restx>=1.0; extra == 'restx'
|
|
35
35
|
Provides-Extra: smorest
|
|
@@ -64,8 +64,9 @@ Flask Extension for [apcore](https://github.com/aiperceivable/apcore-python) (AI
|
|
|
64
64
|
|
|
65
65
|
- Python >= 3.11
|
|
66
66
|
- Flask >= 3.0
|
|
67
|
-
- apcore >= 0.
|
|
68
|
-
- apcore-toolkit >= 0.
|
|
67
|
+
- apcore >= 0.33.0
|
|
68
|
+
- apcore-toolkit >= 0.15.0
|
|
69
|
+
- apcore-mcp >= 0.23.4 (optional, required for `flask apcore serve`)
|
|
69
70
|
|
|
70
71
|
## Installation
|
|
71
72
|
|
|
@@ -427,7 +428,7 @@ Browse to `http://127.0.0.1:9100/explorer/` to view the interactive explorer wit
|
|
|
427
428
|
|
|
428
429
|
## JWT Authentication
|
|
429
430
|
|
|
430
|
-
Protect MCP endpoints with JWT Bearer tokens (requires `apcore-mcp>=0.
|
|
431
|
+
Protect MCP endpoints with JWT Bearer tokens (requires `apcore-mcp>=0.23.4`, HTTP transports only):
|
|
431
432
|
|
|
432
433
|
```bash
|
|
433
434
|
flask apcore serve --http \
|
|
@@ -26,8 +26,9 @@ Flask Extension for [apcore](https://github.com/aiperceivable/apcore-python) (AI
|
|
|
26
26
|
|
|
27
27
|
- Python >= 3.11
|
|
28
28
|
- Flask >= 3.0
|
|
29
|
-
- apcore >= 0.
|
|
30
|
-
- apcore-toolkit >= 0.
|
|
29
|
+
- apcore >= 0.33.0
|
|
30
|
+
- apcore-toolkit >= 0.15.0
|
|
31
|
+
- apcore-mcp >= 0.23.4 (optional, required for `flask apcore serve`)
|
|
31
32
|
|
|
32
33
|
## Installation
|
|
33
34
|
|
|
@@ -389,7 +390,7 @@ Browse to `http://127.0.0.1:9100/explorer/` to view the interactive explorer wit
|
|
|
389
390
|
|
|
390
391
|
## JWT Authentication
|
|
391
392
|
|
|
392
|
-
Protect MCP endpoints with JWT Bearer tokens (requires `apcore-mcp>=0.
|
|
393
|
+
Protect MCP endpoints with JWT Bearer tokens (requires `apcore-mcp>=0.23.4`, HTTP transports only):
|
|
393
394
|
|
|
394
395
|
```bash
|
|
395
396
|
flask apcore serve --http \
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "flask-apcore"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.2"
|
|
8
8
|
description = "Flask Extension for apcore AI-Perceivable Core integration, exposes Flask routes as MCP tools with auto-discovery, schema inference, YAML binding, and built-in observability. Supports MCP server (stdio/HTTP) for LLM tool integration."
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
readme = "README.md"
|
|
@@ -32,8 +32,8 @@ keywords = [
|
|
|
32
32
|
]
|
|
33
33
|
dependencies = [
|
|
34
34
|
"flask>=3.0",
|
|
35
|
-
"apcore>=0.
|
|
36
|
-
"apcore-toolkit>=0.
|
|
35
|
+
"apcore>=0.33.0",
|
|
36
|
+
"apcore-toolkit>=0.15.0",
|
|
37
37
|
"pydantic>=2.0",
|
|
38
38
|
"PyYAML>=6.0",
|
|
39
39
|
]
|
|
@@ -41,7 +41,7 @@ dependencies = [
|
|
|
41
41
|
[project.optional-dependencies]
|
|
42
42
|
smorest = ["flask-smorest>=0.42"]
|
|
43
43
|
restx = ["flask-restx>=1.0"]
|
|
44
|
-
mcp = ["apcore-mcp>=0.
|
|
44
|
+
mcp = ["apcore-mcp>=0.23.4"]
|
|
45
45
|
all = [
|
|
46
46
|
"flask-apcore[mcp,smorest,restx]",
|
|
47
47
|
]
|
|
@@ -68,6 +68,13 @@ src = ["src"]
|
|
|
68
68
|
target-version = "py311"
|
|
69
69
|
line-length = 120
|
|
70
70
|
|
|
71
|
+
[tool.ruff.lint]
|
|
72
|
+
# Pin the rule set explicitly. Ruff's implicit default selection changes between
|
|
73
|
+
# releases (0.16 widened it from E4/E7/E9/F to a much larger set), which made CI
|
|
74
|
+
# fail on a newer ruff while an older local ruff passed. Widening the selection
|
|
75
|
+
# is a deliberate change, not a side effect of upgrading the linter.
|
|
76
|
+
select = ["E4", "E7", "E9", "F"]
|
|
77
|
+
|
|
71
78
|
[tool.apdev]
|
|
72
79
|
base_package = "flask_apcore"
|
|
73
80
|
|
|
@@ -79,4 +86,4 @@ strict = true
|
|
|
79
86
|
Homepage = "https://github.com/aiperceivable/"
|
|
80
87
|
Repository = "https://github.com/aiperceivable/flask-apcore"
|
|
81
88
|
Documentation = "https://github.com/aiperceivable/flask-apcore#readme"
|
|
82
|
-
Issues = "https://github.com/aiperceivable/flash-apcore/issues"
|
|
89
|
+
Issues = "https://github.com/aiperceivable/flash-apcore/issues"
|
|
@@ -416,7 +416,7 @@ def serve_command(
|
|
|
416
416
|
from apcore_mcp import JWTAuthenticator
|
|
417
417
|
except ImportError:
|
|
418
418
|
raise click.ClickException(
|
|
419
|
-
"apcore-mcp>=0.
|
|
419
|
+
"apcore-mcp>=0.23.4 is required for JWT authentication. " "Install with: pip install flask-apcore[mcp]"
|
|
420
420
|
)
|
|
421
421
|
authenticator = JWTAuthenticator(
|
|
422
422
|
jwt_secret,
|
|
@@ -508,7 +508,7 @@ def _resolve_approval_handler(mode: str) -> Any:
|
|
|
508
508
|
from apcore_mcp import ElicitationApprovalHandler
|
|
509
509
|
except ImportError:
|
|
510
510
|
raise click.ClickException(
|
|
511
|
-
f"apcore-mcp>=0.
|
|
511
|
+
f"apcore-mcp>=0.23.4 is required for approval mode '{mode}'. "
|
|
512
512
|
"Install with: pip install flask-apcore[mcp]"
|
|
513
513
|
)
|
|
514
514
|
return ElicitationApprovalHandler()
|
|
@@ -335,6 +335,11 @@ class Apcore:
|
|
|
335
335
|
version=getattr(module, "version", "1.0.0"),
|
|
336
336
|
annotations=getattr(module, "annotations", None),
|
|
337
337
|
metadata=getattr(module, "metadata", None),
|
|
338
|
+
display=getattr(module, "display", None),
|
|
339
|
+
examples=getattr(module, "examples", None),
|
|
340
|
+
# apcore 0.33.0 added resources (e.g. a per-module timeout);
|
|
341
|
+
# rebuilding the module must not drop it.
|
|
342
|
+
resources=getattr(module, "resources", None),
|
|
338
343
|
)
|
|
339
344
|
registry.unregister(module_id)
|
|
340
345
|
registry.register(module_id, new_module)
|
|
@@ -99,6 +99,7 @@ class YAMLWriter:
|
|
|
99
99
|
Includes annotations, documentation, and metadata fields.
|
|
100
100
|
"""
|
|
101
101
|
return {
|
|
102
|
+
"spec_version": "1.0",
|
|
102
103
|
"bindings": [
|
|
103
104
|
{
|
|
104
105
|
"module_id": module.module_id,
|
|
@@ -112,5 +113,5 @@ class YAMLWriter:
|
|
|
112
113
|
"input_schema": module.input_schema,
|
|
113
114
|
"output_schema": module.output_schema,
|
|
114
115
|
}
|
|
115
|
-
]
|
|
116
|
+
],
|
|
116
117
|
}
|
|
@@ -124,10 +124,11 @@ class BaseScanner(ABC):
|
|
|
124
124
|
"""Infer behavioral annotations from an HTTP method.
|
|
125
125
|
|
|
126
126
|
Delegates to the shared logic in apcore-toolkit. Mapping:
|
|
127
|
-
GET
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
GET -> readonly=True, cacheable=True
|
|
128
|
+
HEAD / OPTIONS -> readonly=True
|
|
129
|
+
DELETE -> destructive=True
|
|
130
|
+
PUT -> idempotent=True
|
|
131
|
+
Others -> default (all False)
|
|
131
132
|
|
|
132
133
|
Args:
|
|
133
134
|
method: HTTP method string (e.g., "GET", "post").
|
|
@@ -580,7 +580,7 @@ class TestJwtAuthenticatorImportError:
|
|
|
580
580
|
result = runner.invoke(args=["apcore", "serve", "--jwt-secret", "a-long-enough-secret"])
|
|
581
581
|
|
|
582
582
|
assert result.exit_code != 0
|
|
583
|
-
assert "apcore-mcp>=0.
|
|
583
|
+
assert "apcore-mcp>=0.23.4" in result.output
|
|
584
584
|
|
|
585
585
|
|
|
586
586
|
# ---------------------------------------------------------------------------
|
|
@@ -250,3 +250,54 @@ class TestConvenienceMethods:
|
|
|
250
250
|
executor = apcore_ext.get_executor()
|
|
251
251
|
# Should include tracing + metrics middlewares
|
|
252
252
|
assert len(executor.middlewares) >= 2
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
# ===========================================================================
|
|
256
|
+
# Pydantic flattening — rebuild fidelity
|
|
257
|
+
# ===========================================================================
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
class TestFlattenPreservesResources:
|
|
261
|
+
"""Re-registering a flattened module must keep its metadata and resources."""
|
|
262
|
+
|
|
263
|
+
def test_resources_survive_pydantic_flattening(self, tmp_path) -> None:
|
|
264
|
+
from apcore import FunctionModule, ModuleExample
|
|
265
|
+
from pydantic import BaseModel
|
|
266
|
+
|
|
267
|
+
from flask_apcore import Apcore
|
|
268
|
+
|
|
269
|
+
class Body(BaseModel):
|
|
270
|
+
title: str
|
|
271
|
+
|
|
272
|
+
def create_item(body) -> dict:
|
|
273
|
+
return {"title": body.title}
|
|
274
|
+
|
|
275
|
+
# Set the annotation to the class object so ``typing.get_type_hints``
|
|
276
|
+
# can resolve it despite the nested definition.
|
|
277
|
+
create_item.__annotations__["body"] = Body
|
|
278
|
+
|
|
279
|
+
app = _make_app(tmp_path)
|
|
280
|
+
apcore_ext = Apcore(app)
|
|
281
|
+
registry = app.extensions["apcore"]["registry"]
|
|
282
|
+
registry.register(
|
|
283
|
+
"test.create_item",
|
|
284
|
+
FunctionModule(
|
|
285
|
+
func=create_item,
|
|
286
|
+
module_id="test.create_item",
|
|
287
|
+
annotations={"requires_approval": True},
|
|
288
|
+
metadata={"source": "binding"},
|
|
289
|
+
display={"alias": "create-item"},
|
|
290
|
+
examples=[ModuleExample(title="demo", inputs={"title": "x"})],
|
|
291
|
+
resources={"timeout": 1500},
|
|
292
|
+
),
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
apcore_ext._flatten_registered_modules(registry)
|
|
296
|
+
|
|
297
|
+
module = registry.get("test.create_item")
|
|
298
|
+
assert module.resources == {"timeout": 1500}
|
|
299
|
+
assert module.annotations is not None
|
|
300
|
+
assert module.annotations.requires_approval is True
|
|
301
|
+
assert module.metadata == {"source": "binding"}
|
|
302
|
+
assert module.display == {"alias": "create-item"}
|
|
303
|
+
assert module.examples == [ModuleExample(title="demo", inputs={"title": "x"})]
|
|
@@ -74,6 +74,7 @@ class TestYAMLWriter:
|
|
|
74
74
|
file_path = results[0].path
|
|
75
75
|
assert file_path is not None
|
|
76
76
|
parsed = yaml.safe_load(open(file_path))
|
|
77
|
+
assert parsed["spec_version"] == "1.0"
|
|
77
78
|
assert "bindings" in parsed
|
|
78
79
|
assert len(parsed["bindings"]) == 1
|
|
79
80
|
entry = parsed["bindings"][0]
|
|
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
|
{flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-23-schema-explorer-implementation.md
RENAMED
|
File without changes
|
|
File without changes
|
{flask_apcore-0.4.0 → flask_apcore-0.4.2}/docs/plans/2026-02-24-explorer-simplify-implementation.md
RENAMED
|
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
|