Cover image of Python Bytes

Python Bytes

Updated 5 days ago

Read more

Python Bytes is a weekly podcast hosted by Michael Kennedy and Brian Okken. The show is a short discussion on the headlines and noteworthy news in the Python, developer, and data science space.

Read more

Python Bytes is a weekly podcast hosted by Michael Kennedy and Brian Okken. The show is a short discussion on the headlines and noteworthy news in the Python, developer, and data science space.

iTunes Ratings

135 Ratings
Average Ratings

Recommendations req

By jx2233 - Jan 20 2020
Read more
Hey question what are the good python programming books for starters??

Outstanding Podcast

By Aggienaut - Sep 21 2019
Read more
Always informative and entertaining!

iTunes Ratings

135 Ratings
Average Ratings

Recommendations req

By jx2233 - Jan 20 2020
Read more
Hey question what are the good python programming books for starters??

Outstanding Podcast

By Aggienaut - Sep 21 2019
Read more
Always informative and entertaining!
Cover image of Python Bytes

Python Bytes

Latest release on Feb 19, 2020

The Best Episodes Ranked Using User Listens

Updated by OwlTail 5 days ago

Rank #1: #157 Oh hai Pandas, hold my hand?

Podcast cover
Read more

This episode is sponsored by DigitalOcean:

Michael #1: pydantic

  • via Colin Sullivan
  • Data validation and settings management using python type annotations.
  • (We covered Cerberus, this is similar)
  • pydantic enforces type hints at runtime, and provides user friendly errors when data is invalid.
class User(pydantic.BaseModel):
id: int
name = 'John Doe'
signup_ts: datetime = None
friends: List[int] = []

