SlideShare a Scribd company logo
My First Python Project 
Neetu Jain 
Software Engineer 
Softlayer, IBM 
nutshi@gmail.com, njain@softlayer.com
What’s Ahead? 
What to expect when diving into python: 
Bird’s eye view of “getting started into python” 
How to start your first python project: 
some kind of a skeleton , resources, pointers 
Help you realise that some comics hit close to home: 
Thanks to xkcd.com 
*** if you already know python, you might not get much out of this talk :)***
First Stop:Install 
Python Version: 
Python 2.x or Python 3.x 
Python IDE: 
Pycharm, pythonwin, sublime ...e.t.c 
version control: 
git, svn...e.t.c
Readability(whitespace) Matters!
Zen Of Python 
PEP8 
pip install --upgrade pep8 
pep8 --show-source --show-pep8 test.py 
4685 E501 line too long (80 > 79 characters) 
1718 E302 expected 2 blank lines, found 1 
pep8 --statistics -qq Project/ 
Pylint 
pip install pylint 
pylint --reports=n test.py 
C0111: 4,0:sth1: Missing docstring 
W0104: 5,4:sth1: Statement seems to have no effect
No More Compiler Breaks!
Nostalgia!
Bye Bye Static Typing
Built-in Data Structures 
● Sets 
● List 
● Tuple 
● Dictionary
No Pointers->No Segfaults 
*forget memory management and issues that arise from it*
Recycling Wins Reinventing 
Not likely in Python
Power of PyPi 
$pip install newpackage 
$import newpackage 
$newpackage.callitsfunction()
Testing Tools Ensure Automation 
**https://wiki.python.org/moin/PythonTestingToolsTaxonomy**
Tests:made easy 
$python unittest_simple.py 
$ python unittest_simple.py -v 
test (__main__.SimplisticTest) ... ok 
------------------------------------ 
Ran 1 test in 0.000s 
OK/FAIL/ERROR 
unittest_simple.py 
import unittest 
class FixturesTest(unittest.TestCase): 
def test(self): 
print 'in test()' 
self.failIf(True, 'failure message goes here') 
if __name__ == '__main__': 
unittest.main()
Python: you can do a lot! 
Process mgmt: supervisor 
Deployment mgmt :fabric Database: sqllite 
Web framework:flask Messaging: pika(amqp)
First python project
Virtual environment 
$ [sudo] pip install virtualenv 
$ cd ~/code/myproject/ 
$ virtualenv env 
New python executable in env/bin/python 
Installing setuptools............done. 
Installing pip...............done. 
$ ls env 
bin include lib 
$ which python 
/usr/bin/python 
$ source env/bin/activate 
$ which python 
/Users/name/code/myproject/env/bin/python
Directory structure some_root_dir/ 
|-- LICENSE 
|-- README 
|-- setup.py 
|-- example_project/ 
| |-- __init__.py 
| |-- useful_1.py 
| |-- drivers/ 
| | |--useful_2.py 
|-- tests/ 
| |-- __init__.py 
| |-- runall.py 
| |-- test0.py 
|-- docs/ 
| |--conf.py 
| |--generated
Setup.py 
from setuptools import setup, find_packages 
setup( 
name='buzz', 
version='0.1', 
description=Project name ', 
long_description=open('README.md', 'r').read(), 
classifiers=[ 
'Development Status :: 1 - Beta', 
'Programming Language :: Python :: 2.7', 
], 
author_email='innovation@softlayer.com', 
url='http://sldn.softlayer.com', 
license='MIT', 
packages=find_packages(), 
include_package_data=True, 
install_requires=[ 
‘package-name’, 
‘docutils>=0.3’, 
], 
entry_points={ 
'console_scripts': [ 
'face_of_project = module:your_function, 
] 
}, 
#just download not install 
setup_requires=[], 
)
vagrant VM manager 
$ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box 
$ mkdir my_vagrant_test 
$ cd my_vagrant_test 
$ vagrant init lucid32 
$ vim Vagrantfile 
$ vagrant up 
$ vagrant ssh 
$ vagrant status 
$ vagrant reload 
$ vagrant destroy
Supervisor: A Process Control System 
vagrant@buzz:~$ supervisord -c /vagrant/scripts/supervisord.conf 
vagrant@buzz:~$ sudo supervisorctl -c /vagrant/scripts/supervisord.conf 
apnsfb RUNNING pid 5671, uptime 0:02:17 
buzz RUNNING pid 5673, uptime 0:02:17 
flask RUNNING pid 5672, uptime 0:02:17 
vagrant@buzz:~$ cat /tmp/supervisord.log 
2014-09-12 18:31:22,001 CRIT Supervisor running as root (no user in config 
file) 
2014-09-12 18:31:22,017 INFO RPC interface 'supervisor' initialized
My First Python Project 
Neetu Jain 
Software Engineer 
Softlayer, IBM 
nutshi@gmail.com, njain@softlayer.com

