前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python工程的文档结构

Python工程的文档结构

作者头像
SeanCheney
发布2018-08-16 14:40:43
8190
发布2018-08-16 14:40:43
举报
文章被收录于专栏:SeanCheney的专栏SeanCheney的专栏

Python工程的文档结构,可以参考https://stackoverflow.com/questions/193161/what-is-the-best-project-structure-for-a-python-application

有个答主提到了《Filesystem structure of a Python project》(http://as.ynchrono.us/2007/12/filesystem-structure-of-python-project_21.html),确实写的不错。这篇文章推荐的结构:

代码语言:javascript
复制
Project/
|-- bin/
|   |-- project
|
|-- project/
|   |-- test/
|   |   |-- __init__.py
|   |   |-- test_main.py
|   |   
|   |-- __init__.py
|   |-- main.py
|
|-- setup.py
|-- README

开源工程对文档结构肯定更高些,可以参考:https://jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/。作者Jeff Knupp还写过一本介绍Pythonic Code的小书,值得一看!(下载此书:https://github.com/iamseancheney/pythonbooks/blob/master/PythonStyle-Writing_idiomatic_python_3.pdf

其实更好的方法,可能是直接去GitHub上参考高赞项目的结构,比如PySpider(https://github.com/binux/pyspider)的文档结构:

代码语言:javascript
复制
PySpider
.
├── Dockerfile
├── LICENSE
├── MANIFEST.in
├── README.md
├── data
├── docs
│   ├── About-Projects.md
│   ├── About-Tasks.md
│   ├── Architecture.md
│   ├── Command-Line.md
│   ├── Deployment-demo.pyspider.org.md
│   ├── Deployment.md
│   ├── Frequently-Asked-Questions.md
│   ├── Quickstart.md
│   ├── Running-pyspider-with-Docker.md
│   ├── Script-Environment.md
│   ├── Working-with-Results.md
│   ├── apis
│   │   ├── @catch_status_code_error.md
│   │   ├── @every.md
│   │   ├── Response.md
│   │   ├── index.md
│   │   ├── self.crawl.md
│   │   └── self.send_message.md
│   ├── conf.py
│   ├── imgs
│   │   ├── creating_a_project.png
│   │   ├── css_selector_helper.png
│   │   ├── demo.png
│   │   ├── developer-tools-network-filter.png
│   │   ├── developer-tools-network.png
│   │   ├── index_page.png
│   │   ├── inspect_element.png
│   │   ├── pyspider-arch.png
│   │   ├── request-headers.png
│   │   ├── run_one_step.png
│   │   ├── search-for-request.png
│   │   ├── tutorial_imdb_front.png
│   │   └── twitch.png
│   ├── index.md
│   └── tutorial
│       ├── AJAX-and-more-HTTP.md
│       ├── HTML-and-CSS-Selector.md
│       ├── Render-with-PhantomJS.md
│       └── index.md
├── mkdocs.yml
├── pyspider
│   ├── __init__.py
│   ├── database
│   │   ├── __init__.py
│   │   ├── base
│   │   │   ├── __init__.py
│   │   │   ├── projectdb.py
│   │   │   ├── resultdb.py
│   │   │   └── taskdb.py
│   │   ├── basedb.py
│   │   ├── elasticsearch
│   │   │   ├── __init__.py
│   │   │   ├── projectdb.py
│   │   │   ├── resultdb.py
│   │   │   └── taskdb.py
│   │   ├── local
│   │   │   ├── __init__.py
│   │   │   └── projectdb.py
│   │   ├── mongodb
│   │   │   ├── __init__.py
│   │   │   ├── mongodbbase.py
│   │   │   ├── projectdb.py
│   │   │   ├── resultdb.py
│   │   │   └── taskdb.py
│   │   ├── mysql
│   │   │   ├── __init__.py
│   │   │   ├── mysqlbase.py
│   │   │   ├── projectdb.py
│   │   │   ├── resultdb.py
│   │   │   └── taskdb.py
│   │   ├── redis
│   │   │   ├── __init__.py
│   │   │   └── taskdb.py
│   │   ├── sqlalchemy
│   │   │   ├── __init__.py
│   │   │   ├── projectdb.py
│   │   │   ├── resultdb.py
│   │   │   ├── sqlalchemybase.py
│   │   │   └── taskdb.py
│   │   └── sqlite
│   │       ├── __init__.py
│   │       ├── projectdb.py
│   │       ├── resultdb.py
│   │       ├── sqlitebase.py
│   │       └── taskdb.py
│   ├── fetcher
│   │   ├── __init__.py
│   │   ├── cookie_utils.py
│   │   ├── phantomjs_fetcher.js
│   │   ├── splash_fetcher.lua
│   │   └── tornado_fetcher.py
│   ├── libs
│   │   ├── ListIO.py
│   │   ├── __init__.py
│   │   ├── base_handler.py
│   │   ├── bench.py
│   │   ├── counter.py
│   │   ├── dataurl.py
│   │   ├── log.py
│   │   ├── multiprocessing_queue.py
│   │   ├── pprint.py
│   │   ├── response.py
│   │   ├── result_dump.py
│   │   ├── sample_handler.py
│   │   ├── url.py
│   │   ├── utils.py
│   │   └── wsgi_xmlrpc.py
│   ├── logging.conf
│   ├── message_queue
│   │   ├── __init__.py
│   │   ├── beanstalk.py
│   │   ├── kombu_queue.py
│   │   ├── rabbitmq.py
│   │   └── redis_queue.py
│   ├── processor
│   │   ├── __init__.py
│   │   ├── processor.py
│   │   └── project_module.py
│   ├── result
│   │   ├── __init__.py
│   │   └── result_worker.py
│   ├── run.py
│   ├── scheduler
│   │   ├── __init__.py
│   │   ├── scheduler.py
│   │   ├── task_queue.py
│   │   └── token_bucket.py
│   └── webui
│       ├── __init__.py
│       ├── app.py
│       ├── bench_test.py
│       ├── debug.py
│       ├── index.py
│       ├── login.py
│       ├── result.py
│       ├── static
│       │   ├── css_selector_helper.min.js
│       │   ├── debug.min.css
│       │   ├── debug.min.js
│       │   ├── index.min.css
│       │   ├── index.min.js
│       │   ├── package.json
│       │   ├── result.min.css
│       │   ├── result.min.js
│       │   ├── src
│       │   │   ├── css_selector_helper.js
│       │   │   ├── debug.js
│       │   │   ├── debug.less
│       │   │   ├── index.js
│       │   │   ├── index.less
│       │   │   ├── result.less
│       │   │   ├── splitter.js
│       │   │   ├── task.less
│       │   │   ├── tasks.less
│       │   │   └── variable.less
│       │   ├── task.min.css
│       │   ├── task.min.js
│       │   ├── tasks.min.css
│       │   ├── tasks.min.js
│       │   └── webpack.config.js
│       ├── task.py
│       ├── templates
│       │   ├── debug.html
│       │   ├── index.html
│       │   ├── result.html
│       │   ├── task.html
│       │   └── tasks.html
│       └── webdav.py
├── requirements.txt
├── run.py
├── setup.py
├── tests
│   ├── __init__.py
│   ├── data_fetcher_processor_handler.py
│   ├── data_handler.py
│   ├── data_sample_handler.py
│   ├── data_test_webpage.py
│   ├── test_base_handler.py
│   ├── test_bench.py
│   ├── test_counter.py
│   ├── test_database.py
│   ├── test_fetcher.py
│   ├── test_fetcher_processor.py
│   ├── test_message_queue.py
│   ├── test_processor.py
│   ├── test_response.py
│   ├── test_result_dump.py
│   ├── test_result_worker.py
│   ├── test_run.py
│   ├── test_scheduler.py
│   ├── test_task_queue.py
│   ├── test_utils.py
│   ├── test_webdav.py
│   ├── test_webui.py
│   └── test_xmlrpc.py
├── tools
│   └── migrate.py
└── tox.ini

27 directories, 177 files
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.07.31 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档