feat(cloud-api): add workspace application entrypoint
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
from cloud_api.app import create_app
|
||||
|
||||
__all__ = ["create_app"]
|
||||
@@ -0,0 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
"""Create the independently deployable cloud API application."""
|
||||
return FastAPI(title="Device Cloud API")
|
||||
@@ -0,0 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from collections.abc import Sequence
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> None:
|
||||
parser = argparse.ArgumentParser(description="Run the Device Cloud API")
|
||||
parser.add_argument("--host", default="127.0.0.1")
|
||||
parser.add_argument("--port", default=8001, type=int)
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(
|
||||
"cloud_api.app:create_app",
|
||||
factory=True,
|
||||
host=args.host,
|
||||
port=args.port,
|
||||
)
|
||||
@@ -0,0 +1,24 @@
|
||||
[project]
|
||||
name = "device-cloud-api"
|
||||
version = "0.1.0"
|
||||
description = "Deployable Cloud Control Plane API for Device Agent Runtime."
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"device-cloud-platform==0.1.0",
|
||||
"fastapi>=0.115.0",
|
||||
"uvicorn[standard]>=0.30.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
device-cloud-api = "cloud_api.cli:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=69"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["cloud_api*"]
|
||||
|
||||
[tool.uv.sources]
|
||||
device-cloud-platform = { workspace = true }
|
||||
@@ -0,0 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from cloud_api.app import create_app
|
||||
|
||||
|
||||
def test_create_app_returns_independent_cloud_application() -> None:
|
||||
app = create_app()
|
||||
|
||||
assert app.title == "Device Cloud API"
|
||||
assert callable(create_app)
|
||||
Reference in New Issue
Block a user