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.0rc1.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.0rc1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fastapi_quanttide_project-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 d94173322dce91596679ee019017abd4c64b1547db0f7087c365b8a4457bf524
MD5 cda80b2a4ab437dab5dfe6db15646016
BLAKE2b-256 9b5499f675f222cadb41059921c20f63d0e9b33d9a89809a19b420778bae031a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_quanttide_project-0.1.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c5e7b100227fc22b3c44e717928380b0dd313e7b54054331c3bab169b51eb7c
MD5 ee3f544f3afa465a5e7ea9ffce477d0e
BLAKE2b-256 87654140d76a461565e30f5c710c74196e0a16cd975e7a1a5f761f11c338c430

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