Skip to main content

dapr microservice cli

Project description

服务初始化模板命令行脚手架

设计要点

命令行设计

  • project

    • create
      • -f --framework django/fastapi/flask/gin
      • -p --path project path, default current path
      • project name
  • other

项目模板目录设计

  • templates
    • python
      • fastapi
      • django
      • flask
    • go
      • gin
      • dapr_grpc

Python FastAPI 项目模板

  • config 配置文件目录
    • dev.yaml 开发配置
    • prod.yaml 生产配置
  • doc 文档目录,包括:http请求文档
  • service 服务代码目录
    • main.py 服务app模块文件
    • deps.py 共享依赖模块文件
    • models.py 模型模块文件,可以将其升级为models目录,拆分代码为多个文件
    • routers.py 路由模块文件,可以将其升级为routers目录,拆分代码为多个文件
    • schemas.py 校检模块文件,同上
    • middlewares.py 中间件模块,同上
  • tests 服务测试代码目录
  • .gitignore git忽略文件设置文件
  • Dockerfile dockerfile文件
  • Makefile make运行命令
  • README.md 说明文档
  • requirements.txt python依赖包生成文件

pip包发布

发布环境

pip install build pip setuptools wheel twine

构建pip包

python3 -m build

步骤:

  1. 切换到打包根目录
  2. 执行build命令
  3. 检查是否成功构建至dist目录

测试pip包

pip install dist/*.whl

步骤:

  1. 安装本地构建的软件包
  2. 安装后,检查当前环境是否可以检测到dapr-microservice-cli命令
  3. 执行dapr-microservice-cli进行项目创建测试

发布pip包

twine upload dist/*

参考

FastAPI 如何组织大型项目结构

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

dapr-microservice-cli-0.0.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

dapr_microservice_cli-0.0.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file dapr-microservice-cli-0.0.1.tar.gz.

File metadata

  • Download URL: dapr-microservice-cli-0.0.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for dapr-microservice-cli-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d24a1a3a1efa804c5d0b2d542a6c6964cf2d39dd5fbfcbf1a5179a9378179eec
MD5 7007ad0f63a585c3c56bb3b819bf5828
BLAKE2b-256 c68f2f1bc6f703ac95eef729aca6b4a2393063a2a1b1b40d1007d6daabb95e88

See more details on using hashes here.

File details

Details for the file dapr_microservice_cli-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dapr_microservice_cli-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for dapr_microservice_cli-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d909e1a553684e88a6d7a14b618a1733f069a3568eecc8a2583cece92c21df2
MD5 e0de77e600ef7583bbc300735db485d8
BLAKE2b-256 02aeaab19ad7ca1809fc96ca905e1583fd0bf7eb90810b73bb8eaa5f96c65bf0

See more details on using hashes here.

Supported by

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