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.2.0.tar.gz (114.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.2.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fastapi_quanttide_project-0.2.0.tar.gz
Algorithm Hash digest
SHA256 358a0180da0cecaf044ad669464b8b92ad5bdf64a302df9cf468caaa275ae862
MD5 4eec5e627955cef49178e2c234846b09
BLAKE2b-256 503665d5efeda87d72bfc611485c7771ecffc90af366632d1e958e253d9ce1a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_quanttide_project-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7f4231e5c73cde579f5ba28e65694324c65bc138e25503ccc56c273d31b964e
MD5 d14dab6d7b1d95d10baf9852c3c93432
BLAKE2b-256 a8ca64356b4f78c83e082f78262bb2d9623d7900e3fdfd447cb9889877d3ed0e

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