Skip to main content

量潮项目管理FastAPI工具箱

Project description

fastapi-quanttide-project

量潮项目管理 FastAPI 工具箱。

用法

from fastapi import FastAPI
from quanttide_project import Project, Task
from fastapi_quanttide_project import ModelRouter

app = FastAPI()

# 存储由用户自己管理,你可以用 dict、SQLite、Redis……
projects: dict[str, Project] = {}
tasks: dict[str, Task] = {}

app.include_router(ModelRouter(Project).build(
    create=lambda _id, p: projects.setdefault(_id, p) or p,
    get=projects.get,
    list_all=lambda: list(projects.values()),
    update=lambda _id, p: projects.update({_id: p}) or p,
    delete=lambda _id: projects.pop(_id, None) is not None,
))

app.include_router(ModelRouter(Task).build(
    create=lambda _id, t: tasks.setdefault(_id, t) or t,
    get=tasks.get,
    list_all=lambda: list(tasks.values()),
    update=lambda _id, t: tasks.update({_id: t}) or t,
    delete=lambda _id: tasks.pop(_id, None) is not None,
))

安装

pip install fastapi-quanttide-project

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_quanttide_project-0.1.0.tar.gz (113.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_quanttide_project-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_quanttide_project-0.1.0.tar.gz.

File metadata

File hashes

Hashes for fastapi_quanttide_project-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2fa9c0eafb7e2778519965753dc0ec94205fe78a14b36ec23e461236d933124a
MD5 f2f18efa645959796e44508ef87929f9
BLAKE2b-256 4ca952927f2f756c9e2824d220f54b68b53644b553c1ac2f56b3a20b1f20a60f

See more details on using hashes here.

File details

Details for the file fastapi_quanttide_project-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_quanttide_project-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc9137843408ba9cf23099139eab94475a44bf34a7069431a602098470731285
MD5 54171a982eb14ae36f814bade2fd07a4
BLAKE2b-256 7db5c890c959b03c6e2b40082b2dc504816f45181ca0b665f415c14a41a38690

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page