Himalaya: Listen. Learn. Grow.

4.8K Ratings
Open In App
title

Python Bytes

Michael Kennedy and Brian Okken

97
Followers
470
Plays
Python Bytes

Python Bytes

Michael Kennedy and Brian Okken

97
Followers
470
Plays
OVERVIEWEPISODESYOU MAY ALSO LIKE

Details

About Us

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.

Latest Episodes

No dog-piling please (it's episode 200!)

Sponsored by us! Support our work through: Our courses at Talk Python Training Python Testing with pytest Brian #1: How to be helpful online Ned Batchelder When answering questions. Lots of great advice. We’ll focus on just a few here. Answer the question first. There may be other problems with their code that they are not asking about that you want to point out. But keep that for after you’ve helped them and built up trust. No third rails. “It should be OK for someone to ask for help with a program using sockets, and not have to defend using sockets, especially if the specific question has nothing to do with sockets.” Same for pickle, threads, globals, singletons, etc. Don’t let your strong opinions derail the conversation. The goal is to help people. Strong reactions can make the asker feel attacked. No dog-piling. Meet their level. “Try to determine what they know, and give them a reasonable next step, not the ultimate solution. A suboptimal solution they understand is better than a gold standard they can’t make use of.” Say yes. Avoid absolutes. Step back. Take some blame. Use more words. “IRC and other online mediums encourage quick short responses, which are exactly the kinds of responses that will be easy to misinterpret. Try to use more words, especially encouraging optimistic words.” Understand your motivations. Humility. Make connections. Finally: It’s hard. All of Ned’s advice is great. Good meditations for when you read a question and your mouth drops open and your eyes stare in shock. Michael #2: blackcellmagic IPython magic command to format python code in cell using black. Has a great animated gif ;) Just do: %load_ext blackcellmagic Then in any cell %%black and magic! Accepts “arguments” like %%black -l 79 Tobin Jones has been kind enough to develop a NPM package over blackcellmagic to format all cells at once which can be found here. But it’s archived so no idea whether it’s current. Brian #3: Test smarter, not harder Luke Plant There’s lots of great advice in here, but I want to highlight two parts that are often overlooked. “Write your test code with the functions/methods/classes you wish existed, not the ones you’ve been given.” “If the API you want to use doesn’t exist yet, you still use it, and then make it exist.” This is huge. People tend to think like this while coding, but forget to do it while testing. Also. Your tests are often the first client for your API, so if the API in question is under your control and you need an easier API for testing, consider adding it to the real API. If it’s easier for testing, it may be easier for other clients of the API as well. “Only write necessary tests — specifically, tests whose estimated value is greater than their estimated cost. This is a hard judgement call, of course, but it does mean that at least some of the time you should be saying “it’s not worth it”.” Michael #4: US: The Greatest Package in the World by Jeremy Carbaugh A package for easily working with US and state metadata: all US states and territories postal abbreviations Associated Press style abbreviations FIPS codes capitals years of statehood time zones phonetic state name lookup is contiguous or continental URLs to shapefiles for state, census, congressional districts, counties, and census tracts The state lookup method allows matching by FIPS code, abbreviation, and name Even a CLI: $ states md Brian #5: Think Like A Coder Part of TED-Ed “… a 10-episode series that will challenge viewers with programming puzzles as the main characters— a girl and her robot companion— attempt to save a world that has been plunged into turmoil.” Although, I only count 9 episodes, I was 4 episodes in and hooked. Main cool thing, I think, is introducing terms and topics so they will be familiar when someone really does start coding: loops, for loops, until loops, while loops conditionals variables path logic permutations searches tables recursion Big O Also highly recommended for getting excited about c

32 min6 d ago
Comments
No dog-piling please (it's episode 200!)

Big news for a very small Python runtime

Sponsored by us! Support our work through: Our courses at Talk Python Training Python Testing with pytest Michael #1: micropython updated via Matt Trentini v1.13 is packed with features and bugfixes including solid asyncio support and tasty BLE improvements. Heck, we've even got the walrus operator. a new implementation of the uasyncio module which aims to be more compatible with CPython's asyncio module. The main change is to use a Task object for each coroutine, allowing more flexibility to queue tasks in various places, eg the main run loop, tasks waiting on events, locks or other tasks. It no longer requires pre-allocating a fixed queue size for the main run loop. Most code in this repository is now auto-formatted using uncrustify for C code and Black for Python code. BlueKitchen BTstack bindings have been added for the ubluetooth module, as an optional alternative to the NimBLE stack. The unix port can now be built with BLE support using these bindings Other Bluetooth additions...

29 min2 w ago
Comments
Big news for a very small Python runtime

There's a beaver in your database and Anna-Lena drops by

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Special guest: Anna-Lena Popkes Brian #1: Easily create Python scripts using argparse Back in the day, when I was writing most of my utility scripts in bash, I’d keep around an example.bash file with different types of arguments and flags and control structures, etc to use as a template for new scripts. Python has the same problem, or worse, if you use the built in argparse instead of something like click or typer. However, there are many times where you don’t want to have any external dependencies on a script, so built in argparse it is. But I definitely relate to this tweet: “Every time I write a python script, I have to go back to an old script of mine to remember how to set up argparse. For some reason it just does not stick in my mind AT ALL.” - Joshua Schraiber Well, then steps in Ken Youens-Clark with a little utility called new.py. It’s not pip install-able, so you gotta c...

34 min2 w ago
Comments
There's a beaver in your database and Anna-Lena drops by

Structured concurrency in Python

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Michael #1: Structured concurrency in Python with AnyIO AnyIO is a Python library providing structured concurrency primitives on top of asyncio. Structured concurrency is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by using a structured approach to concurrent programming. The core concept is the encapsulation of concurrent threads of execution (here encompassing kernel and userland threads and processes) by way of control flow constructs that have clear entry and exit points and that ensure all spawned threads have completed before exit. — Wikipedia The best overview is Notes on structured concurrency by Nathaniel Smith (or his video if you prefer). Python has three well-known concurrency libraries built around the async/await syntax: asyncio, Curio, and Trio. (WHERE IS unsync?!?! ) Since it's the default, the overwhelming...

36 min3 w ago
Comments
Structured concurrency in Python

Version your SQL schemas with git + automatically migrate them

Sponsored by Datadog: pythonbytes.fm/datadog Brian #1: Surviving Django (if you care about databases) Daniele Varazzo Hard to summarize, but this is an interesting perspective on getting to know your database better and using database migrations and database schemas, etc. instead of relying on Django’s seemingly agnostic view of databases. Following the article is a nice civilized discussion in the comments between the author, Paolo Melchiorre, Andrew Godwin, and others. Interesting comment by Andrew: “I agree that at some point in a project/company's life, if it's big enough, SQL migrations are the way to go. … Migrations in the out-of-the-box state are mostly there to supplement rapid prototyping, and then like a lot of Django, can be removed/ignored progressively if and when you outgrow the single set of design constraints we had to choose for them.” Michael #2: Python Numbers and the Flyweight design pattern Working on allocation and other memory internals from my upcoming P...

31 minAUG 27
Comments
Version your SQL schemas with git + automatically migrate them

Runtime type checking for Python type hints

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Michael #1: watchdog via Prayson Daniel Python API and shell utilities to monitor file system events. Example: observer = Observer() observer.schedule(event_handler, path, recursive=True) observer.start() Watchdog comes with an optional utility script called watchmedo try $ watchmedo log and see what happens in that folder. Why Watchdog? Compared to other similar libs Brian #2: Status code 418 Thanks Andy Howe for the suggestion Python 3.9 rc1 is out. One nice enhancement that has made it into 3.9, a fix for http library missing HTTP status code 418 “I’m a teapot”. https://bugs.python.org/issue39507 Title: http library missing HTTP status code 418 "I'm a teapot" See also status code 418 is also supported by HTCPCP, Hyper Text Coffee Pot Control Protocol, https://tools.ietf.org/html/rfc2324 418 I'm a teapot Any attempt to brew coffee with a teapot should result in the error code "418...

33 minAUG 18
Comments
Runtime type checking for Python type hints

Events and callbacks in the Python language!

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Brian #1: An introduction to mutation testing in Python Moshe Zadka This article uses mutmut, but there are other mutation testing packages. The example shows 3 methods, and one test case that actually hits 100% code coverage. The mutmut is used and finds 16 surviving mutants. “Mutation testing algorithmically modifies source code and checks if any "mutants" survived each test. Any mutant that survives the unit test is a problem: it means that a modification to the code, likely introducing a bug, was not caught by the standard test suite.” “For each mutation test, mutmut modified portions of your source code that simulates potential bugs. An example of a modification is changing a > comparison to >= to see what happens. If there is no unit test for this boundary condition, this mutation will "survive": this is a potential bug that none of the tests will detect.” Cool example of how...

28 minAUG 10
Comments
Events and callbacks in the Python language!

Break out the Django testing toolbox

Sponsored by us! Support our work through: Our courses at Talk Python Training Brian’s pytest book Brian #1: Start using pip install --use-feature=2020-resolver if you aren’t already Mathew Feickert You may see something interesting when you run pip This is not a problem. Do not adjust your sets. But, you should be aware of it. Especially if you install from requirements generated with pip freeze, you’ll want to use --use-feature=2020-resolver everywhere: $ python -m pip install --use-feature=2020-resolver -r requirements_original.txt $ python -m pip freeze > requirements_lock.txt $ python -m pip install --use-feature=2020-resolver -r requirements_lock.txt Otherwise, you may run into issues see Example of --use-feature=2020-resolver breaking a pip freeze requirements.txt and Changes to the pip dependency resolver in 20.2 (2020) Michael #2: Profiling Python import statements Conversation with Brandon Braner lead to import-profiler A basic python import profiler to find bottlenecks...

34 minAUG 6
Comments
Break out the Django testing toolbox

Calculations by hand, but in the compter, with Handcalcs

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Brian #1: Building a self-updating profile README for GitHub Simon Willison, co-createor of Django “GitHub quietly released a new feature at some point in the past few days: profile READMEs. Create a repository with the same name as your GitHub account (in my case that’s github.com/simonw/simonw), add a README.md to it and GitHub will render the contents at the top of your personal profile page—for me that’s github.com/simonw” Simon takes it one further, and uses GitHub actions to keep the README up to date. Uses Python to: Grab recent releases from certain GH repos using GH GraphQL API Links to blog entries using feedparser Retrieve latest links using SQL queries Michael #2: Handcalcs Created by Connor Ferster In design engineering, you need to do lots of calculations and have those calculation sheets be kept as legal records as part of the project's design history. If they are n...

30 minAUG 2
Comments
Calculations by hand, but in the compter, with Handcalcs

Live from the Manning Python Conference

Special guest: Ines Montani Michael #1: VS Code Device Simulator Want to experiment with MicroPython? Teaching a course with little IoT devices? Circuit Playground Express BBC micro:bit Adafruit CLUE with a screen Get a free VS code extension that adds a high fidelity simulator Easily create the starter code (main.py) Interact with all the sensors (buttons, motion sensors, acceleration detection, device shake detection, etc.) Deploy and debug on a real device when ready Had the team over on Talk Python. Brian #2: pytest 6.0.0rc1 New features You can put configuration in pyproject.toml Inline type annotations. Most user facing API and internal code. New flags - --no-header - --no-summary - --strict-config : error on unknown config key - --code-highlight : turn on/off code highlighting in terminal Recursive comparison for dataclass and attrs Tons of fixes Improved documentation There’s a list of breaking changes and deprications. But really, nothing in the list seems like a big deal ...

52 minJUL 22
Comments
Live from the Manning Python Conference

Latest Episodes

No dog-piling please (it's episode 200!)

Sponsored by us! Support our work through: Our courses at Talk Python Training Python Testing with pytest Brian #1: How to be helpful online Ned Batchelder When answering questions. Lots of great advice. We’ll focus on just a few here. Answer the question first. There may be other problems with their code that they are not asking about that you want to point out. But keep that for after you’ve helped them and built up trust. No third rails. “It should be OK for someone to ask for help with a program using sockets, and not have to defend using sockets, especially if the specific question has nothing to do with sockets.” Same for pickle, threads, globals, singletons, etc. Don’t let your strong opinions derail the conversation. The goal is to help people. Strong reactions can make the asker feel attacked. No dog-piling. Meet their level. “Try to determine what they know, and give them a reasonable next step, not the ultimate solution. A suboptimal solution they understand is better than a gold standard they can’t make use of.” Say yes. Avoid absolutes. Step back. Take some blame. Use more words. “IRC and other online mediums encourage quick short responses, which are exactly the kinds of responses that will be easy to misinterpret. Try to use more words, especially encouraging optimistic words.” Understand your motivations. Humility. Make connections. Finally: It’s hard. All of Ned’s advice is great. Good meditations for when you read a question and your mouth drops open and your eyes stare in shock. Michael #2: blackcellmagic IPython magic command to format python code in cell using black. Has a great animated gif ;) Just do: %load_ext blackcellmagic Then in any cell %%black and magic! Accepts “arguments” like %%black -l 79 Tobin Jones has been kind enough to develop a NPM package over blackcellmagic to format all cells at once which can be found here. But it’s archived so no idea whether it’s current. Brian #3: Test smarter, not harder Luke Plant There’s lots of great advice in here, but I want to highlight two parts that are often overlooked. “Write your test code with the functions/methods/classes you wish existed, not the ones you’ve been given.” “If the API you want to use doesn’t exist yet, you still use it, and then make it exist.” This is huge. People tend to think like this while coding, but forget to do it while testing. Also. Your tests are often the first client for your API, so if the API in question is under your control and you need an easier API for testing, consider adding it to the real API. If it’s easier for testing, it may be easier for other clients of the API as well. “Only write necessary tests — specifically, tests whose estimated value is greater than their estimated cost. This is a hard judgement call, of course, but it does mean that at least some of the time you should be saying “it’s not worth it”.” Michael #4: US: The Greatest Package in the World by Jeremy Carbaugh A package for easily working with US and state metadata: all US states and territories postal abbreviations Associated Press style abbreviations FIPS codes capitals years of statehood time zones phonetic state name lookup is contiguous or continental URLs to shapefiles for state, census, congressional districts, counties, and census tracts The state lookup method allows matching by FIPS code, abbreviation, and name Even a CLI: $ states md Brian #5: Think Like A Coder Part of TED-Ed “… a 10-episode series that will challenge viewers with programming puzzles as the main characters— a girl and her robot companion— attempt to save a world that has been plunged into turmoil.” Although, I only count 9 episodes, I was 4 episodes in and hooked. Main cool thing, I think, is introducing terms and topics so they will be familiar when someone really does start coding: loops, for loops, until loops, while loops conditionals variables path logic permutations searches tables recursion Big O Also highly recommended for getting excited about c

32 min6 d ago
Comments
No dog-piling please (it's episode 200!)

Big news for a very small Python runtime

Sponsored by us! Support our work through: Our courses at Talk Python Training Python Testing with pytest Michael #1: micropython updated via Matt Trentini v1.13 is packed with features and bugfixes including solid asyncio support and tasty BLE improvements. Heck, we've even got the walrus operator. a new implementation of the uasyncio module which aims to be more compatible with CPython's asyncio module. The main change is to use a Task object for each coroutine, allowing more flexibility to queue tasks in various places, eg the main run loop, tasks waiting on events, locks or other tasks. It no longer requires pre-allocating a fixed queue size for the main run loop. Most code in this repository is now auto-formatted using uncrustify for C code and Black for Python code. BlueKitchen BTstack bindings have been added for the ubluetooth module, as an optional alternative to the NimBLE stack. The unix port can now be built with BLE support using these bindings Other Bluetooth additions...

29 min2 w ago
Comments
Big news for a very small Python runtime

There's a beaver in your database and Anna-Lena drops by

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Special guest: Anna-Lena Popkes Brian #1: Easily create Python scripts using argparse Back in the day, when I was writing most of my utility scripts in bash, I’d keep around an example.bash file with different types of arguments and flags and control structures, etc to use as a template for new scripts. Python has the same problem, or worse, if you use the built in argparse instead of something like click or typer. However, there are many times where you don’t want to have any external dependencies on a script, so built in argparse it is. But I definitely relate to this tweet: “Every time I write a python script, I have to go back to an old script of mine to remember how to set up argparse. For some reason it just does not stick in my mind AT ALL.” - Joshua Schraiber Well, then steps in Ken Youens-Clark with a little utility called new.py. It’s not pip install-able, so you gotta c...

34 min2 w ago
Comments
There's a beaver in your database and Anna-Lena drops by

Structured concurrency in Python

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Michael #1: Structured concurrency in Python with AnyIO AnyIO is a Python library providing structured concurrency primitives on top of asyncio. Structured concurrency is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by using a structured approach to concurrent programming. The core concept is the encapsulation of concurrent threads of execution (here encompassing kernel and userland threads and processes) by way of control flow constructs that have clear entry and exit points and that ensure all spawned threads have completed before exit. — Wikipedia The best overview is Notes on structured concurrency by Nathaniel Smith (or his video if you prefer). Python has three well-known concurrency libraries built around the async/await syntax: asyncio, Curio, and Trio. (WHERE IS unsync?!?! ) Since it's the default, the overwhelming...

36 min3 w ago
Comments
Structured concurrency in Python

Version your SQL schemas with git + automatically migrate them

Sponsored by Datadog: pythonbytes.fm/datadog Brian #1: Surviving Django (if you care about databases) Daniele Varazzo Hard to summarize, but this is an interesting perspective on getting to know your database better and using database migrations and database schemas, etc. instead of relying on Django’s seemingly agnostic view of databases. Following the article is a nice civilized discussion in the comments between the author, Paolo Melchiorre, Andrew Godwin, and others. Interesting comment by Andrew: “I agree that at some point in a project/company's life, if it's big enough, SQL migrations are the way to go. … Migrations in the out-of-the-box state are mostly there to supplement rapid prototyping, and then like a lot of Django, can be removed/ignored progressively if and when you outgrow the single set of design constraints we had to choose for them.” Michael #2: Python Numbers and the Flyweight design pattern Working on allocation and other memory internals from my upcoming P...

31 minAUG 27
Comments
Version your SQL schemas with git + automatically migrate them

Runtime type checking for Python type hints

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Michael #1: watchdog via Prayson Daniel Python API and shell utilities to monitor file system events. Example: observer = Observer() observer.schedule(event_handler, path, recursive=True) observer.start() Watchdog comes with an optional utility script called watchmedo try $ watchmedo log and see what happens in that folder. Why Watchdog? Compared to other similar libs Brian #2: Status code 418 Thanks Andy Howe for the suggestion Python 3.9 rc1 is out. One nice enhancement that has made it into 3.9, a fix for http library missing HTTP status code 418 “I’m a teapot”. https://bugs.python.org/issue39507 Title: http library missing HTTP status code 418 "I'm a teapot" See also status code 418 is also supported by HTCPCP, Hyper Text Coffee Pot Control Protocol, https://tools.ietf.org/html/rfc2324 418 I'm a teapot Any attempt to brew coffee with a teapot should result in the error code "418...

33 minAUG 18
Comments
Runtime type checking for Python type hints

Events and callbacks in the Python language!

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Brian #1: An introduction to mutation testing in Python Moshe Zadka This article uses mutmut, but there are other mutation testing packages. The example shows 3 methods, and one test case that actually hits 100% code coverage. The mutmut is used and finds 16 surviving mutants. “Mutation testing algorithmically modifies source code and checks if any "mutants" survived each test. Any mutant that survives the unit test is a problem: it means that a modification to the code, likely introducing a bug, was not caught by the standard test suite.” “For each mutation test, mutmut modified portions of your source code that simulates potential bugs. An example of a modification is changing a > comparison to >= to see what happens. If there is no unit test for this boundary condition, this mutation will "survive": this is a potential bug that none of the tests will detect.” Cool example of how...

28 minAUG 10
Comments
Events and callbacks in the Python language!

Break out the Django testing toolbox

Sponsored by us! Support our work through: Our courses at Talk Python Training Brian’s pytest book Brian #1: Start using pip install --use-feature=2020-resolver if you aren’t already Mathew Feickert You may see something interesting when you run pip This is not a problem. Do not adjust your sets. But, you should be aware of it. Especially if you install from requirements generated with pip freeze, you’ll want to use --use-feature=2020-resolver everywhere: $ python -m pip install --use-feature=2020-resolver -r requirements_original.txt $ python -m pip freeze > requirements_lock.txt $ python -m pip install --use-feature=2020-resolver -r requirements_lock.txt Otherwise, you may run into issues see Example of --use-feature=2020-resolver breaking a pip freeze requirements.txt and Changes to the pip dependency resolver in 20.2 (2020) Michael #2: Profiling Python import statements Conversation with Brandon Braner lead to import-profiler A basic python import profiler to find bottlenecks...

34 minAUG 6
Comments
Break out the Django testing toolbox

Calculations by hand, but in the compter, with Handcalcs

Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Brian #1: Building a self-updating profile README for GitHub Simon Willison, co-createor of Django “GitHub quietly released a new feature at some point in the past few days: profile READMEs. Create a repository with the same name as your GitHub account (in my case that’s github.com/simonw/simonw), add a README.md to it and GitHub will render the contents at the top of your personal profile page—for me that’s github.com/simonw” Simon takes it one further, and uses GitHub actions to keep the README up to date. Uses Python to: Grab recent releases from certain GH repos using GH GraphQL API Links to blog entries using feedparser Retrieve latest links using SQL queries Michael #2: Handcalcs Created by Connor Ferster In design engineering, you need to do lots of calculations and have those calculation sheets be kept as legal records as part of the project's design history. If they are n...

30 minAUG 2
Comments
Calculations by hand, but in the compter, with Handcalcs

Live from the Manning Python Conference

Special guest: Ines Montani Michael #1: VS Code Device Simulator Want to experiment with MicroPython? Teaching a course with little IoT devices? Circuit Playground Express BBC micro:bit Adafruit CLUE with a screen Get a free VS code extension that adds a high fidelity simulator Easily create the starter code (main.py) Interact with all the sensors (buttons, motion sensors, acceleration detection, device shake detection, etc.) Deploy and debug on a real device when ready Had the team over on Talk Python. Brian #2: pytest 6.0.0rc1 New features You can put configuration in pyproject.toml Inline type annotations. Most user facing API and internal code. New flags - --no-header - --no-summary - --strict-config : error on unknown config key - --code-highlight : turn on/off code highlighting in terminal Recursive comparison for dataclass and attrs Tons of fixes Improved documentation There’s a list of breaking changes and deprications. But really, nothing in the list seems like a big deal ...

52 minJUL 22
Comments
Live from the Manning Python Conference
success toast
Welcome to Himalaya LearningDozens of podcourses featuring over 100 experts are waiting for you.