More Related Content

What's hot (19)

PDF
Python quick guide1
Kanchilug
 
PDF
Python course syllabus
Sugantha T
 
PDF
Python
Edureka!
 
PDF
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
Edureka!
 
PPTX
Introduction to python for Beginners
Sujith Kumar
 
PDF
Introduction to python
Learnbay Datascience
 
PDF
web programming Unit VIII complete about python by Bhavsingh Maloth
Bhavsingh Maloth
 
PDF
Python Scripting Tutorial for Beginners | Python Tutorial | Python Training |...
Edureka!
 
PPTX
1901200100000 presentation short term mini project on python
SANTOSHJAISWAL52
 
PPTX
Basics of python
SurjeetSinghSurjeetS
 
PDF
Advanced Python Tutorial | Learn Advanced Python Concepts | Python Programmin...
Edureka!
 
PDF
Introduction To Python
Vanessa Rene
 
PDF
Python for the Mobile and Web
Derek Kiong
 
PPTX
Python
GAnkitgupta
 
PPT
Python Introduction
Mohammad Javad Beheshtian
 
PPTX
Introduction to python
ManishJha237
 
PDF
Python Programming - XIII. GUI Programming
Ranel Padon
 
PDF
Python tutorial
Guru99
 
DOCX
Seminar report on python 3 course
HimanshuPanwar38
 
Python quick guide1
Kanchilug
 
Python course syllabus
Sugantha T
 
Python
Edureka!
 
Python Tutorial For Beginners | Python Crash Course - Python Programming Lang...
Edureka!
 
Introduction to python for Beginners
Sujith Kumar
 
Introduction to python
Learnbay Datascience
 
web programming Unit VIII complete about python by Bhavsingh Maloth
Bhavsingh Maloth
 
Python Scripting Tutorial for Beginners | Python Tutorial | Python Training |...
Edureka!
 
1901200100000 presentation short term mini project on python
SANTOSHJAISWAL52
 
Basics of python
SurjeetSinghSurjeetS
 
Advanced Python Tutorial | Learn Advanced Python Concepts | Python Programmin...
Edureka!
 
Introduction To Python
Vanessa Rene
 
Python for the Mobile and Web
Derek Kiong
 
Python
GAnkitgupta
 
Python Introduction
Mohammad Javad Beheshtian
 
Introduction to python
ManishJha237
 
Python Programming - XIII. GUI Programming
Ranel Padon
 
Python tutorial
Guru99
 
Seminar report on python 3 course
HimanshuPanwar38
 

Similar to First python project (20)

PPTX
How to deliver a Python project
mattjdavidson
 
PDF
Pycon2017 instagram keynote
Lisa Guo
 
PDF
Introduction to python 3
Youhei Sakurai
 
PPTX
PyCourse - Self driving python course
Eran Shlomo
 
PDF
Isolated development in python
Andrés J. Díaz
 
PPTX
Complete python toolbox for modern developers
Jan Giacomelli
 
PDF
What is Python? (Silicon Valley CodeCamp 2014)
wesley chun
 
PDF
Fabric Python Lib
Simone Federici
 
PDF
Introduction to python 3 2nd round
Youhei Sakurai
 
PDF
Learn To Code Like A Professional With Pythonan Open Source Versatile And Pow...
metalsmunshe
 
KEY
PHP to Python with No Regrets
Alex Ezell
 
PDF
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison
 
PDF
Expert Python Programming - Second Edition Michał Jaworski
naterysandr
 
PDF
What is Python? (Silicon Valley CodeCamp 2015)
wesley chun
 
PDF
Software maintenance PyConUK 2016
Cesar Cardenas Desales
 
PDF
How to write a well-behaved Python command line application
gjcross
 
PDF
Python for Penetration testers
Christian Martorella
 
PDF
Python: an introduction for PHP webdevelopers
Glenn De Backer
 
PPTX
Presentation of Python, Django, DockerStack
David Sanchez
 
PDF
Repeatable Deployments and Installations
Idan Gazit
 
How to deliver a Python project
mattjdavidson
 
Pycon2017 instagram keynote
Lisa Guo
 
Introduction to python 3
Youhei Sakurai
 
PyCourse - Self driving python course
Eran Shlomo
 
Isolated development in python
Andrés J. Díaz
 
Complete python toolbox for modern developers
Jan Giacomelli
 
What is Python? (Silicon Valley CodeCamp 2014)
wesley chun
 
Fabric Python Lib
Simone Federici
 
Introduction to python 3 2nd round
Youhei Sakurai
 
