Enviar búsqueda
Cargar
01.python.开发最佳实践
•
Descargar como PPTX, PDF
•
3 recomendaciones
•
941 vistas
Na Lee
Seguir
Denunciar
Compartir
Denunciar
Compartir
1 de 21
Descargar ahora
Recomendados
台灣開源社區淺談 (Open Source and Free Software community in Taiwan)
台灣開源社區淺談 (Open Source and Free Software community in Taiwan)
Rex Tsai
OpenLab.Taipei #2 PORTA2030
OpenLab.Taipei #2 PORTA2030
Rex Tsai
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台
liuts
We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese Shop
Tzu-ping Chung
Python, Development Environment for Windows
Python, Development Environment for Windows
Kwangyoun Jung
Python Recipes for django girls seoul
Python Recipes for django girls seoul
Joeun Park
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论
Na Lee
NoSql Day - Chiusura
NoSql Day - Chiusura
WEBdeBS
Recomendados
台灣開源社區淺談 (Open Source and Free Software community in Taiwan)
台灣開源社區淺談 (Open Source and Free Software community in Taiwan)
Rex Tsai
OpenLab.Taipei #2 PORTA2030
OpenLab.Taipei #2 PORTA2030
Rex Tsai
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台
liuts
We Buy Cheese in a Cheese Shop
We Buy Cheese in a Cheese Shop
Tzu-ping Chung
Python, Development Environment for Windows
Python, Development Environment for Windows
Kwangyoun Jung
Python Recipes for django girls seoul
Python Recipes for django girls seoul
Joeun Park
2007 - 应用系统脆弱性概论
2007 - 应用系统脆弱性概论
Na Lee
NoSql Day - Chiusura
NoSql Day - Chiusura
WEBdeBS
Bottle - Python Web Microframework
Bottle - Python Web Microframework
Markus Zapke-Gründemann
Django mongodb -djangoday_
Django mongodb -djangoday_
WEBdeBS
Django e il Rap Elia Contini
Django e il Rap Elia Contini
WEBdeBS
Digesting jQuery
Digesting jQuery
Mindfire Solutions
User-centered open source
User-centered open source
Jacqueline Kazil
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
Jiho Lee
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
Mindfire Solutions
2 × 3 = 6
2 × 3 = 6
Tzu-ping Chung
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.py
Tzu-ping Chung
Html5 History-API
Html5 History-API
Mindfire Solutions
PyClab.__init__(self)
PyClab.__init__(self)
Tzu-ping Chung
EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
Markus Zapke-Gründemann
Load testing
Load testing
Mindfire Solutions
Super Advanced Python –act1
Super Advanced Python –act1
Ke Wei Louis
Vim for Mere Mortals
Vim for Mere Mortals
Clayton Parker
Django-Queryset
Django-Queryset
Mindfire Solutions
Website optimization
Website optimization
Mindfire Solutions
PythonBrasil[8] closing
PythonBrasil[8] closing
Tatiana Al-Chueyr
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contrib
Tzu-ping Chung
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
Python First Class
Python First Class
Yao Zuo
Python beginner tutorial
Python beginner tutorial
cri fan
Más contenido relacionado
Destacado
Bottle - Python Web Microframework
Bottle - Python Web Microframework
Markus Zapke-Gründemann
Django mongodb -djangoday_
Django mongodb -djangoday_
WEBdeBS
Django e il Rap Elia Contini
Django e il Rap Elia Contini
WEBdeBS
Digesting jQuery
Digesting jQuery
Mindfire Solutions
User-centered open source
User-centered open source
Jacqueline Kazil
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
Jiho Lee
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
Mindfire Solutions
2 × 3 = 6
2 × 3 = 6
Tzu-ping Chung
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.py
Tzu-ping Chung
Html5 History-API
Html5 History-API
Mindfire Solutions
PyClab.__init__(self)
PyClab.__init__(self)
Tzu-ping Chung
EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
Markus Zapke-Gründemann
Load testing
Load testing
Mindfire Solutions
Super Advanced Python –act1
Super Advanced Python –act1
Ke Wei Louis
Vim for Mere Mortals
Vim for Mere Mortals
Clayton Parker
Django-Queryset
Django-Queryset
Mindfire Solutions
Website optimization
Website optimization
Mindfire Solutions
PythonBrasil[8] closing
PythonBrasil[8] closing
Tatiana Al-Chueyr
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contrib
Tzu-ping Chung
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
Markus Zapke-Gründemann
Destacado
(20)
Bottle - Python Web Microframework
Bottle - Python Web Microframework
Django mongodb -djangoday_
Django mongodb -djangoday_
Django e il Rap Elia Contini
Django e il Rap Elia Contini
Digesting jQuery
Digesting jQuery
User-centered open source
User-centered open source
2016 py con2016_lightingtalk_php to python
2016 py con2016_lightingtalk_php to python
Authentication & Authorization in ASPdotNet MVC
Authentication & Authorization in ASPdotNet MVC
2 × 3 = 6
2 × 3 = 6
The Django Book Chapter 9 - Django Workshop - Taipei.py
The Django Book Chapter 9 - Django Workshop - Taipei.py
Html5 History-API
Html5 History-API
PyClab.__init__(self)
PyClab.__init__(self)
EuroDjangoCon 2009 - Ein Rückblick
EuroDjangoCon 2009 - Ein Rückblick
Load testing
Load testing
Super Advanced Python –act1
Super Advanced Python –act1
Vim for Mere Mortals
Vim for Mere Mortals
Django-Queryset
Django-Queryset
Website optimization
Website optimization
PythonBrasil[8] closing
PythonBrasil[8] closing
The Django Book, Chapter 16: django.contrib
The Django Book, Chapter 16: django.contrib
Django - The Web framework for perfectionists with deadlines
Django - The Web framework for perfectionists with deadlines
Similar a 01.python.开发最佳实践
Python First Class
Python First Class
Yao Zuo
Python beginner tutorial
Python beginner tutorial
cri fan
用简单语言构建复杂系统
用简单语言构建复杂系统
Leo Zhou
Ready Programmer One
Ready Programmer One
flywindy
2 Python开发工具链
2 Python开发工具链
March Liu
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
Andy Dai
Summary conversatio-python-group-dalian
Summary conversatio-python-group-dalian
wangyuanyi
构建网络工具箱
构建网络工具箱
Lv Jian
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Wey-Han Liaw
如何,高效利用搜索引擎+构建网络工具箱
如何,高效利用搜索引擎+构建网络工具箱
84zhu
Django step0
Django step0
永昇 陳
Python 于 webgame 的应用
Python 于 webgame 的应用
勇浩 赖
HPX台南讀書會-Axure RP基礎課程
HPX台南讀書會-Axure RP基礎課程
Souyi Yang
瀏覽器開發與開源經驗 SITCON 2018
瀏覽器開發與開源經驗 SITCON 2018
安齊 劉
1 Python简介
1 Python简介
March Liu
开源社区生生不息的创新土壤
开源社区生生不息的创新土壤
Steven Cheng
Python 起步走
Python 起步走
Justin Lin
Learn Django With ChatGPT
Learn Django With ChatGPT
Ko Ko
Python 起步走
Python 起步走
Justin Lin
Python summary
Python summary
cri fan
Similar a 01.python.开发最佳实践
(20)
Python First Class
Python First Class
Python beginner tutorial
Python beginner tutorial
用简单语言构建复杂系统
用简单语言构建复杂系统
Ready Programmer One
Ready Programmer One
2 Python开发工具链
2 Python开发工具链
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
Summary conversatio-python-group-dalian
Summary conversatio-python-group-dalian
构建网络工具箱
构建网络工具箱
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
如何,高效利用搜索引擎+构建网络工具箱
如何,高效利用搜索引擎+构建网络工具箱
Django step0
Django step0
Python 于 webgame 的应用
Python 于 webgame 的应用
HPX台南讀書會-Axure RP基礎課程
HPX台南讀書會-Axure RP基礎課程
瀏覽器開發與開源經驗 SITCON 2018
瀏覽器開發與開源經驗 SITCON 2018
1 Python简介
1 Python简介
开源社区生生不息的创新土壤
开源社区生生不息的创新土壤
Python 起步走
Python 起步走
Learn Django With ChatGPT
Learn Django With ChatGPT
Python 起步走
Python 起步走
Python summary
Python summary
Más de Na Lee
Aruba-MESH-解决方案.pdf
Aruba-MESH-解决方案.pdf
Na Lee
火山引擎-飞连产品介绍.pdf
火山引擎-飞连产品介绍.pdf
Na Lee
2007 年互联网基础设施安全的想法
2007 年互联网基础设施安全的想法
Na Lee
02.python.开发最佳实践
02.python.开发最佳实践
Na Lee
手机网络游戏平台
手机网络游戏平台
Na Lee
淘宝连锁店
淘宝连锁店
Na Lee
Más de Na Lee
(6)
Aruba-MESH-解决方案.pdf
Aruba-MESH-解决方案.pdf
火山引擎-飞连产品介绍.pdf
火山引擎-飞连产品介绍.pdf
2007 年互联网基础设施安全的想法
2007 年互联网基础设施安全的想法
02.python.开发最佳实践
02.python.开发最佳实践
手机网络游戏平台
手机网络游戏平台
淘宝连锁店
淘宝连锁店
01.python.开发最佳实践
1.
© 2008 绿盟科技www.nsfocus.comnsfocus.com
© 2008 绿盟科技www.nsfocus.comnsfocus.com Python 开发最佳实践 密级:内部使用 —— Python 开发环境包管理
2.
好的开发环境意味着什么?
3.
4.
• Python 社区是一个变化非常快的社区 –
知识和工具都需要及时更新,跟进社区的变化 • Python 开发的最佳实践(推荐阅读) – The Hitchhiker’s Guide to Python! • 英文版:http://docs.python-guide.org/en/latest/ • Python 自身的包管理工具(推荐阅读) – Python 套件管理程序简介 • http://t.cn/zYdfQqV – Python 的虚拟环境及多版本开发 • http://t.cn/zjOzu0y – Hitchhiker’s Guide: • Linux:http://t.cn/zYdfQqI • Windows:http://t.cn/zYdfQqf
5.
Python 的第三方包管理 pip +
virtualenv + virtualenvwrapper 基本操作
6.
• 知乎上的一个帖子 ……
神器?!
7.
• 主要工具(Python 包管理三大利器) –
pip • Python 的包管理工具,原有 easy_install 不再维护 • http://www.pip-installer.org/en/latest/ – virtualenv • Python 的环境管理工具,隔离 Python 不同环境的影响 • http://www.virtualenv.org/en/latest/ – virtualenvwrapper • virutalenv 的增强工具包,实现了很多很方便的工具 • http://virtualenvwrapper.readthedocs.org/en/latest/
8.
pip + distribute 替代了 setuptools
+ easy_install
9.
导出当前的第三方库 以 top 为例子
10.
• 导出当前的第三方库清单 – pip
freeze > top.txt • 导出当前的第三方库安装包(包括依赖库) – source /usr/local/bin/virtualenvwrapper.sh (启用 virtualenvwrapper,非必须,可以写在 .bashrc 中) – mkvirtualenv top.export (创建一个干净的环境用于导出文件) – mkdir export.packages (准备一个导出文件用的目录) – pip install -r top.txt -d export.packages (下载所有第三方库)
11.
从头创建一个开发环境 以 top 为例子
12.
• 启用 virtualenvwrapper (非必须,可以写在
.bashrc 中) – source /usr/local/bin/virtualenvwrapper.sh • 从 svn 获取最新代码 (非必须) – svn co https://svn.lab.intra.nsfocus.com/svn/top/trunk • 创建一个 virutalenv 环境 – mkvirutalenv top.brandnew • 从生产环境的 pip 文件中恢复 – pip install -r top.txt (top.txt 是从生产环境中导出的 python 包列表) – pip freeze (查看当前安装的 python 库)
13.
复制/销毁一个现有的开发环境 以 top 为例子
14.
• 复制现有的 virtualenv –
cpvirtualenv top.brandnew top.sandbox (把 top.brandnew 这个环境复制到 top.sandbox) – pip freeze • 销毁现有的 virutalenv – rmvirtualenv top.sandbox
15.
回头看看我们的第三方库管理
16.
要实现 一个功能 搜寻 开源库 验证 是否可用 选定 引入代码库 开发 测试 上线 第三方库引入的示意图
17.
• 初始化环境(运维人员) – 标准的开发虚拟机模板(解决了系统库依赖) •
apt-get install …. • svn co …/git clone … • puppet … – 创建生产环境的 virutalenv 作为标准环境(top.prodction) • mkvirutalenv top.production • mkdir top.production • 把 top.production.txt 放到 top.production/top.production.txt – 当前生产环境的第三方库(top.production.txt) • workon top.production • pip install -r top.production/top.production.txt – 把上面的内容作为标准的初始化环境发布给开发人员和测试人员 要实现 一个功能 搜寻 开源库 验证 是否可用 选定 引入代码库 开发 测试 上线 0
18.
• 沙盒环境中做实验(研发工程师) – 从标准
virutalenv 创建沙盒环境用于实验 • cpvirtualenv top.production top.sandbox – 在沙盒环境中做实验 • workon top.sandbox • pip install … – 删除并重建复沙盒(每次实验都不会受上一次实验影响) • rmvirutalenv top.sandbox • cpvirtualenv top.production top.sandbox – 确定选择后,输出第三方库(清单和文件) • pip freeze > top.sandbox.txt • mkdir top.sandbox.packages • pip install -r top.sandbox.txt -d top.sandbox.packages – 把上面的内容作为标准的初始化环境发布给开发人员和测试人员 • 把 top.sandbox.txt 重命名为 top.release.txt 并作为代码一部分提交到代码库 • 把目录中 top.sandbox.packages 文件上传到指定服务器 要实现 一个功能 搜寻 开源库 验证 是否可用 选定 引入代码库 开发 测试 上线 0 1
19.
• 在测试环境中做测试(测试工程师) – 创建干净的沙盒 •
mkvirtualenv top.testing – 获取要测试的代码 • workon top.testing • svn co … • pip install -r top.release.txt • 测试 要实现 一个功能 搜寻 开源库 验证 是否可用 选定 引入代码库 开发 测试 上线 0 1 2
20.
• 在生产环境中部署(运维工程师) – 创建干净的沙盒 •
mkvirtualenv top.production – 安装新代码 • workon top.production • svn co … • pip install -r top.release.txt – 更新 production 环境 • 实际生产环境运行无问题 • 把 top.release.txt 重命名为 top.production.txt 提交 要实现 一个功能 搜寻 开源库 验证 是否可用 选定 引入代码库 开发 测试 上线 0 1 2 3
21.
谢谢!
Descargar ahora