Page de couverture de Python Bytes

Python Bytes

Python Bytes

Auteur(s): Michael Kennedy and Brian Okken
Écouter gratuitement

À propos de cet audio

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 Politique
Épisodes
  • #449 Suggestive Trove Classifiers
    Sep 15 2025
    Topics covered in this episode: * Mozilla’s Lifeline is Safe After Judge’s Google Antitrust Ruling** troml - suggests or fills in trove classifiers for your projects** pqrs: Command line tool for inspecting Parquet files** Testing for Python 3.14*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. Michael #1: Mozilla’s Lifeline is Safe After Judge’s Google Antitrust Ruling A judge lets Google keep paying Mozilla to make Google the default search engine but only if those deals aren’t exclusive.More than 85% of Mozilla’s revenue comes from Google search payments.The ruling forbids Google from making exclusive contracts for Search, Chrome, Google Assistant, or Gemini, and forces data sharing and search syndication so rivals get a fighting chance. Brian #2: troml - suggests or fills in trove classifiers for your projects Adam HillThis is super cool and so welcome.Trove Classifiers are things like Programming Language :: Python :: 3.14 that allow for some fun stuff to show up in PyPI, like the versions you support, etc.Note that just saying you require 3.9+ doesn’t tell the user that you’ve actually tested stuff on 3.14. I like to keep Trove Classifiers around for this reason.Also, License classifier is deprecated, and if you include it, it shows up in two places, in Meta, and in the Classifiers section. Probably good to only have one place. So I’m going to be removing it from classifiers for my projects.One problem, classifier text has to be an exact match to something in the classifier list, so we usually recommend copy/pasting from that list.But no longer! Just use troml!It just fills it in for you (if you run troml suggest --fix). How totally awesome is that!I tried it on pytest-check, and it was mostly right. It suggested me adding 3.15, which I haven’t tested yet, so I’m not ready to add that just yet. :)BTW, I talked with Brett Cannon about classifiers back in ‘23 if you want some more in depth info on trove classifiers. Michael #3: pqrs: Command line tool for inspecting Parquet files pqrs is a command line tool for inspecting Parquet filesThis is a replacement for the parquet-tools utility written in RustBuilt using the Rust implementation of Parquet and Arrowpqrs roughly means "parquet-tools in rust"Why Parquet? Size A 200 MB CSV will usually shrink to somewhere between about 20-100 MB as Parquet depending on the data and compression. Loading a Parquet file is typically several times faster than parsing CSV, often 2x-10x faster for a full-file load and much faster when you only read some columns.Speed Full-file load into pandas: Parquet with pyarrow/fastparquet is usually 2x–10x faster than reading CSV with pandas because CSV parsing is CPU intensive (text tokenizing, dtype inference). Example: if read_csv is 10 seconds, read_parquet might be ~1–5 seconds depending on CPU and codec.Column subset: Parquet is much faster if you only need some columns — often 5x–50x faster because it reads only those column chunks.Predicate pushdown & row groups: When using dataset APIs (pyarrow.dataset) you can push filters to skip row groups, reducing I/O dramatically for selective queries.Memory usage: Parquet avoids temporary string buffers and repeated parsing, so peak memory and temporary allocations are often lower. Brian #4: Testing for Python 3.14 Python 3.14 is just around the corner, with a final release scheduled for October.What’s new in Python 3.14Python 3.14 release scheduleAdding 3.14 to your CI tests in GitHub Actions Add “3.14” and optionally “3.14t” for freethreadedAdd the line allow-prereleases: trueI got stuck on this, and asked folks on Mastdon and BlueskyA couple folks suggested the allow-prereleases: true step. Thank you!Ed Rogers also suggested Hugo’s article Free-threaded Python on GitHub Actions, which I had read and forgot about. Thanks Ed! And thanks Hugo! Extras Brian: dj-toml-settings : Load Django settings from a TOML file. - Another cool project from Adam HillLidAngleSensor for Mac - from Sam Henri Gold, with examples of creaky door and theraminListener Bryan Weber found a Python version via Changelog, pybooklid, from tcsenpaiGrab PyBay Michael: Ready prek go! by Hugo van Kemenade Joke: Console Devs Can’t Find a Date
    Voir plus Voir moins
    31 min
  • #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?
    Voir plus Voir moins
    39 min
  • #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.
    Voir plus Voir moins
    36 min
Pas encore de commentaire