flask-apcore 0.1.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.
- flask_apcore-0.1.0/.gitignore +18 -0
- flask_apcore-0.1.0/.gitmessage +60 -0
- flask_apcore-0.1.0/.pre-commit-config.yaml +27 -0
- flask_apcore-0.1.0/CHANGELOG.md +15 -0
- flask_apcore-0.1.0/PKG-INFO +26 -0
- flask_apcore-0.1.0/README.md +282 -0
- flask_apcore-0.1.0/docs/flask-apcore/prd.md +1173 -0
- flask_apcore-0.1.0/docs/flask-apcore/tech-design.md +2539 -0
- flask_apcore-0.1.0/docs/plans/2026-02-23-redesign-design.md +283 -0
- flask_apcore-0.1.0/docs/plans/2026-02-23-redesign-implementation.md +1574 -0
- flask_apcore-0.1.0/examples/demo/Dockerfile +14 -0
- flask_apcore-0.1.0/examples/demo/README.md +58 -0
- flask_apcore-0.1.0/examples/demo/app.py +144 -0
- flask_apcore-0.1.0/examples/demo/docker-compose.yml +9 -0
- flask_apcore-0.1.0/examples/demo/entrypoint.sh +10 -0
- flask_apcore-0.1.0/ideas/flask-apcore-idea.md +99 -0
- flask_apcore-0.1.0/pyproject.toml +53 -0
- flask_apcore-0.1.0/src/flask_apcore/__init__.py +34 -0
- flask_apcore-0.1.0/src/flask_apcore/cli.py +299 -0
- flask_apcore-0.1.0/src/flask_apcore/config.py +345 -0
- flask_apcore-0.1.0/src/flask_apcore/context.py +175 -0
- flask_apcore-0.1.0/src/flask_apcore/extension.py +241 -0
- flask_apcore-0.1.0/src/flask_apcore/observability.py +100 -0
- flask_apcore-0.1.0/src/flask_apcore/output/__init__.py +33 -0
- flask_apcore-0.1.0/src/flask_apcore/output/registry_writer.py +105 -0
- flask_apcore-0.1.0/src/flask_apcore/output/yaml_writer.py +119 -0
- flask_apcore-0.1.0/src/flask_apcore/registry.py +193 -0
- flask_apcore-0.1.0/src/flask_apcore/scanners/__init__.py +56 -0
- flask_apcore-0.1.0/src/flask_apcore/scanners/base.py +161 -0
- flask_apcore-0.1.0/src/flask_apcore/scanners/native.py +273 -0
- flask_apcore-0.1.0/src/flask_apcore/schemas/__init__.py +143 -0
- flask_apcore-0.1.0/src/flask_apcore/schemas/_constants.py +15 -0
- flask_apcore-0.1.0/src/flask_apcore/schemas/marshmallow_backend.py +183 -0
- flask_apcore-0.1.0/src/flask_apcore/schemas/pydantic_backend.py +173 -0
- flask_apcore-0.1.0/src/flask_apcore/schemas/typehints_backend.py +153 -0
- flask_apcore-0.1.0/tests/__init__.py +1 -0
- flask_apcore-0.1.0/tests/_test_target_module.py +6 -0
- flask_apcore-0.1.0/tests/conftest.py +32 -0
- flask_apcore-0.1.0/tests/test_cli_scan.py +271 -0
- flask_apcore-0.1.0/tests/test_cli_serve.py +362 -0
- flask_apcore-0.1.0/tests/test_config.py +588 -0
- flask_apcore-0.1.0/tests/test_context.py +230 -0
- flask_apcore-0.1.0/tests/test_extension.py +251 -0
- flask_apcore-0.1.0/tests/test_integration.py +485 -0
- flask_apcore-0.1.0/tests/test_observability.py +198 -0
- flask_apcore-0.1.0/tests/test_public_api.py +123 -0
- flask_apcore-0.1.0/tests/test_registry.py +187 -0
- flask_apcore-0.1.0/tests/test_registry_writer.py +167 -0
- flask_apcore-0.1.0/tests/test_scanner_base.py +245 -0
- flask_apcore-0.1.0/tests/test_scanner_native.py +308 -0
- flask_apcore-0.1.0/tests/test_schema_dispatcher.py +121 -0
- flask_apcore-0.1.0/tests/test_schema_marshmallow.py +242 -0
- flask_apcore-0.1.0/tests/test_schema_pydantic.py +156 -0
- flask_apcore-0.1.0/tests/test_schema_typehints.py +180 -0
- flask_apcore-0.1.0/tests/test_yaml_writer.py +207 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# <type>(<scope>): <subject>
|
|
2
|
+
#
|
|
3
|
+
# <body>
|
|
4
|
+
#
|
|
5
|
+
# <footer>
|
|
6
|
+
|
|
7
|
+
# Type must be one of the following:
|
|
8
|
+
# feat: A new feature
|
|
9
|
+
# fix: A bug fix
|
|
10
|
+
# docs: Documentation only changes
|
|
11
|
+
# style: Changes that do not affect the meaning of the code
|
|
12
|
+
# refactor: A code change that neither fixes a bug nor adds a feature
|
|
13
|
+
# perf: A code change that improves performance
|
|
14
|
+
# test: Adding missing tests or correcting existing tests
|
|
15
|
+
# chore: Changes to the build process or auxiliary tools
|
|
16
|
+
# ci: Changes to CI configuration files and scripts
|
|
17
|
+
|
|
18
|
+
# Scope is optional and can be anything specifying the place of the commit change.
|
|
19
|
+
# Examples: api, core, storage, cli, stdio, etc.
|
|
20
|
+
|
|
21
|
+
# Subject should be:
|
|
22
|
+
# - Use imperative, present tense: "change" not "changed" nor "changes"
|
|
23
|
+
# - Don't capitalize first letter
|
|
24
|
+
# - No dot (.) at the end
|
|
25
|
+
# - Maximum 72 characters
|
|
26
|
+
|
|
27
|
+
# Body should include:
|
|
28
|
+
# - Motivation for the change and contrast with previous behavior
|
|
29
|
+
# - What changed and why
|
|
30
|
+
# - Any breaking changes
|
|
31
|
+
|
|
32
|
+
# Footer should contain:
|
|
33
|
+
# - Breaking changes (start with BREAKING CHANGE:)
|
|
34
|
+
# - Issue references (Closes #123, Fixes #456)
|
|
35
|
+
|
|
36
|
+
# Examples:
|
|
37
|
+
# feat(stdio): add stdio executor for process execution
|
|
38
|
+
#
|
|
39
|
+
# Implement a new stdio executor that allows executing system commands
|
|
40
|
+
# and processes via stdin/stdout communication, similar to MCP stdio
|
|
41
|
+
# transport mode. This enables flexible task execution through shell
|
|
42
|
+
# commands and Python scripts.
|
|
43
|
+
#
|
|
44
|
+
# - Add StdioExecutor class with command execution support
|
|
45
|
+
# - Add system resource monitoring (CPU, memory, disk)
|
|
46
|
+
# - Support async process communication
|
|
47
|
+
# - Add comprehensive error handling and logging
|
|
48
|
+
#
|
|
49
|
+
# Closes #123
|
|
50
|
+
|
|
51
|
+
# refactor(core): extract shared types to core.types module
|
|
52
|
+
#
|
|
53
|
+
# Move common type definitions from various modules to a centralized
|
|
54
|
+
# core.types module to avoid circular dependencies and improve code
|
|
55
|
+
# organization.
|
|
56
|
+
#
|
|
57
|
+
# - Add TaskPreHook and TaskPostHook type aliases
|
|
58
|
+
# - Move TaskStatus enum to core.types
|
|
59
|
+
# - Update imports across affected modules
|
|
60
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
|
|
3
|
+
# apdev hooks
|
|
4
|
+
- repo: local
|
|
5
|
+
hooks:
|
|
6
|
+
- id: check-chars
|
|
7
|
+
name: apdev check-chars
|
|
8
|
+
entry: apdev check-chars
|
|
9
|
+
language: system
|
|
10
|
+
types_or: [text, python]
|
|
11
|
+
|
|
12
|
+
- id: check-imports
|
|
13
|
+
name: apdev check-imports
|
|
14
|
+
entry: apdev check-imports
|
|
15
|
+
language: system
|
|
16
|
+
pass_filenames: false
|
|
17
|
+
always_run: true
|
|
18
|
+
|
|
19
|
+
# Ruff linter and formatter
|
|
20
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
21
|
+
rev: v0.8.4
|
|
22
|
+
hooks:
|
|
23
|
+
- id: ruff
|
|
24
|
+
args: [--fix]
|
|
25
|
+
files: ^(src|tests)/
|
|
26
|
+
- id: ruff-format
|
|
27
|
+
files: ^(src|tests)/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-02-23
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial release of `flask-apcore`.
|
|
9
|
+
- Flask extension for apcore AI-Perceivable Core integration.
|
|
10
|
+
- App-scoped Registry, Executor, and ContextFactory wrappers following Flask multi-app best practices.
|
|
11
|
+
- Direct registration of scanned modules into the apcore Registry via `RegistryWriter`.
|
|
12
|
+
- Support for user and observability middlewares, ACL, and executor config.
|
|
13
|
+
- Schema backends for Marshmallow, Pydantic, and type hints.
|
|
14
|
+
- Comprehensive test suite including async test support.
|
|
15
|
+
- Developer tooling: pytest, pytest-flask, pytest-asyncio, ruff, mypy, pre-commit, coverage.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flask-apcore
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Flask Extension for apcore AI-Perceivable Core integration
|
|
5
|
+
Author-email: aipartnerup <tercel.yi@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Requires-Dist: apcore>=0.6.0
|
|
9
|
+
Requires-Dist: flask>=3.0
|
|
10
|
+
Requires-Dist: pydantic>=2.0
|
|
11
|
+
Requires-Dist: pyyaml>=6.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: apdev[dev]>=0.1.6; extra == 'dev'
|
|
14
|
+
Requires-Dist: coverage>=7.0; extra == 'dev'
|
|
15
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
16
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
17
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
18
|
+
Requires-Dist: pytest-flask>=1.0; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
20
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
21
|
+
Provides-Extra: mcp
|
|
22
|
+
Requires-Dist: apcore-mcp>=0.4.0; extra == 'mcp'
|
|
23
|
+
Provides-Extra: restx
|
|
24
|
+
Requires-Dist: flask-restx>=1.0; extra == 'restx'
|
|
25
|
+
Provides-Extra: smorest
|
|
26
|
+
Requires-Dist: flask-smorest>=0.42; extra == 'smorest'
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
# flask-apcore
|
|
2
|
+
|
|
3
|
+
Flask Extension for [apcore](https://github.com/aipartnerup/apcore-python) (AI-Perceivable Core) integration. Expose your Flask routes as MCP tools with auto-discovery, Pydantic schema inference, and built-in observability.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Route scanning** -- auto-discover Flask routes and convert them to apcore modules
|
|
8
|
+
- **Annotation inference** -- `GET` -> readonly, `DELETE` -> destructive, `PUT` -> idempotent
|
|
9
|
+
- **Pydantic schema inference** -- input/output schemas extracted from type hints automatically
|
|
10
|
+
- **`@module` decorator** -- define standalone AI-callable modules with full schema enforcement
|
|
11
|
+
- **YAML binding** -- zero-code module definitions via external `.binding.yaml` files
|
|
12
|
+
- **MCP server** -- stdio and streamable-http transports via `flask apcore serve`
|
|
13
|
+
- **Observability** -- distributed tracing, metrics, and structured JSON logging
|
|
14
|
+
- **Input validation** -- validate tool inputs against Pydantic schemas before execution
|
|
15
|
+
- **CLI-first workflow** -- `flask apcore scan` + `flask apcore serve` for zero-intrusion integration
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Python >= 3.11
|
|
20
|
+
- Flask >= 3.0
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Core
|
|
26
|
+
pip install flask-apcore
|
|
27
|
+
|
|
28
|
+
# With MCP server support (required for `flask apcore serve`)
|
|
29
|
+
pip install flask-apcore[mcp]
|
|
30
|
+
|
|
31
|
+
# All optional extras
|
|
32
|
+
pip install flask-apcore[mcp,smorest,restx]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### 1. Add Apcore to your Flask app
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from flask import Flask
|
|
41
|
+
from flask_apcore import Apcore
|
|
42
|
+
|
|
43
|
+
app = Flask(__name__)
|
|
44
|
+
Apcore(app)
|
|
45
|
+
|
|
46
|
+
@app.route("/greet/<name>", methods=["GET"])
|
|
47
|
+
def greet(name: str) -> dict:
|
|
48
|
+
"""Greet a user by name."""
|
|
49
|
+
return {"message": f"Hello, {name}!"}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. Scan routes and start MCP server
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
export FLASK_APP=app.py
|
|
56
|
+
|
|
57
|
+
# Scan Flask routes -> register as apcore modules
|
|
58
|
+
flask apcore scan
|
|
59
|
+
|
|
60
|
+
# Start MCP server (stdio, for Claude Desktop / Cursor)
|
|
61
|
+
flask apcore serve
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That's it. Your Flask routes are now MCP tools.
|
|
65
|
+
|
|
66
|
+
### 3. Connect an MCP client
|
|
67
|
+
|
|
68
|
+
For **Claude Desktop**, add to your config:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"my-flask-app": {
|
|
74
|
+
"command": "flask",
|
|
75
|
+
"args": ["apcore", "serve"],
|
|
76
|
+
"env": { "FLASK_APP": "app.py" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For **HTTP transport** (remote access):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
flask apcore serve --http --host 0.0.0.0 --port 9100
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Integration Paths
|
|
89
|
+
|
|
90
|
+
flask-apcore supports three ways to define AI-perceivable modules:
|
|
91
|
+
|
|
92
|
+
### Route Scanning (zero-intrusion)
|
|
93
|
+
|
|
94
|
+
Scan existing Flask routes without modifying any code:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Direct registration (in-memory)
|
|
98
|
+
flask apcore scan
|
|
99
|
+
|
|
100
|
+
# Generate YAML binding files (persistent)
|
|
101
|
+
flask apcore scan --output yaml --dir ./apcore_modules
|
|
102
|
+
|
|
103
|
+
# Preview without side effects
|
|
104
|
+
flask apcore scan --dry-run
|
|
105
|
+
|
|
106
|
+
# Filter routes by regex
|
|
107
|
+
flask apcore scan --include "user.*" --exclude ".*delete"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `@module` Decorator (precise control)
|
|
111
|
+
|
|
112
|
+
Define standalone modules with full schema enforcement:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from flask_apcore import Apcore, module
|
|
116
|
+
from pydantic import BaseModel
|
|
117
|
+
|
|
118
|
+
class SummaryResult(BaseModel):
|
|
119
|
+
total: int
|
|
120
|
+
active: int
|
|
121
|
+
|
|
122
|
+
@module(id="user_stats.v1", tags=["analytics"])
|
|
123
|
+
def user_stats() -> SummaryResult:
|
|
124
|
+
"""Return user statistics."""
|
|
125
|
+
return SummaryResult(total=100, active=42)
|
|
126
|
+
|
|
127
|
+
app = Flask(__name__)
|
|
128
|
+
app.config["APCORE_MODULE_PACKAGES"] = ["myapp.modules"]
|
|
129
|
+
Apcore(app)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### YAML Binding (zero-code)
|
|
133
|
+
|
|
134
|
+
Define modules externally in `.binding.yaml` files:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
# apcore_modules/greet.binding.yaml
|
|
138
|
+
bindings:
|
|
139
|
+
- module_id: greet.get
|
|
140
|
+
target: app.greet
|
|
141
|
+
description: "Greet a user by name"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Set `APCORE_AUTO_DISCOVER=True` (default) to load bindings on startup.
|
|
145
|
+
|
|
146
|
+
## CLI Commands
|
|
147
|
+
|
|
148
|
+
### `flask apcore scan`
|
|
149
|
+
|
|
150
|
+
Scan Flask routes and generate apcore module definitions.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Options:
|
|
154
|
+
-s, --source [auto|native|smorest|restx] Scanner source (default: auto)
|
|
155
|
+
-o, --output [yaml] Output format; omit for direct registration
|
|
156
|
+
-d, --dir PATH Output directory (default: APCORE_MODULE_DIR)
|
|
157
|
+
--dry-run Preview without writing or registering
|
|
158
|
+
--include REGEX Only include matching module IDs
|
|
159
|
+
--exclude REGEX Exclude matching module IDs
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### `flask apcore serve`
|
|
163
|
+
|
|
164
|
+
Start an MCP server exposing registered modules as tools.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Options:
|
|
168
|
+
--stdio Use stdio transport (default)
|
|
169
|
+
--http Use streamable-http transport
|
|
170
|
+
--host TEXT HTTP host (default: 127.0.0.1)
|
|
171
|
+
-p, --port INT HTTP port (default: 9100)
|
|
172
|
+
--name TEXT MCP server name (default: apcore-mcp)
|
|
173
|
+
--validate-inputs Validate tool inputs against schemas
|
|
174
|
+
--log-level [DEBUG|INFO|WARNING|ERROR]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Configuration
|
|
178
|
+
|
|
179
|
+
All settings use the `APCORE_` prefix in `app.config`:
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
app.config.update(
|
|
183
|
+
# Core
|
|
184
|
+
APCORE_AUTO_DISCOVER=True, # Auto-load bindings and @module packages
|
|
185
|
+
APCORE_MODULE_DIR="apcore_modules/",# Directory for binding files
|
|
186
|
+
APCORE_MODULE_PACKAGES=[], # Python packages to scan for @module functions
|
|
187
|
+
APCORE_SCANNER_SOURCE="auto", # Scanner: auto, native, smorest, restx
|
|
188
|
+
|
|
189
|
+
# MCP Server
|
|
190
|
+
APCORE_SERVE_TRANSPORT="stdio", # Transport: stdio, streamable-http, sse
|
|
191
|
+
APCORE_SERVE_HOST="127.0.0.1", # HTTP host
|
|
192
|
+
APCORE_SERVE_PORT=9100, # HTTP port
|
|
193
|
+
APCORE_SERVER_NAME="apcore-mcp", # MCP server name
|
|
194
|
+
APCORE_SERVE_VALIDATE_INPUTS=False, # Validate inputs against schemas
|
|
195
|
+
|
|
196
|
+
# Observability
|
|
197
|
+
APCORE_TRACING_ENABLED=False, # Enable distributed tracing
|
|
198
|
+
APCORE_TRACING_EXPORTER="stdout", # Exporter: stdout, memory, otlp
|
|
199
|
+
APCORE_METRICS_ENABLED=False, # Enable metrics collection
|
|
200
|
+
APCORE_LOGGING_ENABLED=False, # Enable structured logging
|
|
201
|
+
APCORE_LOGGING_FORMAT="json", # Format: json, text
|
|
202
|
+
)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Observability
|
|
206
|
+
|
|
207
|
+
Enable tracing, metrics, and structured logging:
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
app.config.update(
|
|
211
|
+
APCORE_TRACING_ENABLED=True,
|
|
212
|
+
APCORE_TRACING_EXPORTER="otlp",
|
|
213
|
+
APCORE_TRACING_OTLP_ENDPOINT="http://localhost:4317",
|
|
214
|
+
APCORE_METRICS_ENABLED=True,
|
|
215
|
+
APCORE_LOGGING_ENABLED=True,
|
|
216
|
+
APCORE_LOGGING_FORMAT="json",
|
|
217
|
+
)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
These are wired into the apcore Executor as middleware, providing tracing spans, latency metrics, and structured log entries for every module execution.
|
|
221
|
+
|
|
222
|
+
## Docker Demo
|
|
223
|
+
|
|
224
|
+
A complete runnable demo is included in `examples/demo/`. It demonstrates the full pipeline: Flask CRUD routes with Pydantic schemas, route scanning, annotation inference, `@module` registration, MCP server, and observability.
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
cd examples/demo
|
|
228
|
+
docker compose up --build
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
After startup you'll see:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
=== Scanning Flask routes ===
|
|
235
|
+
[flask-apcore] Found 5 API routes.
|
|
236
|
+
[flask-apcore] Generated 5 module definitions.
|
|
237
|
+
|
|
238
|
+
=== Starting MCP server on port 9100 ===
|
|
239
|
+
[flask-apcore] Starting MCP server 'task-manager-mcp' via streamable-http...
|
|
240
|
+
[flask-apcore] 6 modules registered.
|
|
241
|
+
INFO: Uvicorn running on http://0.0.0.0:9100
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Verify:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
curl http://localhost:9100/health
|
|
248
|
+
# {"status":"ok","uptime_seconds":5.2,"module_count":6}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
See [examples/demo/README.md](examples/demo/README.md) for full details.
|
|
252
|
+
|
|
253
|
+
## Public API
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from flask_apcore import (
|
|
257
|
+
Apcore, # Flask Extension
|
|
258
|
+
module, # @module decorator
|
|
259
|
+
Registry, # Module registry
|
|
260
|
+
Executor, # Module executor with middleware pipeline
|
|
261
|
+
Context, # Request context
|
|
262
|
+
Identity, # User identity
|
|
263
|
+
ACL, # Access control list
|
|
264
|
+
Config, # Executor configuration
|
|
265
|
+
Middleware, # Middleware base class
|
|
266
|
+
ModuleAnnotations, # Behavioral hints (readonly, destructive, etc.)
|
|
267
|
+
ModuleDescriptor, # Module metadata
|
|
268
|
+
)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Development
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
git clone https://github.com/aipartnerup/flask-apcore.git
|
|
275
|
+
cd flask-apcore
|
|
276
|
+
pip install -e ".[dev,mcp]"
|
|
277
|
+
pytest
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
Apache-2.0
|