服务初始化模板命令行脚手架
设计要点
命令行设计
-
project
- create
- -f --framework django/fastapi/flask/gin
- -p --path project path, default current path
- project name
- create
-
other
项目模板目录设计
- templates
- python
- fastapi
- django
- flask
- go
- gin
- dapr_grpc
- python
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
步骤:
- 切换到打包根目录
- 执行build命令
- 检查是否成功构建至dist目录
测试pip包
pip install -e .
步骤:
- 安装本地构建的软件包
- 安装后,检查当前环境是否可以检测到
dapr-microservice-cli命令 - 执行
dapr-microservice-cli进行项目创建测试
发布pip包
twine upload dist/*
参考
Metadata
Release files for dapr-microservice-cli 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dapr-microservice-cli-0.0.2.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dapr_microservice_cli-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.4 kB
Release files / dapr-microservice-cli-0.0.2.tar.gz
| Download URL | dapr-microservice-cli-0.0.2.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e65c158b8244540016e3dd373caa71d5f39a60bfd05a17c37946f29c8af8992
|
|
BLAKE2b-256 checksum How to use checksums |
4deba6775747020b752a8eb4f35969bacdc85ae40a3532665c89e3c74bcce415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / dapr_microservice_cli-0.0.2-py3-none-any.whl
| Download URL | dapr_microservice_cli-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba1576d94b1e50320561d68f40c424b71396de58173c8d1ca4fc03951d4d6700
|
|
BLAKE2b-256 checksum How to use checksums |
06e9e0a215d084597711981ff9d623a5ce9175fee0df7cf1414342d8f4b75806
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|