一.项目模板生成工具
- 所有Python开发项目统一放到指定目录 比如(我的都放在这个目录 /Users/chengxinyao/DataWarehouse/PythonProjects 使用该工具时候 json_file里targer_parent_dir参数保持一致)
- 每个项目最好用统一的模板生成,防止各个项目都是不同的风格,维护起来心累
- 通过该工具可快速启动新项目 通过配置文件生成项目开发文档README.md等
二.目录结构实例,可通过配置文件定义,比如创建的logstreaming项目
├── README.md 项目文档
├── bin shell脚本
├── conf 项目配置文件
├── docs 项目里一些doc文件
├── examples 样例
├── log 日志目录
├── logstreaming
│ ├── __init__.py
│ ├── 模块A
│ │ └── __init__.py
│ ├── 模块B
│ │ └── __init__.py
│ └── 模块C
│ └── __init__.py
├── main.py 入口main函数
├── requiirements.txt 依赖包
└── test 测试脚本
三.git clone 使用
git clone git@github.com:chengcxy/mk_pyproject.git
cp mk_pyproject/templates/* 你的模板路径(使用该工具时候 json_file里template_path参数保持一致)
执行下面命令 可创建一个Bpoint项目的json_file
python3 gen_json_file.py Bpoint
下面是输出信息:
/Users/chengxinyao/DataWarehouse/PythonProjects/Bpoint 项目创建成功~
查看配置文件 cat /Users/chengxinyao/DataWarehouse/PythonProjects/global_config/Bpoint.json
四.配置文件参数
|参数|参数注释
|---|---
|project_name|项目名称
|template_path|模板全路径
|targer_parent_dir|所有python项目的父目录
|public_folders|项目的公共目录列表 配置文件里自自定即可 会自动再项目目录里创建
|public_files|模板全路径下的公共文件 README.md/requirements.txt/启动脚本main.py等 会自动再项目目录里创建
|project_modules|项目的模块列表 可自定义
|project_desc|项目描述 填写后会自动渲染到README.md
|python_version|python版本信息 填写后会自动渲染到README.md
|其他参数|python版本信息 填写后会自动渲染到README.md >三.其他信息下
六.将该工具安装为命令行工具 以后可通过复制配置文件 创建项目
(1)源码安装:
git clone git@github.com:chengcxy/mk_pyproject.git
cd 目录/mk_pyproject/bin
sh build.sh
此时 已将mk_pyproject模块添加到python 系统模块包路径下
(2)pip install mk-pyproject==0.0.1
将第三步生成的Bpoint.json 通过命令行工具生成
mk_pyproject --json_file ~/DataWarehouse/PythonProjects/global_config/Bpoint.json
七.注意事项
如果已经创建过项目 进入开发流程 请勿重复执行创建项目命令 会覆盖
Metadata
Release files for mk-pyproject 0.0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mk_pyproject-0.0.1.3.tar.gz | 5.9 kB | Without provenance | Details for mk_pyproject-0.0.1.3.tar.gz |
Release files / mk_pyproject-0.0.1.3.tar.gz
| Download URL | mk_pyproject-0.0.1.3.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
889ac5ed25e8899ac23c06194f80e86b6a90572dcd3f2b62419182925e6dee57
|
|
BLAKE2b-256 checksum How to use checksums |
b00601be2361325416b871b1c03b1d1c050a10c4ef9d369567281b832b0f65e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.3
|
Security for mk-pyproject 0.0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.