├── CONTRIBUTING.rst
├── HISTORY.rst
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── docs
│ ├── Makefile
│ ├── authors.rst
│ ├── conf.py
│ ├── contributing.rst
│ ├── history.rst
│ ├── index.rst
│ ├── installation.rst
│ ├── make.bat
│ ├── readme.rst
│ └── usage.rst
├── requirements_dev.txt
├── sample
│ ├── __init__.py
│ ├── cli.py
│ └── sample.py
├── setup.cfg
├── setup.py
├── tests
│ ├── __init__.py
│ └── test_sample.py
└── tox.ini
3 directories, 26 files
这大概是当前比较流行的目录结构的主体框架,主要元素是:
$ tree sample
sample
├── Makefile
├── README.rst
├── docs
│ └── index.rst
├── requirements.txt
├── sample
│ ├── __init__.py
│ └── sample.py
├── setup.cfg
├── setup.py
└── tests
├── __init__.py
└── test_sample.py
项目 sample 目录中重复 sample 目录中放置 Python 源文件,tests目录中是测试文件,再加一个docs目录放文档,README.rst, 其他的用于构建的 setup, setup.cfg 和 Makefile 文件 。
这其实是一个很经典的 Python 项目结构,接下来的构建就用make命令了,输入make会看到定义在 Makefile 文件中的指令
$ make
clean remove all build, test, coverage and Python artifacts
clean-build remove build artifacts
clean-pyc remove Python file artifacts
clean-test remove test and coverage artifacts
lint check style
test run tests quickly with the default Python
test-all run tests on every Python version with tox
coverage check code coverage quickly with the default Python
docs generate Sphinx HTML documentation, including API docs
servedocs compile the docs watching for changes
release package and upload a release
dist builds source and wheel package
install install the package to the active Python's site-packages
为使用上面的构建过程,需要安装相应的包,如tox,wheel,coverage,sphinx,flake8, 它们都可以通过pip来安装 。之后就可以make test,make coverage,make docs,make dist等 。其中make docs可以生成一个很漂亮的 Web 文档 。
PyScaffold 创建一个项目PyScaffold 顾名思义,它是一个用来创建 Python 项目脚手架的工具,安装和使用:
$ pip install pyscaffold
$ putup sample
这样创建了一个 Python 项目,目录结构与前面 cookiecutter 所选的模板差不多,只不过它把源文件放在了src目录,而非sample目录 。
$ tree sample
sample
├── AUTHORS.rst
├── CHANGELOG.rst
├── CONTRIBUTING.rst
├── LICENSE.txt
├── README.rst
├── docs
│ ├── Makefile
│ ├── _static
│ ├── authors.rst
│ ├── changelog.rst
│ ├── conf.py
│ ├── contributing.rst
│ ├── index.rst
│ ├── license.rst
│ ├── readme.rst
│ └── requirements.txt
├── pyproject.toml
├── setup.cfg
├── setup.py
├── src
│ └── sample
│ ├── __init__.py
│ └── skeleton.py
├── tests
│ ├── conftest.py
│ └── test_skeleton.py
└── tox.ini
整个项目的构建就要用tox这个工具了 。tox是一个自动化测试和构建工具,它在构建过程中可创建 Python 虚拟环境,这让测试和构建能有一个干净的环境 。tox 使用教程
- 国内做财务机器人的公司有哪些?
- 在A股里,真正的人工智能龙头除了科大讯飞,还有哪几个?
- 在股票k线和分时图上有哪些特征表明股票洗盘快要结束?
- 国内有哪些优秀的AI电销机器人开发公司?
- 主力洗盘和出货K线形态有哪些?
- 波士顿公司的机器人因为其漂亮的后空翻成了网红,开发机器人的知名创业公司有哪些?
- 什么是洗盘和出货?两者有什么区别?
- 新鲜山楂吃了有什么好处
- 庄家洗盘的方法有哪些,如何判断股票洗盘结束的起爆点?
- 主力洗盘和出货太像,有哪些有效识别的办法?
