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
630
Building a Tic Tac Toe AI in Python
kirang89
0
360
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
Google Cloud Next '24 Recap(Cloud Run/k8s)
mokocm
0
330
Grafana x PagerDuty Better Together
jacopen
1
250
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
2.1k
On Your Data を超えていく!
hirotomotaguchi
2
750
一生覚えておきたい「システム開発=コミュニケーション」〜初めての実務案件振り返りLT〜
maimyyym
2
290
Além do else! Categorizando Pokemóns com Pattern Matching no JavaScript
wmsbill
0
700
Cracking the KubeCon CfP
inductor
2
270
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
4
880
【SORACOM UG 東海】あらゆるモノがつながる社会へ、IoT と SORACOM
soracom
PRO
1
140
Azure Container Apps + Bicep 〜 こんな感じで運用しています
kaz29
3
620
EMとして2023年度に頑張ったこと / What we did well in FY2023 as a EM
pauli
1
210
コードファーストの考え方。 Amplify Gen2から学ぶAWS次世代のWeb開発体験
yoshiitaka
1
300
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
242
1.2M
Large-scale JavaScript Application Architecture
addyosmani
504
110k
The Pragmatic Product Professional
lauravandoore
26
5.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
323
20k
Building Applications with DynamoDB
mza
88
5.6k
How to Ace a Technical Interview
jacobian
273
22k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Raft: Consensus for Rubyists
vanstee
133
6.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Stop Working from a Prison Cell
hatefulcrawdad
267
19k
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