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 right way
Search
Kiran
October 26, 2013
Technology
0
390
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
The Road to a Masterless Multi-node Distributed System in Elixir
kirang89
5
620
Building a Tic Tac Toe AI in Python
kirang89
0
350
A Gentle Introduction to Generators and Coroutines
kirang89
1
210
Leverage PyCon India to help grow the Python community
kirang89
0
66
Lets learn Python !
kirang89
0
85
Python Month
kirang89
0
42
Why learn Python ?
kirang89
0
110
Other Decks in Technology
See All in Technology
[2024年3月版] Databricksのシステムアーキテクチャ
databricksjapan
7
1.9k
「共通基盤」を超えよ! 今、Platform Engineeringに取り組むべき理由
jacopen
25
5.7k
o11y入門_外形監視を利用したWebアプリケーションへの最適なモニタリング_TechBrew
k5k
2
100
LLM とプロンプトエンジニアリング/チューターをビルドする / LLM and Prompt Engineering and Building Tutors
ks91
PRO
0
210
アプリがつくるNOT A HOTELブランド
hokuts
0
450
SPI原点回帰論:事業課題とFour Keysの結節点を見出す実践的ソフトウェアプロセス改善 / DevOpsDays Tokyo 2024
visional_engineering_and_design
4
1.3k
AIQ株式会社 エンジニア向け会社紹介資料
aiqlab
0
360
次世代Web認証「パスキー」 / mo-zatsudan-passkey
nkzn
22
13k
プロトタイピングによる不確実性の低減 / Reducing Uncertainty through Prototyping
ohbarye
3
130
Postman v10リリース後を振り返る
nagix
0
110
"好き"との生活/Regularly update profile with GitHub Actions
judeeeee
0
140
株式会社EventHub・エンジニア採用資料
eventhub
0
1.9k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
318
37k
The Cult of Friendly URLs
andyhume
73
5.7k
Producing Creativity
orderedlist
PRO
336
39k
Done Done
chrislema
178
15k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
39
4.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.8k
The Language of Interfaces
destraynor
151
23k
Pencils Down: Stop Designing & Start Developing
hursman
116
11k
Clear Off the Table
cherdarchuk
82
310k
The Brand Is Dead. Long Live the Brand.
mthomps
48
28k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Making Projects Easy
brettharned
107
5.5k
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