Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Distributing Python Application the right way

Distributing Python Application the right way

Vaibhav Mishra

May 17, 2014
Tweet

More Decks by Vaibhav Mishra

Other Decks in Programming

Transcript

  1. COOKIECUTTER Use Cookiecutter to bootstrap your project from all the

    available templates Make your own template to your need c o o k i e c u t t e r h t t p s : / / g i t h u b . c o m / a u d r e y r / c o o k i e c u t t e r - p y p a c k a g e . g i t
  2. BUILD YOUR APP https://github.com/vinu76jsr/django_profiler/blob/master/profiler/mid all the code to write your

    app, this is a django middleware which intercepts requests and provides cProfile output but that's not important, it is here only as placeholder
  3. EDIT SETUP.PY s e t u p ( n a

    m e = ' p r o f i l e - m i d d l e w a r e ' , # t h e n a m e f o r p i p v e r s i o n = v e r s i o n , d e s c r i p t i o n = " " " P r o f i l e r f o r d j a n g o v i e w s " " " , l o n g _ d e s c r i p t i o n = r e a d m e + ' \ n \ n ' + h i s t o r y , a u t h o r = ' V a i b h a v M i s h r a ' , a u t h o r _ e m a i l = ' v i n u 7 6 j s r @ g m a i l . c o m ' , u r l = ' h t t p s : / / g i t h u b . c o m / v i n u 7 6 j s r / d j a n g o _ p r o f i p a c k a g e s = [ ' p r o f i l e r ' , # w h i c h p a c k a g e s s ] , i n c l u d e _ p a c k a g e _ d a t a = T r u e , i n s t a l l _ r e q u i r e s = [ ] , l i c e n s e = " B S D " , z i p _ s a f e = F a l s e , k e y w o r d s = ' p r o f i l e r ' ,
  4. SETUP.PY CONTINUED i n s t a l l _

    r e q u i r e s = [ ] , # s p e c i f y d e p e n d e n c i e s h e r e l i c e n s e = " B S D " , z i p _ s a f e = F a l s e , k e y w o r d s = ' p r o f i l e r ' , c l a s s i f i e r s = [ ' D e v e l o p m e n t S t a t u s : : 2 - P r e ' F r a m e w o r k : : D j a n g o ' , ' I n t e n d e d A u d i e n c e : : D e v e l o p e ' L i c e n s e : : O S I A p p r o v e d : : B S ' N a t u r a l L a n g u a g e : : E n g l i s h ' , ' P r o g r a m m i n g L a n g u a g e : : P y t h o ' P r o g r a m m i n g L a n g u a g e : : P y t h o ' P r o g r a m m i n g L a n g u a g e : : P y t h o ' P r o g r a m m i n g L a n g u a g e : : P y t h o ' P r o g r a m m i n g L a n g u a g e : : P y t h o ] , )
  5. SHOW YOUR CONFIDENCE Integration with travis or any other CI

    Integration with a code coverage metric tools Doesn't matter how you do it, but always a good idea show the metrics -- what's up with the coverage
  6. WHAT IS WITH THE COVERAGE an acceptable target is 60%+

    I used coveralls to show the badge although it's not bulletproof good coverage generally means better tested code and hence lesser bug
  7. last command picks your version from setup.py and upload it

    to pypi UPLOAD TO PYPI $ p y t h o n s e t u p . p y r e g i s t e r r u n n i n g r e g i s t e r W e n e e d t o k n o w w h o y o u a r e , s o p l e a s e c h o o s e e i t h e r : 1 . u s e y o u r e x i s t i n g l o g i n , 2 . r e g i s t e r a s a n e w u s e r , 3 . h a v e t h e s e r v e r g e n e r a t e a n e w p a s s w o r d f o r y o u ( a n d e m a i l i t t o y o u ) , o r 4 . q u i t Y o u r s e l e c t i o n [ d e f a u l t 1 ] : 1 $ p y t h o n s e t u p . p y s d i s t u p l o a d
  8. to preview them DOCUMENTATION Nobody can use your app if

    they don't know how to README.MD is a good start go to docs folder and write your docs m a k e d o c s
  9. DOCUMENTATION TIPS Maintain a changelog use sphinx to generate docs

    and write them in restructured text Add support for readthedocs.org
  10. ADDING DOCS TO READTHEDOCS If you are using github it's

    easy peasy add readthedocs webhook in your project register a url in read the docs and point it to readthedocs.org That's it check out django-profiler-docs