Learn To Code Like A Professional With Pythonan Open Source Versatile And Pow...
metalsmunshe
 
PHP to Python with No Regrets
Alex Ezell
 
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison
 
Expert Python Programming - Second Edition Michał Jaworski
naterysandr
 
What is Python? (Silicon Valley CodeCamp 2015)
wesley chun
 
Software maintenance PyConUK 2016
Cesar Cardenas Desales
 
How to write a well-behaved Python command line application
gjcross
 
Python for Penetration testers
Christian Martorella
 
Python: an introduction for PHP webdevelopers
Glenn De Backer
 
Presentation of Python, Django, DockerStack
David Sanchez
 
Repeatable Deployments and Installations
Idan Gazit
 
Ad

Recently uploaded (20)

PDF
Your Growth in IT Starts Here – Powered by Formwalaa.in
Reeshna Prajeesh
 
PPTX
Learn AI in Software Testing - Venkatesh (Rahul Shetty)
Venkatesh (Rahul Shetty)
 
PDF
Get Daily Sarkari Job Updates – Majhi Naukri
Reeshna Prajeesh
 
PPTX
Plant Growth and Development-Part I, ppt.pptx
7300511143
 
PPTX
The Future of Sustainable Cities.ppppptx
sahatanmay391
 
PDF
165. Reviewer Certificate in Physical Science
Manu Mitra
 
