#161 Sloppy Python can mean fast answers!
Python Bytes - A podcast by Michael Kennedy and Brian Okken - Luni
Categories:
Sponsored by DigitalOcean: pythonbytes.fm/digitalocean
Special guest: Anthony Herbert
Anthony #1: Larry Hastings - Solve Your Problem With Sloppy Python - PyCon 2018
- Michael’s personal automation things that I do all the time
Michael #2: Introduction to ASGI: Emergence of an Async Python Web Ecosystem
- by Florimond Manca
- Python growth is not just data science
- Python web development is back with an async spin, and it's exciting.
- One of the main drivers of this endeavour is ASGI , the Asynchronous Standard Gateway Interface.
- A guided tour about what ASGI is and what it means for modern Python web development.
- Since 3.5 was released, the community has been literally async-ifying all the things. If you're curious, a lot of the resulting projects are now listed in aio-libs and awesome-asyncio .
- An overview of ASGI
- Why should I care? Interoperability is a strong selling point, there are many more advantages to using ASGI-based components for building Python web apps.
- Speed: the async nature of ASGI apps and servers make them really fast (for Python, at least) — we're talking about 60k-70k req/s (consider that Flask and Django only achieve 10-20k in a similar situation).
- Features: ASGI servers and frameworks gives you access to inherently concurrent features (WebSocket, Server-Sent Events, HTTP/2) that are impossible to implement using sync/WSGI.
- Stability: ASGI as a spec has been around for about 3 years now, and version 3.0 is considered very stable. Foundational parts of the ecosystem are stabilizing as a result.
- To get your hands dirty, try out any of the following projects:
Anthony #3: Python Insights
Michael #4: Assembly
- via Luiz Honda
- Assembly is a Pythonic Object-Oriented Web Framework built on Flask, that groups your routes by class
- Assembly is a pythonic object-oriented, mid stack, batteries included framework built on Flask, that adds structure to your Flask application, and group your routes by class.
- Assembly allows you to build web applications in much the same way you would build any other object-oriented Python program.
- Assembly helps you create small to enterprise level applications easily.
- Decisions made for you + features: github.com/mardix/assembly#decisions-made-for-you--features
Examples, root URLs:
# Extends to Assembly makes it a route automatically
# By default, Index will be the root url
class Index(Assembly):
# index is the entry route
# -> /
def index(self):
return "welcome to my site"
# method name becomes the route
# -> /hello/
def hello(self):
return "I am a string"
# undescore method name will be dasherize
# -> /about-us/
def about_us(self):
return "I am a string"
Example of /blog.
# The class name is part of the url prefix
# This will become -> /blog
class Blog(Assembly):
# index will be the root
# -> /blog/
def index(self):
return [
{
"title": "title 1",
"content": "content"
},
...
]
# with params. The order will be respected
# -> /comments/1234/
# 1234 will be passed to the id
def comments(self, id):
return [
{
comments...
}
]
Anthony #5: Building a Standalone GPS Logger with CircuitPython using @Adafruit and particle hardware
Michael #6: 10 reasons python is good to learn
- Python is popular and good to learn because, in Michael’s words, it’s a full spectrum language.
- And the reasons are:
- Python Is Free and Open-Source
- Python Is Popular, Loved, and Wanted
- Python Has a Friendly and Devoted Community
- Python Has Elegant and Concise Syntax
- Python Is Multi-Platform
- Python Supports Multiple Programming Paradigms
- Python Offers Useful Built-In Libraries
- Python Has Many Third-Party Packages
- Python Is a General-Purpose Programming Language
- Python Plays Nice with Others
Extras:
Michael:
- I was just on .NET Rocks podcast talking about Python for the .NET Developer
- New Python for the .NET Developer 9-hour course
- New Python for Decision Makers course, 2.5 hours of exploring Python for your org.
- Hidden files in Finder: use shortcut
cmd+shift+.
Anthony:
Joke: The failed pickup line
- A girl is hanging out at a bar with her friends.
- Some guy comes up to her an says: “You are the ; to my line of code.”
- She responds, “Get outta here creep, I code in Python.”