Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Building an open source Python application, the...
Search
Kiran
October 26, 2013
Technology
0
400
Building an open source Python application, the right way
Overview of conventions/best practices to follow when writing an open source Python application
Kiran
October 26, 2013
Tweet
Share
More Decks by Kiran
See All by Kiran
Building Terrariums
kirang89
0
21
The Road to a Masterless Multi-node Distributed System in Elixir
kirang89
5
660
Building a Tic Tac Toe AI in Python
kirang89
0
370
A Gentle Introduction to Generators and Coroutines
kirang89
1
220
Leverage PyCon India to help grow the Python community
kirang89
0
71
Lets learn Python !
kirang89
0
88
Python Month
kirang89
0
50
Why learn Python ?
kirang89
0
110
Other Decks in Technology
See All in Technology
0→1事業こそPMは営業すべし / pmconf #落選お披露目 / PM should do sales in zero to one
roki_n_
PRO
1
1.5k
【NGK2025S】動物園(PINTO_model_zoo)に遊びに行こう
kazuhitotakahashi
0
240
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
240
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
540
JAWS-UG20250116_iOSアプリエンジニアがAWSreInventに行ってきた(真面目編)
totokit4
0
140
Goで実践するBFP
hiroyaterui
1
120
メンバーがオーナーシップを発揮しやすいチームづくり
ham0215
2
140
商品レコメンドでのexplicit negative feedbackの活用
alpicola
2
370
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.4k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
54k
20250116_自部署内でAmazon Nova体験会をやってみた話
riz3f7
1
100
Featured
See All Featured
BBQ
matthewcrist
85
9.4k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Why Our Code Smells
bkeepers
PRO
335
57k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Code Review Best Practice
trishagee
65
17k
Scaling GitHub
holman
459
140k
Docker and Python
trallard
43
3.2k
Making the Leap to Tech Lead
cromwellryan
133
9k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
The Language of Interfaces
destraynor
155
24k
Transcript
Building open source the Python application right way an
Hi.
I’m Kiran. Hacker Programmer Open Source enthusiast Computer Science fanboy
Currently, having an affair with Python
Why follow Conventions Guidelines Best Practices
Your code is Open Source !
What does that mean You ask ?
Code available to People will try to help start using
it everyone People will(might)
So, what do I do ?
Make it easier for people to use your application
How ?
Let’s start with basic project structure
None
Let’s make it simpler
Documentation Tests Application Dependency Management Setup Task Execution Extras Publish
Application
Write good code. http://www.python.org/dev/peps/pep-0008/
Don’t bloat your code with Use them when required classes
to architect your application modules Use
Tests
“Code not tested is broken by design” - Jacob Kaplan
Moss
Lots of ways to your application Test
Start with simple unit tests
unittest Nose py.test Most commonly used
Documentation
For small projects Code is the documentation http://www.python.org/dev/peps/pep-0257/
Sadly This is not scalable
Use Sphinx http://sphinx-doc.org/
HTML EPUB PDF Man Pages LaTex Automatic Syntax Highlighting Plain
Text Theming Support Internationalisation
None
Dependency Management
Project Dependencies requirements.txt
pip install -r requirements.txt then
None
Setup
Pro Tip: Use Virtualenv to setup your environment
Why ? Test with different Python versions No unnecessary namespace
pollution Different environments and settings per project Install dependencies inside environment
Publish
setup.py contains the necessary information required for it’s installation Every
project’s
Packages and uploads your application to Python Package Index a.k.a
PyPI
setup( name='project name', version=myapp.__version__, description='project description here', license=open("LICENSE").read(), author='author', author_email='email',
url='project url', packages=['myapp'], include_package_data=True, classifiers=( 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Natural Language :: English', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.3', ), test_suite='tests', )
Register at PyPI python setup.py register Package and Upload application
python setup.py sdist upload
Install application on any platform pip install myapp
None
Task Execution
Makefile Use a to automate multiple tasks and commands http://mrbook.org/tutorials/make/
Extras (a.k.a enhancements)
AUTHORS CHANGELOG CONTRIBUTING
is License very important for open source projects http://www.tldrlegal.com/
Recap
RECAP Documentation Tests Application Dependency Management Setup Task Execution Extras
Publish
Questions ?
Thank you ! @kirang89 http://kirang.in