external_data = {
'id': '123',
'signup_ts': '2019-06-01 12:22',
'friends': [1, 2, '3']
user = User(**external_data)
  • id is of type int; the annotation-only declaration tells pydantic that this field is required. Strings, bytes or floats will be coerced to ints if possible; otherwise an exception will be raised.
  • name is inferred as a string from the provided default; because it has a default, it is not required.
  • signup_ts is a datetime field which is not required (and takes the value None if it's not supplied).
  • Why use it?

Brian #2: 5.0 beta 1 adds context support

  • Please try out the beta, even without trying contexts, as it helps Ned Batchelder to make sure it’s as backwards compatible as possible while still adding this super cool functionality.
  • Trying out contexts with pytest and pytest-cov:
(venv) $ pip install coverage==5.0b1
(venv) $ pip install pytest-cov
(venv) $ pytest --cov=foo --cov-context=test
(venv) $ coverage html --show-contexts
(venv) $ open htmlcov/index.html
  • results in coverage report that has little dropdowns on the right for lines that are covered, and what context they were covered.
  • For the example above, with pytest-cov, it shows what test caused each line to be hit.
  • Contexts can do way more than this. One example, split up different levels of tests, to see which lines are only hit by unit tests, indicating missing higher level tests, or the opposite.
  • The stored db could also possibly be mined to see how much overlap there is between tests, and maybe help with higher level tools to predict the harm or benefit from removing some tests.
  • I’m excited about the future, with contexts in place.
  • Even if you ignore contexts, please go try out the beta ASAP to make sure your old use model still works.

Michael #3: PSF is seeking developers for paid contract improving pip

  • via Brian Rutledge
  • The Python Software Foundation Packaging Working Group is receiving funding to work on the design, implementation, and rollout of pip's next-generation dependency resolver.
  • This project aims to complete the design, implementation, and rollout of pip's next-generation dependency resolver.
  • Lower the barriers to installing Python software, empowering users to get a version of a package that works.
  • It will also lower the barriers to distributing Python software, empowering developers to make their work available in an easily reusable form.
  • Because of the size of the project, funding has been allocated to secure two contractors, a senior developer and an intermediate developer, to work on development, testing and building test infrastructure, code review, bug triage, and assisting in the rollout of necessary features.
  • Total pay: Stage 1: $116,375, Stage 2: $103,700

Brian #4: dovpanda - Directions OVer PANDAs

  • Dean Langsam
  • “Directions are hints and tips for using pandas in an analysis environment. dovpanda is an overlay for working with pandas in an analysis environment.
  • "If you think your task is common enough, it probably is, and Pandas probably has a built-in solution. dovpanda is an overlay module that tries to understand what you are trying to do with your data, and help you find easier ways to write your code.”
  • “The main usage of dovpanda is its hints mechanism, which is very easy and works out-of-the-box. Just import it after you import pandas, whether inside a notebook or in a console.”
  • It’s like training wheels for pandas to help you get the most out of pandas and learn while you are doing your work. Very cool.

Michael #5: removestar

  • via PyCoders newsletter
  • Tool to automatically replace 'import *' in Python files with explicit imports
  • Report only mode and modify in place mode.

Brian #6: pytest-quarantine : Save the list of failing tests, so that they can be automatically marked as expected failures on future test runs.

  • Brian Rutlage
  • Really nice email from Brian:
  • >"Hi Brian! We've met a couple times at PyCon in Cleveland. Thanks for your podcasts, and your book. I've gone from being a complete pytest newbie, to helping my company adopt it, to writing a plugin. The plugin was something I developed at work, and they let me open-source it. I wanted to share it with you as a way of saying "thank you", and because you seem to be a bit of connoisseur of pytest plugins. ;)"
  • Here it is:
  • pytest has a cool feature called xfail, to allow you to mark tests you know fail.
  • pytest-quarantine allows you to run your suite and generate a file of all failures, then use that to mark the xfails.
    • Then you or your team can chip away at these failures until you get rid of them.
    • But in the meantime, your suite can still be useful for finding new failures.
    • And, the use of an external file to mark failures makes it so you don’t have to edit your test files to mark the tests that are xfail.


MK: Our infrastructure is fully carbon neutral!


A cop pulls Dr. Heisenberg over for speeding. The officer asks, "Do you know how fast you were going?" Heisenberg pauses for a moment, then answers, "No, but I know where I am.” [1]

  1. See Uncertainty principle, also called Heisenberg uncertainty principle or indeterminacy principle, statement, articulated (1927) by the German physicist Werner Heisenberg, that the position and the velocity of an object cannot both be measured exactly, at the same time, even in theory.

Nov 20 2019



Rank #2: #161 Sloppy Python can mean fast answers!

Podcast cover
Read more

Sponsored by 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
    • stripe to sheets automation
    • urlify
    • tons of reporting
    • wakeup - to get 100 on Lighthouse
    • deploy (on my servers)
    • creating import data for video courses
    • measuring duration of audio files

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:
    • uvicorn: ASGI server.
    • Starlette: ASGI framework.
    • TypeSystem: data validation and form rendering
    • Databases: async database library.
    • orm: asynchronous ORM.
    • HTTPX: async HTTP client w/ support for calling ASGI apps (useful as a test client).

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:

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 [

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




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.”

Dec 18 2019



Rank #3: #153 Auto format my Python please!

Podcast cover
Read more

Sponsored by DigitalOcean:

Michael #1: Building a Python C Extension Module

  • Tutorial, learn to use the Python API to write Python C extension modules.
  • And
    • Invoke C functions from within Python
    • Pass arguments from Python to C and parse them accordingly
    • Raise exceptions from C code and create custom Python exceptions in C
    • Define global constants in C and make them accessible in Python
    • Test, package, and distribute your Python C extension module
  • Extending Your Python Program
    • there may be other lesser-used system calls that are only accessible through C
  • Steps: Writing a Python Interface in C
    • Figure out the arguments (e.g. int fputs(const char *, FILE *) )
    • Implement in C:
#include Python.h
static PyObject *method_fputs(PyObject *self, PyObject *args) {
char *str, *filename = NULL;
int bytes_copied = -1;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "ss", &str, &filename)) {
return NULL;
FILE *fp = fopen(filename, "w");
bytes_copied = fputs(str, fp);
return PyLong_FromLong(bytes_copied);
  • In line 2, you declare the argument types you wish to receive from your Python code
  • line 6, then you’ll see that PyArg_ParseTuple() copies into the char*’s
  • Write regular C code (fopen, fputs)
  • Return: PyLong_FromLong() creates a PyLongObject, which represents an integer object in Python.
  • a few extra functions that are necessary
    • write definitions of your module and the methods it contains
    • Before you can import your new module, you first need to build it. You can do this by using the Python package distutils.

Brian #2: What’s New in Python 3.8 -

We’ve already talked about the big hitters:

  • assignment expressions, (the walrus operator)
  • positional only parameters, (the / in the param list)
  • f-strings support = for self-documenting expressions and debugging

There are a few more goodies I wanted to quickly mention:

  • More async: python -m asyncio launches a native async REPL
  • More helpful warnings and messages when
    • using is and is not to compare strings and integers and other types intended to be compared with == and !=
    • Missing the comma in stuff like [(1,2) (3,4)]. Happens all the time with parametrized testing
  • you can do iterable unpacking in a yield or return statement
    • x = (1, 2, 3)
    • a, *b = x
    • return a, *b <- this used to be a syntax error
      • you had to do return (a, *b)
  • New module importlib.metadata lets you access things like version numbers or dependent library required version numbers, and cool stuff like that.

Michael #3: UK National Cyber Security Centre (NCSC) is warning developers of the risks of sticking with Python 2.7, particularly for library writers

  • NCSC likens companies continuing to use Python 2 past its EOL to tempting another WannaCry or Equifax incident.
    • Equifax details: a vulnerability, dubbed CVE-2017-5638, was discovered in Apache Struts, an open source development framework for creating enterprise Java applications that Equifax, along with thousands of other websites, uses…
  • Quote: "If you're still using 2.x, it's time to port your code to Python 3," the NCSC said. "If you continue to use unsupported modules, you are risking the security of your organisation and data, as vulnerabilities will sooner or later appear which nobody is fixing."
  • Moreover: "If you maintain a library that other developers depend on, you may be preventing them from updating to 3," the agency added. "By holding other developers back, you are indirectly and likely unintentionally increasing the security risks of others.”
  • "If migrating your code base to Python 3 is not possible, another option is to pay a commercial company to support Python 2 for you," the NCSC said.
  • NCSC: If you don't migrate, you should expect security incidents
  • Python's popularity makes updating code imperative: The reason the NCSC is warning companies about Python 2's impending EOL is because of the language's success.

Brian #4: Pythonic News

  • Sebastian A. Steins
  • “A Hacker News lookalike written in Python/Django”
  • “ powering"
  • Cool that it’s open source, and on github
  • Was submitted to us by Sebastian, and a few others too, so there is excitement.
  • It’s like 6 days old and has 153 stars on github, 4 contributors, 18 forks.
  • Fun.

Michael #5: Deep Learning Workstations, Servers, Laptops, and GPU Cloud

  • GPU-accelerated with TensorFlow, PyTorch, Keras, and more pre-installed. Just plug in and start training. Save up to 90% by moving off your current cloud and choosing Lambda.
  • They offer:
    • TensorBook: GPU Laptop for $2,934
    • Lambda Quad: 4x GPU Workstation for $21,108 (yikes!)
    • All in: Lambda Hyperplane: 8x Tesla V100 Server, starting at $114,274
  • But compare to:
    • AWS EC2: p3.8xlarge @ $12.24 per Hour => $8,935 / month

Brian #6: Auto formatters for Python

  • A comparison of autopep8, yapf, and black
  • Auto formatters are super helpful for teams. They shut down the unproductive arguments over style and make code reviews way more pleasant. People can focus on content, not being the style police.
  • We love black. But it might be a bit over the top for some people. Here are a couple of other alternatives.
  • autopep8 - mostly focuses on PEP8
    • “autopep8 automatically formats Python code to conform to the PEP 8 style guide. It uses the pycodestyle utility to determine what parts of the code needs to be formatted. autopep8 is capable of fixing most of the formatting issues that can be reported by pycodestyle.”
  • black - does more
    • doesn’t have many options, but you can alter line length, can turn of string quote normalization, and you can limit or focus the files it sees.
    • does a cool “check that the reformatted code still produces a valid AST that is equivalent to the original.” but you can turn that off with --fast
  • yapf - way more customizable.
    • Great if you want to auto format to a custom style guide.
    • “The ultimate goal is that the code YAPF produces is as good as the code that a programmer would write if they were following the style guide. It takes away some of the drudgery of maintaining your code.”
  • Article is cool in that it shows some sample code and how it’s changed by the different formatters.



  • New courses coming
  • Financial Aid Launches for PyCon US 2020!


  • American Py Song

  • From Eric Nelson:

    • Math joke. “i is as complex as it gets. jk.”

Oct 23 2019



Rank #4: #154 Code, frozen in carbon, on display for all

Podcast cover
Read more

Sponsored by Datadog:

Special guest: Bob Belderbos

Brian #1: Lesser Known Coding Fonts

  • Interesting examination of some coding fonts.
  • Link to a great talk called Cracking the Code, by Jonathan David Ross, about coding fonts and Input.

I’m trying out Input Mono right now, and quite like it.

Bob #2: Django Admin Handbook

Michael #3: Your Guide to the CPython Source Code

  • Let’s talk about exploring the CPython code
  • You’ll want to get the code: git clone
  • Compile the code (Anthony gives lots of steps for macOS, Windows, and Linux)
  • Structure:

├── Doc ← Source for the documentation
├── Grammar ← The computer-readable language definition
├── Include ← The C header files
├── Lib ← Standard library modules written in Python
├── Mac ← macOS support files
├── Misc ← Miscellaneous files
├── Modules ← Standard Library Modules written in C
├── Objects ← Core types and the object model
├── Parser ← The Python parser source code
├── PC ← Windows build support files
├── PCbuild ← Windows build support files for older Windows versions
├── Programs ← Source code for the python executable and other binaries
├── Python ← The CPython interpreter source code
└── Tools ← Standalone tools useful for building or extending Python
  • Some cool “hidden” goodies. For example, check out Lib/concurrent/futures/, it comes with a cool ascii diagram of the process.
  • Lots more covered, that we don’t have time for
    • The Python Interpreter Process
    • The CPython Compiler and Execution Loop
    • Objects in CPython
    • The CPython Standard Library
    • Installing a custom version

Brian #4: Six Django template tags not often used in tutorials

  • Here’s a few:
    • {% empty %}, for use in for loops when the array is empty
    • {% lorem \[count\] [method] [random] %} for automatically filling with Lorem Ipsum text.
    • {% verbatim %} … {% endverbatim %}, stop the rendering engine from trying to parse it and replace stuff.

Bob #5: Beautiful code snippets with Carbon

  • Beautiful images, great for teaching Python / programming.
  • Used by a lot of developer, nice example I spotted today.
  • Supports typing and drag and drop, just generated this link by dropping a test module onto the canvas!
  • Great to expand Twitter char limit (we use it to generate Python Tip images).
  • Follow the project here, seems they now integrate with Github.

Michael #6: Researchers find bug in Python script may have affected hundreds of studies

  • More info via Mike Driscoll at Thousands of Scientific Papers May be Invalid Due to Misunderstanding Python
  • In a paper published October 8, researchers at the University of Hawaii found that a programming error in a set of Python scripts commonly used for computational analysis of chemistry data returned varying results based on which operating system they were run on.
  • Scientists did not understand that Python’s glob.glob() does not return sorted results
  • Throwing doubt on the results of more than 150 published chemistry studies.
  • the researcher were trying to analyze results from an experiment involving cyanobacteria discovered significant variations in results run against the same nuclear magnetic resonance spectroscopy (NMR) data.
  • The scripts, called the "Willoughby-Hoye" scripts after their creators, were found to return correct results on macOS Mavericks and Windows 10. But on macOS Mojave and Ubuntu, the results were off by nearly a full percent.
  • The module depends on the operating system for the order in which the files are returned. And the results of the scripts' calculations are affected by the order in which the files are processed.
  • The fix: A simple list.sort()!
  • Williams said he hopes the paper will get scientists to pay more attention to the computational side of experiments in the future.


Working on: PyBites platform: added flake8/ black code formatting, UI enhancements.



  • Q: What did the Network Administrator say when they caught a nasty virus?
  • A: It hurts when IP

Oct 29 2019



Rank #5: #150 Winning the Python software interview

Podcast cover
Read more

Sponsored by Datadog:

Michael #1: How to Stand Out in a Python Coding Interview

  • Real Python, by James Timmins
  • Are tech interviews broken? Well at least we can try to succeed at them anyway
  • You’ve made it past the phone call with the recruiter, and now it’s time to show that you know how to solve problems with actual code…
  • Interviews aren’t just about solving problems: they’re also about showing that you can write clean production code. This means that you have a deep knowledge of Python’s built-in functionality and libraries.
  • Things to learn
    • Use enumerate() to iterate over both indices and values
    • Debug problematic code with breakpoint()
    • Format strings effectively with f-strings
    • Sort lists with custom arguments
    • Use generators instead of list comprehensions to conserve memory
    • Define default values when looking up dictionary keys
    • Count hashable objects with the collections.Counter class
    • Use the standard library to get lists of permutations and combinations

Brian #2: The Python Software Foundation has updated its Code of Conduct

  • There’s now one code of conduct for PSF and PyCon US and other spaces sponsored by the PSF
  • This includes some regional conferences, such as PyCascades, and some meetup groups, (ears perk up)
  • The docs
  • Do we need to care?
    • all of us, yes. If there weren’t problems, we wouldn’t need these.
    • attendees, yes. Know before you go.
    • organizers, yes. Better to think about it ahead of time and have a plan than have to make up a strategy during an event if something happens.
    • me, in particular, and Michael. Ugh. yes. our first meetup is next month. I’d like to be in line with the rest of Python. So, yep, we are going to have to talk about this and put something in place.

Michael #3: The Interview Study Guide For Software Engineers

Brian #4: re-assert : “show where your regex match assertion failed”

  • Anthony Sotille
  • re-assert provides a helper class to make assertions of regexes simpler.”
  • The Matches objects allows for useful pytest assertion messages
  • In order to get my head around it, I looked at the test code:
def test_match_old():
> assert re.match('foo', 'fob')
E AssertionError: assert None
E + where None = [HTML_REMOVED]('foo', 'fob')
E + where [HTML_REMOVED] = re.match AssertionError
____________ test_match_new ___________________

def test_match_new():
> assert Matches('foo') == 'fob'
E AssertionError: assert Matches('foo') ^ == 'fob'
E -Matches('foo')
E - # regex failed to match at:
E - #
E - #> fob
E - # ^
E +'fob'

Michael #5: awesome-python-typing

Brian #6: Developer Advocacy: Frequently Asked Questions

  • Dustin Ingram
  • I know a handful of people who have this job title. What is it?
  • disclaimer: Dustin is a DA at Google. Other companies might be different
  • What is it?
    • “I help represent the Python community at [company]"
    • “part of my job is to be deeply involved in the Python community.”
    • working on projects that help Python, PyPI, packaging, etc.
    • speaking at conferences
    • talking to people. customers and non-customers
    • talking to product teams
    • being “user zero” for new products and features
    • paying attention to places users might raise issues about products
    • working in open source
    • creating content for Python devs
    • being involved in the community as a company rep
    • representing Python in the company
    • coordinating with other DAs
  • Work/life?

    • Not all DAs travel all the time. that was my main question.
  • Talk Python episode: War Stories of the Developer Evangelists





Web Dev Merit Badges

Oct 05 2019



Rank #6: #156 All the programming LOLs

Podcast cover
Read more

Sponsored by DigitalOcean:

Special guests:

Dan #1: Why You Should Use python -m pip

Cecil #2: Visual Studio Online: Web-Based IDE & Collaborative Code Editor

Michael #3: Python Adopts a 12-month Release Cycle

  • The long discussion on changing the Python project's release cadence has come to a conclusion: the project will now be releasing new versions on an annual basis.
  • Described in PEP 602
  • The steering council thinks that having a consistent schedule every year when
  • we hit beta, RC, and final it will help the community:
    • Know when to start testing the beta to provide feedback
    • Known when the expect the RC so the community can prepare their projects for the final release
    • Know when the final release will occur to coordinate their own releases (if necessary) when the final release of Python occurs
    • Allow core developers to more easily plan their work to make sure work lands in the release they are targeting
    • Make sure that core developers and the community have a shorter amount of time to wait for new features to be released

Dan #4: Black 19.10b0 Released — stable release coming soon

Cecil 5: Navigating code on GitHub

Michael #6: lolcommits: selfies for software developers.

  • lolcommits takes a snapshot with your webcam every time you git commit code, and archives a lolcat style image with it. git blame has never been so much fun.
  • Infinite uses: Animate your progress through a project and watch as you age. See what you looked like when you broke the build. Keep a joint lolrepository for your entire company.
  • Plugins: Lolcommits allows a growing list of plugins to perform additional work on your lolcommit image after capturing.
  • Animate: Configure lolcommits to generate an animated GIF with each commit for extra lulz!







Nov 15 2019



Rank #7: #146 Slay the dragon, learn the Python

Podcast cover
Read more

Sponsored by DigitalOcean:

Special guest: Trey Hunner

Brian #1: Positional-only arguments in Python

  • by Sanket
  • Feature in 3.8
  • “To specify arguments as positional-only, a / marker should be added after all those arguments in the function definition. “
  • Great example of a pow(x, y, /, mod=None) function where the names x and y are meaningless and if given in the wrong order would be confusing.

Trey #2: django-stubs

  • Type checking for Django!
  • It’s new and from my very quick testing on my Django site it definitely doesn’t work with everything yet, but it’s promising
  • I don’t use type annotations in Django yet, but I very well might eventually

Michael #3: CodeCombat

  • Super fun game for learning to code
  • Real code but incredibly easy coding
  • Can subscribe or use the free tier
  • Just got $6M VC funding

Brian #4: Four Use Cases for When to Use Celery in a Flask Application

  • or really any web framework
  • by Nick Janetakis
  • “Celery helps you run code asynchronously or on a periodic schedule which are very common things you'd want to do in most web projects.”
  • examples:
    • sending emails out
    • connecting to 3rd party APIs.
    • performing long running tasks. Like, really long.
    • Running tasks on a schedule.

Trey #5: pytest-steps

  • Created by smarie
  • Can use a generator syntax with yield statements to break a big test up into multiple named “steps” that’ll show up in your pytest output
  • If one step fails, the rest of the steps will be skipped by default
  • You can also customize it to make optional steps, which aren’t required for future steps to run, or steps which depend on other optional steps explicitly
  • The documentation shows a lot of different ways to use it, but the generator approach looks by far the most readable to me (also state is shared between steps with this approach whereas the others require some fancy state-capturing object which looks confusing to me)
  • I haven’t tried this, but my use case would be my end-to-end/functional tests, which would work great with steps because I’m often using Selenium to navigate between a number of different pages and forms, one click at a time.

Michael #6: docassemble

  • Created by Jonathan Pyle
  • A free, open-source expert system for guided interviews and document assembly, based on Python, YAML, and Markdown.
  • Features
    1. WYSIWYG: Compose your templates in .docx (with help of a Word Add-in) or .pdf files.
    2. Signatures: Gather touchscreen signatures and embed them in documents.
    3. Live chat: Assist users in real time with live chat, screen sharing, and remote screen control.
    4. AI: Use machine learning to process user input.
    5. SMS: Send text messages to your users
    6. E-mail: Send and receive e-mails in your interviews.
    7. OCR: Use optical character recognition to process images uploaded by the user.
    8. Multilingual: Offer interviews in multiple languages.
    9. Multiuser: Develop applications that involve more than one user, such as mediation or counseling interviews.
    10. Extensible: Use the power of Python to extend the capabilities of your interviews.
    11. Open: Package your interviews and use GitHub and PyPI to share your work with the docassemble user community.
    12. Background Tasks: Do things behind the scenes of the interview, even when the user is not logged in.
    13. Scalable: Deploy your interviews on multiple machines to handle high traffic.
    14. Secure: Protect user information with server-side encryption, two-factor authentication, document redaction, and other security features.
    15. APIs: Integrate with third-party applications using the API, or send your interviews input and extract output using code.




via Avram Lubkin

Knock! Knock!
Who's there?
Recursive function.
Recursive function who?
Knock! Knock!

Nice. to get that joke, you’ll have to understand recursion.
to understand recursion,

  • either google “recursion”, and click on “did you mean “recursion””
  • learn it in small steps. step one, recursion

text conversation:

  • first person: “Hey, what’s your address?”
  • second: gives IP address
  • first: “No. Your local address”
  • second:
  • first: “No. Your physical address”
  • second: gives MAC address

Sep 08 2019



Rank #8: #162 Retrofitting async and await into Django

Podcast cover
Read more

Sponsored by DataDog:

Special guest: Aly

Aly #1: Andrew Godwin - Just Add Await: Retrofitting Async into Django — DjangoCon 2019

  • Andrew is leading the implementation of asynchronous support for Django
  • Overview of Async Landscape
    • How synchronous and asynchronous code interact
    • Async functions are different than sync functions which makes it hard to design APIs
  • Difficulties in adding Async support to Django
    • Django is a project that a lot of people are familiar with; it’s new async implementation also needs to feel familiar
  • Plan was Implement async capabilities in three phases
  • Phase 1: ASGI Support (Django 3.0)
    • This phase lays the groundwork for future changes
    • ORM is async-aware: using it from async code raises a SynchronousOnlyOperation exception
  • Phase 2: Async Views, Async Handlers, and Async Middleware (Django 3.1)
    • Add async capabilities for the core part of the request path
    • There is a branch where things are mostly working, just need to fix a couple of tests
  • Phase 3: Async ORM (Django 3.2 / 4.0)
    • Largest, most difficult and most unbounded part of the project
    • ORM queries can result in lots of database lookups; have to be careful here
  • Async Project Wiki - project status, find out how to contribute

Brian #2: gamesbyexample

  • Al Sweigart
  • “PythonStdioGames : A collection of games (with source code) to use for example programming lessons. Written in Python 3. Click on the src folder to view all of the programs.”
  • I first learned programming by modifying games written by others and seeing what the different parts do when I change them. For me it was Lunar Lander on a TRS-80, and it took forever to type in the listing from the back of a magazine.
  • But now, you can just clone a repo and play with existing files.
  • Cool features:
    • They're short, with a limit of 256 lines of code.
    • They fit into a single source code file and have no installer.
    • They only use the Python standard library.
    • They only use stdio text; print() and input() in Python.
    • They're well commented.
    • They use as few programming concepts as possible. If classes, list comprehensions, recursion, aren't necessary for the program, then they are't used.
    • Elegant and efficient code is worthless next to code that is easy to understand and readable. These programs are for education, not production. Standard best practices, like not using global variables, can be ignored to make it easier to understand.
    • They do input validation and are bug free.
    • All functions have docstrings.
  • There’s also a todo list if people want to help out.

Aly #3: Bulwark

  • Open-source library that allows users to property test pandas DataFrames
    • Goal is to make it easy for data analysts and data scientists to write tests
  • Tests around data are different; they are not deterministic, they requires us to think about testing in a different way
    • With property tests, we can check an object has a certain property
  • Property tests for DataFrames includes validating the shape of the DataFrame, checking that a column is within a certain range, verifying a DataFrame has no NaNs, etc
  • Bulwark allows you to implement property tests as checks. Each check
    • Takes a DataFrame and optional arguments
    • The check will make an assertion about a DataFrame property
    • If the assertion passes, the check will return the original, unaltered DataFrame
    • If the check fails, an AssertionError is raised and you have context around why it failed
  • Bulwark also allows you to implement property checks as decorators
    • This is useful if you design data pipelines as functions
      • Each function take in input data, performs an action, returns output
    • Add decorators validate properties of input DataFrame to pipeline functions
  • Lots of builtin checks and decorators; easy to add your own
  • Slides with example usage and tips: Property Testing with Pandas with Bulwark

Brian #4: Poetry 1.0.0

  • Sebastien Eustace
  • caution: not backwards compatible
  • full change log
  • Highlights:
    • Poetry is getting serious.
    • more ways to manage environments
      • switch between python versions in a project with poetry env use /path/to/python
      • or poetry env use python3.7
    • Imroved support for private indices (instead of just pypi)
      • can specify index per dependency
      • can specify a secondary index
      • can specify a non-pypi index as default, avoiding pypi
    • Env variable support to more easily work with poetry in a CI environment
    • Improved add command to allow for constraints, paths, directories, etc for a dependency
    • publishing allows api tokens
    • marker specifiers on dependencies.

Aly #5: Kubernetes for Full-Stack Developers

  • With the rise of containers, Kubenetes has become the defacto platform for running and coordinating containerized applications across multiple machines
  • With the rise of containers, Kubenetes is the defacto platform for running and coordinating applications across multiple machines
  • This guide follows steps new users would take when learning how to deploy applications to Kubernetes:
    • Learn Kubernetes core concepts
    • Build modern 12 Factor web applications
    • Get applications working inside of containers
    • Deploy applications to Kubernetes
    • Manage cluster operations
  • New to containers? Check out my Introduction to Docker talk

Brian #6: testmon: selects tests affected by changed files and methods

  • On a previous episode (159) we mentioned pytest-picked and I incorrectly assumed it would run tests related to code that has changed, ‘cause it says “Run the tests related to the unstaged files or the current branch (according to Git)”.
  • I was wrong, Michael was right. It runs the tests that are in modified test files.
  • What I was thinking of is “testmon” which does what I was hoping for.
    • “pytest-testmon is a pytest plugin which selects and executes only tests you need to run. It does this by collecting dependencies between tests and all executed code (internally using and comparing the dependencies against changes. testmon updates its database on each test execution, so it works independently of version control.”
  • If you had tried testmon before, like me, be aware that there have been significant changes in 1.0.0
  • Very cool to see continued effort on this project.



  • From Tyler Matteson
    • Two coroutines walk into a bar.
    • RuntimeError: 'bar' was never awaited.
  • From Ben Sandofsky
    • Q: How many developers on a message board does it take to screw in a light bulb?
    • A: “Why are you trying to do that?”

Jan 03 2020



Rank #9: #160 Your JSON shall be streamed

Podcast cover
Read more

Sponsored by DigitalOcean:

Brian #1: Type Hints for Busy Python Programmers

  • Al Sweigart, @AlSweigart
  • We’ve (Michael and myself, of course) convinced you that type hints might be a good thing to help reduce bugs or confusion or whatever. Now what?
  • Al’s got your back with this no nonsense guide to get you going very quickly.
  • Written as a conversation between a programmer and an type hint expert. Super short. Super helpful.
  • typing and mypy are the modules you need.
  • There are other tools, but let’s start there.
  • Doesn’t affect run time, so you gotta run the tool.
  • Gradually add, don’t have to do everything in one go.
  • Covers the basics
  • And then the “just after basics” stuff you’ll run into right away when you start, like:
    • Allowing a type and None: Union[int, NoneType]
    • Optional parameters
    • Shout out to Callable, Sequence, Mapping, Iterable, available in the documentation when you are ready for them later
  • Just really a great get started today guide.

Michael #2: auto-py-to-exe

  • A .py to .exe converter using a simple graphical interface built using Eel and PyInstaller in Python.
  • Using the Application
    1. Select your script location (paste in or use a file explorer)
      • Outline will become blue when file exists
    2. Select other options and add things like an icon or other files
    3. Click the big blue button at the bottom to convert
    4. Find your converted files in /output when complete
  • Short 3 min video.

Brian #3: How to document Python code with Sphinx

  • Moshe Zadka, @moshezadka
  • I’m intimidated by sphinx. Not sure why. But what I’ve really just wanted to do is to use it for this use of generating documentation of code based on the code and the docstrings. Many of the tutorials I’ve looked at before got me stuck somewhere along the way and I’ve given up. But this looks promising.
  • Example module with docstring shown.
  • Simple docs/index.rst, no previous knowledge of restructured text necessary.
  • Specifically what extensions do I need: autodoc, napolean, and viewcode
  • example docs/ that’s really short
  • setting up tox to generate the docs and the magic command like incantation necessary:
    • sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
  • That’s it. (well, you may want to host the output somewhere, but I can figure that out. )
  • Super simple. Awesome

Michael #4: Snek is a cross-platform PowerShell module for integrating with Python

  • via Chad Miars
  • Snek is a cross-platform PowerShell module for integrating with Python.
  • It uses the Python for .NET library to load the Python runtime directly into PowerShell.
  • Using the dynamic language runtime, it can then invoke Python scripts and modules and return the result directly to PowerShell as managed .NET objects.
  • Kind of funky syntax, but that’s PowerShell for you ;)
  • Even allows for external packages installed via pip

Brian #5:How to use Pandas to access databases

  • Irina Truong, @irinatruong
  • You can use pandas and sqlalchemy to easily slurp tables right out of your db into memory.
  • But don’t. pandas isn’t lazy and reads everything, even the stuff you don’t need.
  • This article has tips on how to do it right.
  • Recommendation to use the CLI for exploring, then shift to pandas and sqlalchemy.
  • Tips (with examples, not shown here):
    • limit the fields to just those you care about
    • limit the number of records with limit or by selecting only rows where a particular field is a specific value, or something.
    • Let the database do joins, even though you can do it in pandas
    • Estimate memory usage with small queries and .memory_usage().sum().
    • Tips on reading chunks and converting small int types into small pandas types instead of 64 bit types.

Michael #6: ijson — Iterative JSON parser with a standard Python iterator interface

  • Iterative JSON parser with a standard Python iterator interface
  • Most common usage is having ijson yield native Python objects out of a JSON stream located under a prefix. Here’s how to process all European cities:
// from:
"earth": {
"europe": [ ... ]

stream each entry in europe as item:

objects = ijson.items(f, 'earth.europe.item')
cities = (o for o in objects if o['type'] == 'city')
for city in cities:




  • Question: "What is the best prefix for global variables?"
  • Answer: #
  • via shinjitsu

  • A web developer walks into a restaurant. He immediately leaves in disgust as the restaurant was laid out in tables.

  • via shinjitsu

Dec 12 2019



Rank #10: #163 Meditations on the Zen of Python

Podcast cover
Read more

Sponsored by us! Support us by visiting [courses] and [book], or becoming a patron at

Brian #1: Meditations on the Zen of Python

  • Moshe Zadka
  • The Zen of Python is not "the rules of Python" or "guidelines of Python". It is full of contradiction and allusion. It is not intended to be followed: it is intended to be meditated upon.
  • Moshe give some of his thoughts on the different lines of the Zen of Python.
  • Full Zen of Python can be found here or in a REPL with import this
  • A few
    • Beautiful is better than ugly
      • Consistency helps. So black, flake8, pylint are useful.
      • “But even more important, only humans can judge what humans find beautiful. Code reviews and a collaborative approach to writing code are the only realistic way to build beautiful code. Listening to other people is an important skill in software development.”
    • Complex is better than complicated.
      • “When solving a hard problem, it is often the case that no simple solution will do. In that case, the most Pythonic strategy is to go "bottom-up." Build simple tools and combine them to solve the problem.”
    • Readability counts
      • “In the face of immense pressure to throw readability to the side and just "solve the problem," the Zen of Python reminds us: readability counts. Writing the code so it can be read is a form of compassion for yourself and others.”

Michael #2: nginx raided by Russian police

  • Russian police have raided today the Moscow offices of NGINX, Inc., a subsidiary of F5 Networks and the company behind the internet's most popular web server technology.
  • Russian search engine claims full ownership of NGINX code.
  • Rambler claims that Igor Sysoev developed NGINX while he was working as a system administrator for the company, hence they are the rightful owner of the project.
  • Sysoev never denied creating NGINX while working at Rambler. In a 2012 interview, Sysoev claimed he developed NGINX in his free time and that Rambler wasn't even aware of it for years.
  • Update
  • Promptly following the event we took measures to ensure the security of our master software builds for NGINX, NGINX Plus, NGINX WAF and NGINX Unit—all of which are stored on servers outside of Russia. No other products are developed within Russia. F5 remains committed to innovating with NGINX, NGINX Plus, NGINX WAF and NGINX Unit, and we will continue to provide the best-in-class support you’ve come to expect.

Brian #3: I'm not feeling the async pressure

  • Armin Ronacher
  • “Async is all the rage.” But before you go there, make sure you understand flow control and back pressure.
  • “…back pressure is resistance that opposes the flow of data through a system. Back pressure sounds quite negative … but it's here to save your day.”
  • If parts of your system are async, you have to make sure the entire flow throw the system doesn’t have overflow points.
  • An example shown with reader/writer that is way hairier than you’d think it should be.
  • “New Footguns: async/await is great but it encourages writing stuff that will behave catastrophically when overloaded.”
  • “So for you developers of async libraries here is a new year's resolution for you: give back pressure and flow control the importance they deserve in documentation and API.”

Michael #4: codetiming from Real Python

Brian #5: Making Python Programs Blazingly Fast

  • Martin Heinz
    • Seemed like a good followup to the last topic
  • Profiling with
  • How to make things faster:
    • use built in types over custom types
    • caching/memoization with lru_cache
    • use local variables and local aliases when looping
    • use functions… (kinda duh, but sure).
    • don’t repeatedly access attributes in loops
    • use f-strings over other formatting
    • use generators. or at least experiment with them.
      • the memory savings could result in speedup

Michael #6: LocalStack

  • via Graham Williamson and Jan 'oglop' Gazda
  • A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!
  • LocalStack spins up the following core Cloud APIs on your local machine:
  • LocalStack builds on existing best-of-breed mocking/testing tools, most notably kinesalite/dynalite and moto. While these tools are awesome (!), they lack functionality for certain use cases. LocalStack combines the tools, makes them interoperable, and adds important missing functionality on top of them
  • Has lots of config and knobs, but runs in docker so that helps



Joke: Types of software jobs.

Jan 09 2020