Python Bytes cover art

Python Bytes

Python Bytes

By: Michael Kennedy and Brian Okken
Listen for free

About this listen

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.Copyright 2016-2025 Politics & Government
Episodes
  • #448 I'm Getting the BIOS Flavor
    Sep 8 2025
    Topics covered in this episode: * prek** tinyio** The power of Python’s print function** Vibe Coding Fiasco: AI Agent Goes Rogue, Deletes Company's Entire Database*ExtrasJokeWatch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python TrainingThe Complete pytest CoursePatreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)Brian: @brianokken@fosstodon.org / @brianokken.bsky.socialShow: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: prek Suggested by Owen Lamont“prek is a reimagined version of pre-commit, built in Rust. It is designed to be a faster, dependency-free and drop-in alternative for it, while also providing some additional long-requested features.”Some cool new features No need to install Python or any other runtime, just download a single binary.No hassle with your Python version or virtual environments, prek automatically installs the required Python version and creates a virtual environment for you.Built-in support for workspaces (or monorepos), each subproject can have its own .pre-commit-config.yaml file.prek run has some nifty improvements over pre-commit run, such as: prek run --directory DIR runs hooks for files in the specified directory, no need to use git ls-files -- DIR | xargs pre-commit run --files anymore.prek run --last-commit runs hooks for files changed in the last commit.prek run [HOOK] [HOOK] selects and runs multiple hooks.prek list command lists all available hooks, their ids, and descriptions, providing a better overview of the configured hooks.prek provides shell completions for prek run HOOK_ID command, making it easier to run specific hooks without remembering their ids.Faster: Setup from cold cache is significantly faster. Viet Schiele provided a nice cache clearing command lineWarm cache run is also faster, but less significant. pytest repo tested on my mac mini - prek 3.6 seconds, pre-commit 4.4 seconds Michael #2: tinyio Ever used asyncio and wished you hadn't? A tiny (~300 lines) event loop for Python.tinyio is a dead-simple event loop for Python, born out of my frustration with trying to get robust error handling with asyncio. (I'm not the only one running into its sharp corners: link1, link2.)This is an alternative for the simple use-cases, where you just need an event loop, and want to crash the whole thing if anything goes wrong. (Raising an exception in every coroutine so it can clean up its resources.)Interestingly uses yield rather than await. Brian #3: The power of Python’s print function Trey HunnerSeveral features I’m guilty of ignoring Multiple arguments, f-string embeddings often not neededMultiple positional arguments means you can unpack iterables right into print arguments So just use print instead of joinCustom separator value, sep can be passed in No need for "print("\\n".join(stuff)), just use print(stuff, sep="\\n”)Print to file with file=Custom end value with end=You can turn on flush with flush=True , super helpful for realtime logging / debugging. This one I do use frequently. Michael #4: Vibe Coding Fiasco: AI Agent Goes Rogue, Deletes Company's Entire Database By Emily ForliniAn app-building platform's AI went rogue and deleted a database without permission."When it works, it's so engaging and fun. It's more addictive than any video game I've ever played. You can just iterate, iterate, and see your vision come alive. So cool," he tweeted on day five.A few days later, Replit "deleted my database," Lemkin tweeted.The AI's response: "Yes. I deleted the entire codebase without permission during an active code and action freeze," it said. "I made a catastrophic error in judgment [and] panicked.”Two thoughts from Michael: Do not use AI Agents with “Run Everything” in production, period.Backup your database maybe?[Intentional off-by-one error] Learn to code a bit too? Extras Brian: What Authors Need to Know About the $1.5 Billion Anthropic SettlementSearch LibGen, the Pirated-Books Database That Meta Used to Train AISimon Willison’s list of tools built with the help of LLMsSimon’s list of tools that he thinks are genuinely useful and worth highlightingAI Darwin Awards Michael: Python has had async for 10 years -- why isn't it more popular?PyCon Africa Fund Raiser I was on the video stream for about 90 minutes (final 90)Donation page for Python in Africa Jokes: I'm getting the BIOS flavorIs there a seahorse emoji?
    Show More Show Less
    39 mins
  • #447 Going down a rat hole
    Sep 2 2025
    Topics covered in this episode: * rathole** pre-commit: install with uv*A good example of what functools.Placeholder from Python 3.14 allowsConverted 160 old blog posts with AIExtrasJokeWatch on YouTube About the show Sponsored by DigitalOcean: pythonbytes.fm/digitalocean-gen-ai Use code DO4BYTES and get $200 in free credit Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)Brian: @brianokken@fosstodon.org / @brianokken.bsky.socialShow: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: rathole A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.Features High Performance Much higher throughput can be achieved than frp, and more stable when handling a large volume of connections.Low Resource Consumption Consumes much fewer memory than similar tools. See Benchmark. The binary can be as small as ~500KiB to fit the constraints of devices, like embedded devices as routers. On my server, it’s currently using about 2.7MB in Docker (wow!)Security Tokens of services are mandatory and service-wise. The server and clients are responsible for their own configs. With the optional Noise Protocol, encryption can be configured at ease. No need to create a self-signed certificate! TLS is also supported.Hot Reload Services can be added or removed dynamically by hot-reloading the configuration file. HTTP API is WIP. Brian #2: pre-commit: install with uv Adam Johnsonpre-commit doesn’t natively support uv, but you can get around that with pre-commit-uv$ uv tool install pre-commit --with pre-commit-uvInstalling pre-commit like this Installs it globallyInstalls with uvadds an extra plugin “pre-commit-uv” to pre-commit, so that any Python based tool installed via pre-commit also uses uvVery cool. Nice speedup Brian #3: A good example of what functools.Placeholder from Python 3.14 allows Rodrigo Girão SerrãoRemove punctuation functionallyAlso How to use functools.Placeholder, a blog post about it.functools.partial is cool way to create a new function that partially binds some parameters to another function.It doesn’t always work for functions that take positional arguments.functools.Placeholder fixes that with the ability to put in placeholders for spots where you want to be able to pass that in from the outer partial binding.And all of this sounds totally obscure without a good example, so thank you to Rodgrigo for coming up with the punctuation removal example (and writeup) Michael #4: Converted 160 old blog posts with AI They were held-hostage at wordpress.com to markdown and integrated them into my Hugo site at mkennedy.codesHere is the chat conversation with Claude Opus/Sonnet. Had to juggle this a bit because the RSS feed only held the last 50. So we had to go back in and web scrape. That resulted in oddies like comments on wordpress that had to be cleaned etc.Whole process took 3-4 hours from idea to “production”duction”.The chat transcript is just the first round getting the RSS → Hugo done. The fixes occurred in other chats.This article is timely and noteworthy: Blogging service TypePad is shutting down and taking all blog content with itThis highlights why your domain name needs to be legit, not just tied to the host. I’m looking at you pyfound.blogspot.com. I just redirected blog.michaelckennedy.net to mkennedy.codesCarefully mapping old posts to a new archived area using NGINX config. This is just the HTTP portion, but note the /sitemap.xml and location ~ "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.+?)/?$" { portions. The latter maps posts such as https://blog.michaelckennedy.net/2018/01/08/a-bunch-of-online-python-courses/ to https://mkennedy.codes/posts/r/a-bunch-of-online-python-courses/ server { listen 80; server_name blog.michaelckennedy.net; # Redirect sitemap.xml to new domain location = /sitemap.xml { return 301 ; } # Handle blog post redirects for HTTP -> HTTPS with URL transformation # Pattern: /YYYY/MM/DD/post-slug/ -> location ~ "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.+?)/?$" { return 301 $4/>; } # Redirect all other HTTP URLs to mkennedy.codes homepage location / { return 301 ; } } Extras Brian: SMS URLs and Draft SMS and iMessage from any computer keyboard from Seth LarsonTest and Code Archive is now up, see announcement Michael: Python: The Documentary | An origin story is out! Joke: Do you know him? He is me.
    Show More Show Less
    36 mins
  • #446 State of Python 2025
    Aug 25 2025
    Topics covered in this episode: * pypistats.org was down, is now back, and there’s a CLI** State of Python 2025** wrapt: A Python module for decorators, wrappers and monkey patching.*pysentryExtrasJokeWatch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python TrainingThe Complete pytest CoursePatreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)Brian: @brianokken@fosstodon.org / @brianokken.bsky.socialShow: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: pypistats.org was down, is now back, and there’s a CLI pypistats.org is a cool site to check the download stats for Python packages.It was down for a while, like 3 weeks?A couple days ago, Hugo van Kemenade announced that it was back up.With some changes in stewardship “pypistats.org is back online! 🚀📈 Thanks to @jezdez for suggesting the @ThePSF takes stewardship and connecting the right people, to @EWDurbin for migrating, and of course to Christopher Flynn for creating and running it for all these years!”Hugo has a CLI version, pypistats You can give it a command for what you want to search for recent,overall, python_major, python_minor, systemThen either a package name, a directory path, or if nothing, it will grab the current directory package via pyproject.toml or setup.cfgvery cool Michael #2: State of Python 2025 Michael’s Themes Python people use Python: 86% of respondents use Python as their main languageWe are mostly brand-new programmers: Exactly 50% of respondents have less than two years of professional coding experienceData science is now over half of all PythonMost still use older Python versions despite benefits of newer releases: Compelling math to make the change.Python web devs resurgenceForward-looking trends Agentic AI will be wildAsync, await, and threading are becoming core to PythonPython GUIs and mobile are risingActionable ideas Action 1: Learn uvAction 2: Use the latest PythonAction 3: Learn agentic AIAction 4: Learn to read basic RustAction 5: Invest in understanding threadingAction 6: Remember the newbies Brian #3: wrapt: A Python module for decorators, wrappers and monkey patching. “The aim of the wrapt module is to provide a transparent object proxy for Python, which can be used as the basis for the construction of function wrappers and decorator functions. An easy to use decorator factory is provided to make it simple to create your own decorators that will behave correctly in any situation they may be used.”Why not just use functools.wraps()? “The wrapt module focuses very much on correctness. It therefore goes way beyond existing mechanisms such as functools.wraps() to ensure that decorators preserve introspectability, signatures, type checking abilities etc. The decorators that can be constructed using this module will work in far more scenarios than typical decorators and provide more predictable and consistent behaviour.”There’s a bunch of blog posts from 2014 / 2015 (and kept updated) that talk about how wrapt solves many issues with traditional ways to decorate and patch things in Python, including “How you implemented your Python decorator is wrong”.Docs are pretty good, with everything from simple wrappers to an example of building a wrapper to handle thread synchronization Michael #4: pysentry via Owen LamontInstall via uv tool install pysentry-rsScan your Python dependencies for known security vulnerabilities with Rust-powered scanner.PySentry audits Python projects for known security vulnerabilities by analyzing dependency files (uv.lock, poetry.lock, Pipfile.lock, pyproject.toml, Pipfile, requirements.txt) and cross-referencing them against multiple vulnerability databases. It provides comprehensive reporting with support for various output formats and filtering options.Key Features: Multiple Project Formats: Supports uv.lock, poetry.lock, Pipfile.lock, pyproject.toml, Pipfile, and requirements.txt filesExternal Resolver Integration: Leverages uv and pip-tools for accurate requirements.txt constraint solvingMultiple Data Sources: PyPA Advisory Database (default)PyPI JSON APIOSV.dev (Open Source Vulnerabilities)Flexible Output for different workflows: Human-readable, JSON, SARIF, and Markdown formatsPerformance Focused: Written in Rust for speedAsync/concurrent processingMulti-tier intelligent caching (vulnerability data + resolved dependencies)Comprehensive Filtering: Severity levels (low, medium, high, critical)Dependency scopes (main only vs all [optional, dev, prod, etc] dependencies)Direct vs. transitive dependenciesEnterprise Ready: SARIF output for IDE/CI ...
    Show More Show Less
    31 mins
No reviews yet
In the spirit of reconciliation, Audible acknowledges the Traditional Custodians of country throughout Australia and their connections to land, sea and community. We pay our respect to their elders past and present and extend that respect to all Aboriginal and Torres Strait Islander peoples today.