DOCX
PMCF (Performance Monitoring and Coaching Form
ROSALIESOMBILON
 
PDF
Convex optimization analysis in todays world scenario.pdf
mahizxy
 
PPTX
Mastering the Cloud with AWS: A Deep Dive into Amazon Web Services
cbitssnavjotdm
 
DOCX
PMCF -Performance Monitoring and Coaching Form
ROSALIESOMBILON
 
PPTX
Using the translanguaging to enhance RES
ssuserb7fdac
 
PDF
Certificate PMP kamel_rodrigue_adda_1879235
kamelard
 
PPTX
Future_Proofing_Your_Career_25_Essential_Skills_for_2025.pptx
presentifyai
 
PPTX
A Portfolio as a Job Search Tool July 2025
Bruce Bennett
 
PDF
Web Developer Jobs in Jaipur Your Gateway to a Thriving Tech Career in Rajast...
vinay salarite
 
PDF
Buy Twitter Accounts_ Boost Your Brand and Reach in 2025 - Copy - Copy.pdf
Buy Old Twitter Accounts-100% Secure Aged With Followers
 
PDF
REFRIGERATION THANDA AND AIR PABANA PATHA PADHE
AjitBiswal14
 
PDF
Crafting Winning CVs Cover Letters and Mastering Job Interviews with Roman Vi...
Excellence Foundation for South Sudan
 
PDF
reStartEvents July 10th TS:SCI & Above Employer Directory.pdf
Ken Fuller
 
PPTX
21st-Literature.pptxjsududhshsusushshsusuhsgsysh
JohnVJLBellen
 
Your Growth in IT Starts Here – Powered by Formwalaa.in
Reeshna Prajeesh
 
Learn AI in Software Testing - Venkatesh (Rahul Shetty)
Venkatesh (Rahul Shetty)
 
Get Daily Sarkari Job Updates – Majhi Naukri
Reeshna Prajeesh
 
Plant Growth and Development-Part I, ppt.pptx
7300511143
 
The Future of Sustainable Cities.ppppptx
sahatanmay391
 
165. Reviewer Certificate in Physical Science
Manu Mitra
 
PMCF (Performance Monitoring and Coaching Form
ROSALIESOMBILON
 
Convex optimization analysis in todays world scenario.pdf
mahizxy
 
Mastering the Cloud with AWS: A Deep Dive into Amazon Web Services
cbitssnavjotdm
 
PMCF -Performance Monitoring and Coaching Form
ROSALIESOMBILON
 
Using the translanguaging to enhance RES
ssuserb7fdac
 
Certificate PMP kamel_rodrigue_adda_1879235
kamelard
 
Future_Proofing_Your_Career_25_Essential_Skills_for_2025.pptx
presentifyai
 
A Portfolio as a Job Search Tool July 2025
Bruce Bennett
 
Web Developer Jobs in Jaipur Your Gateway to a Thriving Tech Career in Rajast...
vinay salarite
 
Buy Twitter Accounts_ Boost Your Brand and Reach in 2025 - Copy - Copy.pdf
Buy Old Twitter Accounts-100% Secure Aged With Followers
 
REFRIGERATION THANDA AND AIR PABANA PATHA PADHE
AjitBiswal14
 
Crafting Winning CVs Cover Letters and Mastering Job Interviews with Roman Vi...
Excellence Foundation for South Sudan
 
reStartEvents July 10th TS:SCI & Above Employer Directory.pdf
Ken Fuller
 
21st-Literature.pptxjsududhshsusushshsusuhsgsysh
JohnVJLBellen
 
Ad

First python project

  • 1. My First Python Project Neetu Jain Software Engineer Softlayer, IBM [email protected], [email protected]
  • 2. What’s Ahead? What to expect when diving into python: Bird’s eye view of “getting started into python” How to start your first python project: some kind of a skeleton , resources, pointers Help you realise that some comics hit close to home: Thanks to xkcd.com *** if you already know python, you might not get much out of this talk :)***
  • 3. First Stop:Install Python Version: Python 2.x or Python 3.x Python IDE: Pycharm, pythonwin, sublime ...e.t.c version control: git, svn...e.t.c
  • 5. Zen Of Python PEP8 pip install --upgrade pep8 pep8 --show-source --show-pep8 test.py 4685 E501 line too long (80 > 79 characters) 1718 E302 expected 2 blank lines, found 1 pep8 --statistics -qq Project/ Pylint pip install pylint pylint --reports=n test.py C0111: 4,0:sth1: Missing docstring W0104: 5,4:sth1: Statement seems to have no effect
  • 8. Bye Bye Static Typing
  • 9. Built-in Data Structures ● Sets ● List ● Tuple ● Dictionary
  • 10. No Pointers->No Segfaults *forget memory management and issues that arise from it*
  • 11. Recycling Wins Reinventing Not likely in Python
  • 12. Power of PyPi $pip install newpackage $import newpackage $newpackage.callitsfunction()
  • 13. Testing Tools Ensure Automation **https://wiki.python.org/moin/PythonTestingToolsTaxonomy**
  • 14. Tests:made easy $python unittest_simple.py $ python unittest_simple.py -v test (__main__.SimplisticTest) ... ok ------------------------------------ Ran 1 test in 0.000s OK/FAIL/ERROR unittest_simple.py import unittest class FixturesTest(unittest.TestCase): def test(self): print 'in test()' self.failIf(True, 'failure message goes here') if __name__ == '__main__': unittest.main()
  • 15. Python: you can do a lot! Process mgmt: supervisor Deployment mgmt :fabric Database: sqllite Web framework:flask Messaging: pika(amqp)
  • 17. Virtual environment $ [sudo] pip install virtualenv $ cd ~/code/myproject/ $ virtualenv env New python executable in env/bin/python Installing setuptools............done. Installing pip...............done. $ ls env bin include lib $ which python /usr/bin/python $ source env/bin/activate $ which python /Users/name/code/myproject/env/bin/python
  • 18. Directory structure some_root_dir/ |-- LICENSE |-- README |-- setup.py |-- example_project/ | |-- __init__.py | |-- useful_1.py | |-- drivers/ | | |--useful_2.py |-- tests/ | |-- __init__.py | |-- runall.py | |-- test0.py |-- docs/ | |--conf.py | |--generated
  • 19. Setup.py from setuptools import setup, find_packages setup( name='buzz', version='0.1', description=Project name ', long_description=open('README.md', 'r').read(), classifiers=[ 'Development Status :: 1 - Beta', 'Programming Language :: Python :: 2.7', ], author_email='[email protected]', url='http://sldn.softlayer.com', license='MIT', packages=find_packages(), include_package_data=True, install_requires=[ ‘package-name’, ‘docutils>=0.3’, ], entry_points={ 'console_scripts': [ 'face_of_project = module:your_function, ] }, #just download not install setup_requires=[], )
  • 20. vagrant VM manager $ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box $ mkdir my_vagrant_test $ cd my_vagrant_test $ vagrant init lucid32 $ vim Vagrantfile $ vagrant up $ vagrant ssh $ vagrant status $ vagrant reload $ vagrant destroy
  • 21. Supervisor: A Process Control System vagrant@buzz:~$ supervisord -c /vagrant/scripts/supervisord.conf vagrant@buzz:~$ sudo supervisorctl -c /vagrant/scripts/supervisord.conf apnsfb RUNNING pid 5671, uptime 0:02:17 buzz RUNNING pid 5673, uptime 0:02:17 flask RUNNING pid 5672, uptime 0:02:17 vagrant@buzz:~$ cat /tmp/supervisord.log 2014-09-12 18:31:22,001 CRIT Supervisor running as root (no user in config file) 2014-09-12 18:31:22,017 INFO RPC interface 'supervisor' initialized
  • 22. My First Python Project Neetu Jain Software Engineer Softlayer, IBM [email protected], [email protected]

Editor's Notes

  • #21: Vagrant, an open-source product released in 2010, is best described as a VM manager. It allows you to script and package the VM config and the provisioning setup. It is designed to run on top of almost any VM tool – VirtualBox, VMWare, AWS, etc.