How to Write a Popular Python Library by Accident
-
Upload
daniel-greenfeld -
Category
Internet
-
view
778 -
download
1
Transcript of How to Write a Popular Python Library by Accident
![Page 1: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/1.jpg)
How to Write a Popular Python Library by Accident
Daniel Roy Greenfeld Audrey Roy Greenfeld
Thursday Keynote Speech June 23, 2016
![Page 2: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/2.jpg)
How to Write a Popular Python Library by Accident
Daniel Roy Greenfeld Audrey Roy Greenfeld
Thursday Keynote Speech June 23, 2016
![Page 3: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/3.jpg)
@audreyr @pydanny
About Us
Daniel Roy Greenfeld Audrey Roy Greenfeld
Met at PyCon US 2010 Married December 2013
Open Source Developers
Engineer & Principal, Cartwheel Web Engineer & Principal, Cartwheel Web
![Page 4: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/4.jpg)
@audreyr @pydanny
You Might Know Our Open Source Work
Responsibility
![Page 5: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/5.jpg)
@audreyr @pydanny
So Much Open Source Work?! Why?
PortfolioSolves problems
CommunityResponsibility
![Page 6: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/6.jpg)
@audreyr @pydanny
So Much Open Source Work?! Why?
Community
Biggest Reason:
It’s Gratifying
![Page 7: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/7.jpg)
@audreyr @pydanny
Python Package IndexFind Open Source Python packages
![Page 8: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/8.jpg)
@audreyr @pydanny
Python Package IndexWho is familiar with PyPI?
![Page 9: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/9.jpg)
@audreyr @pydanny
Python Package IndexWho here has released a package on PyPI?
Raise your hand.
![Page 10: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/10.jpg)
@audreyr @pydanny
Everyone here should release a package on PyPI.
Python Package Index
![Page 11: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/11.jpg)
@audreyr @pydanny
package
I don’t know how to do it
I’m not creative enough
I don’t have enough experience
I’m not a visionaryNonsense!
But Isn’t Releasing Packages Hard?
![Page 12: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/12.jpg)
@audreyr @pydanny
The Big Secret About Open Source
Packages
![Page 13: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/13.jpg)
@audreyr @pydanny
The Big Secret
Creators of Packages aren’t
special visionaries
are
![Page 14: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/14.jpg)
@audreyr @pydanny
They are coders like you and me
![Page 15: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/15.jpg)
@audreyr @pydanny
One difference…
![Page 16: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/16.jpg)
@audreyr @pydanny
They release open source
packages
![Page 17: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/17.jpg)
@audreyr @pydanny
A Single Function
The Big Secret
Installable Package
![Page 18: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/18.jpg)
@audreyr @pydanny
Secret Package Recipe #1
Step 1: Pick a FunctionStep 2: Get the BoilerplateStep 3: Add Function to
Boilerplate
![Page 19: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/19.jpg)
@audreyr @pydanny
Secret Package Recipe #2
Step 1: Pick a ClassStep 2: Get the BoilerplateStep 3: Add Class to
Boilerplate
![Page 20: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/20.jpg)
@audreyr @pydanny
CookiecutterPackagesmakes packaging trivial
BoilerplateTool for generating boilerplate for Python packages (and other projects)
![Page 21: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/21.jpg)
@audreyr @pydanny
DEMO
![Page 22: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/22.jpg)
@audreyr @pydanny
CookiecutterPackagesmakes packaging trivial
BoilerplateTool for generating boilerplate for Python packages (and other projects)
![Page 23: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/23.jpg)
@audreyr @pydanny
packagesSmall But Useful Packages
binaryornot
cached-property
![Page 24: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/24.jpg)
@audreyr @pydanny
Packages
Complex Project
Installable Package
![Page 25: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/25.jpg)
@audreyr @pydanny
sComplex Project
![Page 26: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/26.jpg)
@audreyr @pydanny
projectoften grow from simple projects
sComplex Project
![Page 27: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/27.jpg)
@audreyr @pydanny
What project should you build?
![Page 28: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/28.jpg)
@audreyr @pydanny
Build what you need!
😀
![Page 29: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/29.jpg)
@audreyr @pydanny
😁😄😅 😆😉😊😋😺
Community might follow
😀
![Page 30: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/30.jpg)
@audreyr @pydanny
😀
CommunityDon’t worry if the
community follows
😮
😋
😁😄
😅😺
😉😊
![Page 31: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/31.jpg)
@audreyr @pydanny
😮
Focus on your needs
😀
Focus on your story
![Page 32: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/32.jpg)
@audreyr @pydanny
storyStory of
cached-property
![Page 33: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/33.jpg)
@audreyr @pydanny
Story of cached-property
4 Class Package
Caches object properties
![Page 34: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/34.jpg)
@audreyr @pydanny
class cached_property(object): """ A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76 """ # noqa
def __init__(self, func): self.__doc__ = getattr(func, '__doc__') self.func = func
def __get__(self, obj, cls): if obj is None: return self value = obj.__dict__[self.func.__name__] = self.func(obj) return value
Started at 9 lines of codeNow has 131 lines of code
Story of cached-property
![Page 35: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/35.jpg)
@audreyr @pydanny
Story of cached-property
bugs.python.org/issue21145
![Page 36: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/36.jpg)
@audreyr @pydanny
Story of cached-property
You never know who will use your library :)
![Page 37: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/37.jpg)
@audreyr @pydanny
Don’t be Super
Ambitious
![Page 38: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/38.jpg)
@audreyr @pydanny
Identify small problems
Don’t be
Ambitious
![Page 39: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/39.jpg)
@audreyr @pydanny
and fix them
small
![Page 40: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/40.jpg)
@audreyr @pydanny
Stories
Django Packages
Requests
Cookiecutter
Matplotlib
django-uni-form django-crispy-forms/
…and fix them
![Page 41: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/41.jpg)
@audreyr @pydanny
Story
django-uni-form
django-crispy-forms
![Page 42: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/42.jpg)
@audreyr @pydanny
django-uni-form
2009
![Page 43: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/43.jpg)
@audreyr @pydanny
django-uni-form
• Danny started his first professional Django project.
• US Government projects must be Section 508.
2009
• Django is not Section 508!
![Page 44: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/44.jpg)
@audreyr @pydanny
What is Section 508?
•Color-blind •Blind
![Page 45: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/45.jpg)
@audreyr @pydanny
“Forms must be defined not in tables, but in divs”
Rule
![Page 46: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/46.jpg)
@audreyr @pydanny
Uh-oh…
• Project had 80 forms.
• How do we convert 80 forms from tables to divs…
• …without going crazy?
![Page 47: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/47.jpg)
@audreyr @pydanny
Reuse the Code!# uni_form/templatetags/uni_form_tags.pyfrom django import templateregister = template.Library()from django.utils.safestring import mark_safe @register.filterdef as_uni_form(form): text = '' for field in form: text = """ <div class="ctrlHolder"> %s %s : %s </div> """ % (field.errors, field.label_tag(), field) return mark_safe(text)https://github.com/pydanny/django-uni-form/commit/e0f02cb9120f794a17bec297f0b1778f066a9168
![Page 48: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/48.jpg)
@audreyr @pydanny
Package the Code!
django-uni-form
![Page 49: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/49.jpg)
@audreyr @pydanny
Growing the django-uni-form
API
![Page 50: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/50.jpg)
@audreyr @pydanny
Growing the API
Added entire HTML form
generation via Python
![Page 51: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/51.jpg)
@audreyr @pydanny
Growing the API
Added HTML form button
controls
![Page 52: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/52.jpg)
@audreyr @pydanny
Growing the API
Fancier HTML Control and Layout
Widgets
Project grew and grew…
![Page 53: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/53.jpg)
@audreyr @pydanny
ProjectSometimes you leave a project
django-uni-form
![Page 54: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/54.jpg)
@audreyr @pydanny
django-uni-form
django-crispy-forms2390 Github ⭐!
django-crispy-forms
![Page 55: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/55.jpg)
@audreyr @pydanny
Stories
django-uni-form / django-crispy-forms
Requests
Cookiecutter
Matplotlib
Django Packages
![Page 58: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/58.jpg)
@audreyr @pydanny
“Automatic Birthday Greetings for Facebook!”
Django Dash 2010
We were too lazy to learn the Facebook API
Idea #1:
![Page 59: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/59.jpg)
@audreyr @pydanny
Django Dash 2010
Idea #2:“What about making comparison grids for
for Django packages?”
![Page 60: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/60.jpg)
@audreyr @pydanny
Small Scopehttps://code.djangoproject.com/wiki/CMSAppsComparison
Django Dash 2010
![Page 61: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/61.jpg)
@audreyr @pydanny
Stretch Goals
• Anyone could Add Packages
• Anyone can Add Packages to Grids
• Fetch data from GitHub and PyPI
Django Dash 2010
![Page 62: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/62.jpg)
@audreyr @pydanny
Django Dash 2010:)
Thoughts
Built over a weekend contest
Django Packages was a need
Focus on your needs.
![Page 63: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/63.jpg)
@audreyr @pydanny
Stories
django-uni-form / django-crispy-forms
Django Packages
Cookiecutter
Matplotlib
requests
![Page 64: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/64.jpg)
@audreyr @pydanny
urllib + urllib2 doesn’t meet your needs?
Use requests
![Page 65: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/65.jpg)
@audreyr @pydanny
requestsWinter 2011
Kenneth’s problem: urllib and urllib2 are
hard to use
![Page 66: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/66.jpg)
@audreyr @pydanny
Winter 2011
requests
changelog
![Page 67: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/67.jpg)
@audreyr @pydanny
Stories
django-uni-form / django-crispy-forms
Django Packages
requests
Cookiecutter
Matplotlib
![Page 68: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/68.jpg)
@audreyr @pydanny
CookiecutterSummer 2013
Audrey’s experiment: Create as many new
packages as I can, just for fun
![Page 69: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/69.jpg)
@audreyr @pydanny
Summer 2013
Cookiecutter
packages
Got tired quickly of copy/pasting boilerplate
from package to package
![Page 70: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/70.jpg)
@audreyr @pydanny
Great contributing instructions
tests!
Python module
Travis-CI
PyPI boilerplate
More PyPI boilerplate
boilerplate
Cookiecutter
![Page 71: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/71.jpg)
@audreyr @pydanny
Cookiecutter
I had just d a static site
generator called “complexity”
create
![Page 72: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/72.jpg)
@audreyr @pydanny
Cookiecutter
What if I used similar concepts to create a
project template renderer?
![Page 73: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/73.jpg)
@audreyr @pydanny
Cookiecutter was born!
![Page 74: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/74.jpg)
@audreyr @pydanny
After first release, the pull requests began
Cookiecutter
![Page 75: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/75.jpg)
@audreyr @pydanny
Cookiecutter
![Page 76: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/76.jpg)
@audreyr @pydanny
Cookiecutter
Then Danny
blogged about it.
http://bit.ly/25W87lM
![Page 77: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/77.jpg)
@audreyr @pydanny
Cookiecutter
Danny needed an image for his blog post.
![Page 78: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/78.jpg)
@audreyr @pydanny
Danny needed an image for his blog post.
![Page 79: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/79.jpg)
@audreyr @pydanny
![Page 80: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/80.jpg)
@audreyr @pydanny
![Page 81: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/81.jpg)
@audreyr @pydanny
Great contributing instructions
tests
Python module
Travis-CI
PyPI boilerplate
More PyPI boilerplate
![Page 82: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/82.jpg)
@audreyr @pydanny
Now anyone can create and submit packages
to PyPI in minutes!
![Page 83: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/83.jpg)
@audreyr @pydanny
Are there too many PyPI packages?
“I hate how there are too many packages. I can’t find what I need.”
— grumpy coder— beginner
![Page 84: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/84.jpg)
@audreyr @pydanny
The grumpy coder:Doesn’t know how to search intelligently
“Grr, there are too many websites. I miss the old WWW before Google.”
![Page 85: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/85.jpg)
@audreyr @pydanny
The grumpy coder:
Doesn’t read Python blogs or books
![Page 86: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/86.jpg)
@audreyr @pydanny
The grumpy coder:
Doesn’t attend Python user groups to help find
great tools
![Page 87: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/87.jpg)
@audreyr @pydanny
Always Remember:
Doesn’t attend Python
![Page 88: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/88.jpg)
@audreyr @pydanny
The more packages that exist, the better
Always Remember:
![Page 89: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/89.jpg)
@audreyr @pydanny
More packages means a diversity of selection
![Page 90: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/90.jpg)
@audreyr @pydanny
Different viewpoints on the same problem
Different viewpointspackages
![Page 91: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/91.jpg)
@audreyr @pydanny
• Flask
• Pyramid
• Tornado
• Bottle
• Web2py
• cherrypy
• web.py
• Falcon
• Bluebreem
• Turbogears
• Google App Engine
• Or write your own!
Django doesn’t meet your needs? Use another web framework
Different viewpoints
![Page 92: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/92.jpg)
@audreyr @pydanny
youDjango doesn’t meet your needs? Use another web framework
• Flask
• Pyramid
• Tornado
• Bottle
• Web2py
• cherrypy
• web.py
• Falcon
• Bluebreem
• Turbogears
• Google App Engine
• Or write your own!
(Bold items were written as Django alternatives)
![Page 93: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/93.jpg)
@audreyr @pydanny
Python shell not quite what you want?
Started as a 259-line experiment by Fernando Perez
Now 180K+ LOC
![Page 94: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/94.jpg)
@audreyr @pydanny
you
More Packages More Options
More Toolshttp://pixabay.com/en/carrots-variety-vegetables-76653/
your contribution
![Page 95: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/95.jpg)
@audreyr @pydanny
More is Good
Than to be limited by options that don’t meet your needs
Better to write a new library
![Page 96: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/96.jpg)
@audreyr @pydanny
Stories
django-uni-form / django-crispy-forms
Django Packages
Requests
Cookiecutter
Matplotlib
![Page 97: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/97.jpg)
@audreyr @pydanny
MatplotlibThe story of
![Page 98: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/98.jpg)
@audreyr @pydanny
John Hunter (1968-2012)
• Matplotlib was his brainchild
• His work benefits our species
• http://numfocus.org/news/2012/08/28/johnhunter/
![Page 99: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/99.jpg)
@audreyr @pydanny
Matplotlib
• Created in 2002 to solve a major problem:
• Epilepsy causes seizures
• Some children don’t respond to the medications. They need brain surgery
by John Hunter
Story told to us by Fernando Perez of IPython/Jupyter, John’s close friend and collaborator.
![Page 100: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/100.jpg)
@audreyr @pydanny
brainsurgery
Treatment: Open Brain, Analyze Seizure Data, Surgery
Problem: Expensive, Limiting Analysis Tool
Matplotlib
![Page 101: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/101.jpg)
@audreyr @pydanny
Problem: Expensive, Limiting Analysis Tool
Matplotlib
![Page 102: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/102.jpg)
@audreyr @pydanny
Solution Part 1
Matplotlib
![Page 103: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/103.jpg)
@audreyr @pydanny
Solution Part 2
Matplotlib
![Page 104: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/104.jpg)
@audreyr @pydanny
Solution Part 3
Matplotlib
![Page 105: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/105.jpg)
@audreyr @pydanny
3-d inferred location of seizure focus, together with active electrodes.
Matplotlib
![Page 106: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/106.jpg)
@audreyr @pydanny
MatplotlibThe birth of
• John Hunter originally offered his plotting code to Fernando Perez as a patch (contribution) to IPython
• Fernando Perez liked it but had to focus on finishing his grad thesis
• John turned that code into matplotlib
![Page 107: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/107.jpg)
@audreyr @pydanny
Stories
django-uni-form / django-crispy-forms
Django Packages
Requests
Cookiecutter
Matplotlib
![Page 108: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/108.jpg)
@audreyr @pydanny
You never know what project will grow from a
small piece of FOSS code
![Page 109: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/109.jpg)
@audreyr @pydanny
project
• They are minor fixes or enhancements
• They fit the project’s needs/goals
Contribute changes to existing projects if:
![Page 110: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/110.jpg)
@audreyr @pydanny
Start a new project if:
• No other project does what you need
• You’ve tried the other options already
• You feel that it will give you:
• Less resistance
• More freedom to do what you want
![Page 111: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/111.jpg)
@audreyr @pydanny
Anyone can…
Create and release a package
on PyPI
All you have
JUST DO IT!
![Page 112: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/112.jpg)
@audreyr @pydanny
All you have to do is
JUST DO IT!
![Page 113: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/113.jpg)
@audreyr @pydanny
Daniel Roy Greenfeld Audrey Roy GreenfeldEngineer & Principal, Cartwheel Web Engineer & Principal, Cartwheel Web
Met at PyCon US 2010 Married December 2013
Open Source Developers
![Page 114: How to Write a Popular Python Library by Accident](https://reader034.fdocuments.net/reader034/viewer/2022051318/587fe7501a28ab46228b5a25/html5/thumbnails/114.jpg)
@audreyr @pydanny
Daniel Roy Greenfeld Audrey Roy GreenfeldEngineer & Principal, Cartwheel Web Engineer & Principal, Cartwheel Web