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.
Similar Podcasts

24H24L
Evento en línea, de 24 horas de duración que consiste en la emisión de 24 audios de diversas temáticas sobre GNU/Linux. Estos son los audios del evento en formato podcast.

The Infinite Monkey Cage
Brian Cox and Robin Ince host a witty, irreverent look at the world through scientists' eyes.

Talking Kotlin
A bimonthly podcast that covers the Kotlin programming language by JetBrains, as well as related technologies. Hosted by Hadi Hariri
#375 Pointing at Countries
Topics covered in this episode: pycountry Does Python have pointers? ingestr Make your terminal nice Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: pycountry A Python library to access ISO country, subdivision, language, currency and script definitions and their translations. pycountry provides the ISO databases for the standards: 639-3 Languages 3166 Codes for representation of names of countries and their subdivisions 3166-1 Countries 3166-3 Deleted countries 3166-2 Subdivisions of countries 4217 Currencies 15924 Scripts Brian #2: Does Python have pointers? Ned Batchelder Turns out, this is really the description of “what’s a variable in Python?” that helps to make sense of the “variables as names” model in Python, especially for people coming from languages that use pointers a lot. You can use id() to find out what a variable points to You just can’t do the reverse of access it given an id. There’s no “dereference” operator. See also Python Names and Values, also by Ned Should be required reading/viewing for all Python curriculum. Michael #3: ingestr ingestr is a command-line application that allows ingesting or copying data from any source into any destination database. Works on both MongoDB and Postgres and many more. incremental loading: append, merge or delete+insert Brian #4: Make your terminal nice David Lord David’s switched to Fish and Starship I tried switching to Fish several times, and I guess I’m good with zsh. Although I admire the brave comic sans motto: “Finally, a command line shell for the 90s” But I’m finally ready for Starship, and it takes almost no time to set up Plus it’s fast. (Has it always been Rust?) Extras Brian: Doing some groundwork for a SaaS project, using SaaS Pegasus I just talked with Cory from Pegasus for an upcoming PythonTest episode I haven’t decided whether to save up SaaS episodes for one big series, or spread them out. But mostly I’m excited to get my project started. Michael: Excellent video about “cloud exit” uv - The Next Evolution in Python Packages? Python 3.13 a5 Target’s Open Source Fund via Pat Decker Joke: Anti-social engineer
#374 Climbing the Python Web Mountain
Topics covered in this episode: 6 ways to improve the architecture of your Python project (using import-linter) Mountaineer Why Python's Integer Division Floors Hatchet Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: 6 ways to improve the architecture of your Python project (using import-linter) Piglei Using import-linter to define architectural layers check to make sure imports don’t violate (import from upper layers) can also check for more contracts, such as forbidden - disallow a specific from/to import independence - list of modules that shouldn’t import from each other Fixing violations a process introduced to set exceptions for each violation in a config file then fix violations 1 at a time (nice approach) use the whole team if you can Common methods for fixing dependency issues Merging and splitting modules Dependency Injection, including using protocols to keep type hints without the need to import just for types Use simpler dependency types Delaying function implementations module global methods set by caller, or adding a simple plugin/callback system Configuration driven Setting import statements in a config file and using import_string() at runtime Replace function calls with event-driven approaches Michael #2: Mountaineer Mountaineer is a batteries-included web framework for Python and React. Mountaineer focuses on developer productivity above all else, with production speed a close second. 📝 Typehints up and down the stack: frontend, backend, and database 🎙️ Trivially easy client[HTML_REMOVED]server communication, data binding, and function calling 🌎 Optimized server rendering for better accessibility and SEO 🏹 Static analysis of web pages for strong validation: link validity, data access, etc. 🤩 Skip the API or Node.js server just to serve frontend clients Brian #3: Why Python's Integer Division Floors Guido van Rossum Integer division always floors (toward negative infinity) instead of truncating. (C truncates) 5//2 → 2 -5//2 → -3 5//-2 → -3 Reason, For nice mathematical relationships with // and % (modulo). a//b = quotient (q), a%b = remainder (r) such that b*q + r = a, and 0 <= r < b This works for both positive and negative a values For negative b, the second rule has to change to 0 >= r > b If you truncate (like C does), you have to use abs(r) for the first rule to work. Theory of why C doesn’t do it this way: Probably a hardware limitation at the time when C was designed, due to “sign + magnitude” integers instead of modern two’s compliment integers. Michael #4: Hatchet Hatchet is a distributed, fault-tolerant task queue which replaces traditional message brokers and pub/sub systems. It’s built to solve problems like concurrency, fairness, and durability Concurrency, Fairness, and Rate limiting: Enable FIFO, LIFO, Round Robin, and Priority Queues with built-in strategies to avoid common pitfalls. Architected for Resiliency: Customizable retry policies and built-in error handling to recover from transient failures. Extras Brian: Charlie Marsh on uv in PythonTest episode 216 Michael: Build An Audio AI App Course [free!] Rock Solid Python with Python Typing Course Coolio Joke: Breaking Prod
#373 Changing Directories
Topics covered in this episode: zoxide Smart CLIs with Typer Python recommended officially by the US Government Textual tutorials at Mouse vs Python Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: zoxide zoxide is a smarter cd command, inspired by z and autojump. It remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes. zoxide works on all major shells and platforms. Brian #2: Smart CLIs with Typer Rahul Pai Lots of TILs here, even though I’ve been using Typer for years. Examples of Auto-detection of arguments and types based on type hints Help text is a smidge clunkier Prompting for missing arguments Defaulting to an enviromental variable for missing args Print help if no args given Explicit app and subcommands with a comparison to argparse Reusable commands with result_callback Several topics covered in comparison with argparse See also Testing argparse Applications Michael #3: Python recommended officially by the US Government The US government explicitly recommends memory safe languages. Python is one of them The comparison to big tech by Samuel is interesting Brian #4: Textual tutorials at Mouse vs Python Mike Driscoll Most recently Creating a Modal Dialog For Your TUIs in Textual Textualize already has some pretty great documentation at textual.textualize.io But it’s cool to see some different tutorials on it. Extras Brian: Is UV the FUTURE of Python PACKAGING? 🐍📦 - Hynek Nice context on how uv fits into all of the existing packaging challenges and some hope for the future. venmo feed is public by default Michael: ngrok Python SDK Djangonauts on Talk Python Maybe just a new case and battery for your phone? Joke: Ship it!
#372 uv - an impressive pip alternative
Topics covered in this episode: uv: Python packaging in Rust jpterm Everything You Can Do with Python's textwrap Module HTML First Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. First, we are likely skipping next week folks. I’ll be at PyCon Philippines. Brian #1: uv: Python packaging in Rust Suggested by Collin Sullivan “uv is designed as a drop-in replacement for pip and pip-tools” Intended to support the pip and pip-tools APIs, just use uv pip instead. Oh yeah, also replaces venv and virtualenv. And it’s super zippy, as you would expect. I’m still getting used to it uv pip venv didn’t have --prompt at first. But that’s fixed. should get released soon. first thing I tried uv pip install ./ and uv pip install pytest second. worked awesome uv pip list third thing I tried not there either, but uv pip freeze is similar. Issue already filed Seriously, I’m excited about this. It’s just that it seems I wasn’t the target workflow for this. See also tox-uv - speed up tox with uv [rye](https://lucumr.pocoo.org/2024/2/15/rye-grows-with-uv/) from Armin Ronacher, will be supported by Astral - MK: Switched to this for dev. It’s excellent. For some reason, doesn’t work on Docker? From Henry Michael #2: jpterm via David Brochart jpterm is a JupyterLab-like environment running in the terminal. What sets jpterm apart is that it builds on the shoulders of giants, one of which is Textual. It is designed similarly to JupyterLab, where everything is a plugin. Brian #3: Everything You Can Do with Python's textwrap Module Martin Heinz Nice quick demo of one of my favorite builtin modules. Features shorten text and insert placeholders wrap can split lines to the same length but can also just split a string into equal chunks for batch processing TextWrapper class does all sorts of fancy stuff. dedent is my fave. Awesome for including a multiline string in a test function as an expected outcome. Michael #4: HTML First HTML First is a set of guidelines for making it easier, faster and more maintainable to build web software Principles Leveraging the default capabilities of modern web browsers. Leveraging the extreme simplicity of HTML's attribute syntax. Leveraging the web's ViewSource affordance. Practices Prefer Vanilla approaches Use HTML attributes for styling and behaviour Use libraries that leverage HTML attributes Avoid Build Steps Prefer Naked HTML Be View-Source Friendly Extras Brian: pytest 8.0.1 released. Fixes the parametrization order reversal I mentioned a couple episodes ago, plus some other fixes. Learn about dependency injection from Hynek If you want to jump into some Rust to help speed up Python tools, maybe check out yarr.fyi I just interviewed Nicole, the creator, for Python Test, and this looks pretty cool Her episode should come out in a couple of weeks. Ramping up more interviews for Python People. So please let me know if you’d like to be on the show or if you have suggestions for people you’d like me to interview. Also, I know this is weird, some people are still on X, and not like “didn’t close their account when they left”, but actually still using it. This is ironically a reverse of X-Files. “I don’t want to believe”. However, I’ve left my account open for those folks. I check it like twice a month. But eventually I’ll see it if you DM me. But really, there are easier ways to reach me. Michael: PyData Pittsburg CFP Wyden: Data Broker Used Abortion Clinic Visitor Location Data To Help Send Targeted Misinformation To Vulnerable Women SciPy 2024 - Call for Proposals Joke: Yeti tumbler
#371 Python in a Crate
Topics covered in this episode: AppleCrate One way to package Python code right now Flask8 but why? Extra, Extra, Extra Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: AppleCrate By Rhet Turnbull (from Building macOS Apps episode) AppleCrate is a tool for creating native macOS installers for your command line tools. It's useful for creating installers for command line tools written in any language. Tools written in interpreted languages like Python will need to be first processed with a tool like pyinstaller to create a standalone executable. AppleCrate uses Jinja2 templates to generate the files required for the installer. This allows you to use template variables in your files or command line parameters to customize the installer. Brian #2: One way to package Python code right now Ned Batchelder An example repo with all the parts for package A lot of discussion and what to think about in the README (unfortunately rst and not md, but we can’t have everything) Includes pyproject.toml dev-requirements.txt README.rst Makefile LICENSE.txt .bitignore .editorconfig see https://editorconfig.org Shout out to to Packaging Python Projects on python.org, which is pretty good Michael #3: Flask8 but why? Ihor Kalnytskyi: Something I really like about #ruff, a new tool for both linting and formatting in the #python ecosystem. You can literally pick any lint rule it supports and see both reasoning and examples. Ruff supports over 700 lint rules, many of which are inspired by popular tools like Flake8, isort, pyupgrade, and others. Brian #4: Extra, Extra, Extra Flat.app kinda like trello, etc. but a very simple interface that makes it pretty easy to use tosdr.org Terms of Service; Didn’t Read Kind of a wikipeda way to summarize the terms of service of different web services, and give them ratings/grades Why I write I talked about blogging more last episode. Here’s a cool write-up by Sheena O'Connell reasons to remember to refine my thinking to impact to get through hard times to connect Three pytest Features You Will Love Helen Scott at JetBrains/PyCharm Fixtures, Markers, Parametrize Plus shoutouts to my course and book Extras Brian: Wikipedia List of common misconceptions - just for fun Ear Trumpet Labs (a Potland Company) Edwina mic - just something on my wish list Michael Mozilla Monitor Python 3.12.2 Upgraded all the Python apps (11 of them) in about 2 minutes and one command Got a Vision Pro? Try the Talk Python Courses app Great video event: Data Doodling with Martina Pugliese Joke: Free Tier
#370 Your Very Own Heroku
Topics covered in this episode: Dokku Summary of Major Changes Between Python Versions How to check Internet Speed via Terminal? speedtest-cli Blogs: We all should blog more Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Dokku An open source PAAS alternative to Heroku. Dokku helps you build and manage the lifecycle of applications from building to scaling. Powered by Docker, you can install Dokku on any hardware. Once it's set up on a host, you can push Heroku-compatible applications to it via Git. Rich plug in architecture. Brian #2: Summary of Major Changes Between Python Versions Nicholas Hairs Changes between versions & Tools & utilities to help with switching Hopefully you’re already at least at 3.8, but come on, 3.11 & 3.12 are so fun! Useful things pyupgrade can automatically upgrade code base (However, I frequently just upgrade and run tests and let my old code be as-is until it bugs me. - Brian) black checks pyproject.toml requires-python setting and uses version specific rules. Versions (way more highlights listed in the article) 3.8 Assignment expressions := walrus f"{variable=}" now works 3.9 Typing has built in generics like dict[], so no more from typing import Dict Dict union operator Strings can removeprefix and removesuffix 3.10 Structural pattern matching match/case Typing: Union using pipe | Dataclasses support slots=True and kw_only=True 3.11 tomllib included as a standard TOMP parser Exception groups Exception Notes add_note() Typing: A Self type Star unpacking expressions allowed in for statements: for x in *a, *b: 3.12 f-strings can re-use quotes Typing: better type parameter syntax Typing: @override decorator ensures a method being overridden by a child class actually exists. Michael #3: How to check Internet Speed via Terminal? speedtest-cli Command line interface for testing internet bandwidth using speedtest.net Just pipx install speedtest-cli Has a Python API too Brian #4: Blogs: We all should blog more Jeff Triplett is attempting one post per day in February Feb 1: Choosing the Right Python and Django Versions for Your Projects Feb 2: My First Mac Which also links to a quite interesting Personal: Default Apps 2023 Feb 3: What’s Your Go-to Comfort Media? [rough cut] Feb 4: The Django apps I actually use (rough cut) Feb 5: How to test with Django and pytest fixtures Need ideas? Check out Build an idea bank and never run out of blog ideas Not using AI? Thanks. We appreciate that. Maybe tag it as Not By AI Extras Brian: If upgrading to pytest 8, be aware that running individual tests with parametrization will result in a reverse order. It shouldn’t matter. You shouldn’t be depending on test order. But it was surprising to me. Issue has been logged Michael: Orbstack follow up Joke: White Lies
#369 The Readability Episode
Topics covered in this episode: Granian pytest 8 is here Assorted Docker Goodies New GitHub Copilot Research Finds 'Downward Pressure on Code Quality' Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Granian via Andy Shapiro and Bill Crook A Rust HTTP server for Python applications. Granian design goals are: Have a single, correct HTTP implementation, supporting versions 1, 2 (and eventually 3) Provide a single package for several platforms Avoid the usual Gunicorn + uvicorn + http-tools dependency composition on unix systems Provide stable performance when compared to existing alternatives Could use better logging But making my own taught me maybe I prefer that! Originates from the Emmett framework. Brian #2: pytest 8 is here Improved diffs: Very verbose -vv is a colored diff, instead of a big chunk of red. Python code in error reports is now syntax-highlighted as Python. The sections in the error reports are now better separated. Diff for standard library container types are improved. Added more comprehensive set assertion rewrites for comparisons other than equality ==, with the following operations now providing better failure messages: !=, <=, >=, <, and >. Improvements to -r for xfailures and xpasses Report tracebacks for xfailures when -rx is set. Report captured output for xpasses when -rX is set. For xpasses, add - in summary between test name and reason, to match how xfail is displayed. This one was important to me. Massively helps when checking/debugging xfail/xpass outcomes in CI. Thanks to Fabian Sturm, Bruno Oliviera, and Ran Benita for help to get this release. Lots of other improvements See full changelog for all the juicy details. And then upgrade and try it out! pip install -U pytest Michael #3: Assorted Docker Goodies OrbStack Say goodbye to slow, clunky containers and VMs OrbStack is the fast, light, and easy way to run Docker containers and Linux. Develop at lightspeed with our Docker Desktop alternative. Podman Podman is an open source container, pod, and container image management engine. Podman makes it easy to find, run, build, and share containers. Manage containers (not just Podman.) Podman Desktop allows you to list, view, and manage containers from multiple supported container engines* in a single unified view. Gain easy access to a shell inside the container, logs, and basic controls. Works on Podman, Docker, Lima, kind, Red Hat OpenShift, Red Hat OpenShift Developer Sandbox. CasaOS Your Personal Cloud OS. Community-based open source software focused on delivering simple personal cloud experience around Docker ecosystem. Also have the ZimaCube hardware (Personal cloud. Re-invented.) Brian #4: New GitHub Copilot Research Finds 'Downward Pressure on Code Quality' David Ramel Regarding “…the quality and maintainability of AI-assisted code compared to what would have been written by a human.” Q: "Is it more similar to the careful, refined contributions of a Senior Developer, or more akin to the disjointed work of a short-term contractor?" A: "We find disconcerting trends for maintainability. Code churn -- the percentage of lines that are reverted or updated less than two weeks after being authored -- is projected to double in 2024 compared to its 2021, pre-AI baseline. We further find that the percentage of 'added code' and 'copy/pasted code' is increasing in proportion to 'updated,' 'deleted,' and 'moved 'code. In this regard, AI-generated code resembles an itinerant contributor, prone to violate the DRY-ness [don't repeat yourself] of the repos visited." Extras Brian: Did I mention pytest 8? Just pip install -U pytest today And if you want to learn pytest super fast, check out The Complete pytest Course or grab a copy of the book, Python Testing with pytest Michael: I’d like to encourage people to join our mailing list. We have some fun plans and some of them involve our newsletter. It’s super private, no third parties, no spam and is based on my recent Docker and Listmonk work. Big release for Pydantic, 2.6. New essay: Use Custom Search Engines Way More Joke: Pushing to main Junior vs Senior engineer
#368 That episode where we just ship open source
Topics covered in this episode: Syntax Error #11: Debugging Python umami and umami-analytics pytest-suite-timeout Listmonk and (py) listmonk Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Syntax Error #11: Debugging Python Juhis Issue 11 of a fun debugging newsletter from Juhis Debugging advice mindeset take a break adopt a process talk to a duck tools & techniques print snoop debuggers Django debug toolbar & Kolo for VS Code Michael #2: umami and umami-analytics Umami makes it easy to collect, analyze, and understand your web data — while maintaining visitor privacy and data ownership. umami-analytics is a client for privacy-preserving, open source Umami analytics platform based on httpx and pydantic. Core features ➕ Add a custom event to your Umami analytics dashboard. 🌐 List all websites with details that you have registered at Umami. 🔀 Both sync and async programming models. ⚒️ Structured data with Pydantic models for API responses. 👩💻 Login / authenticate for either a self-hosted or SaaS hosted instance of Umami. 🥇Set a default website for a simplified API going forward. Brian #3: pytest-suite-timeout While recording Python Test 213 : Repeating Tests I noted that pytest-repeat doesn’t have a timeout, but pytest-flakefinder does. And perhaps I should add a timeout to pytest-repeat But also, maybe there’s other places I’d like a timeout, not just with repeat, but often with other parametrizations and even parametrize matrices. So, pytest-suite-timeout is born But Why not pytest-timeout? asks Mike Felder timeout is only timeouts per test, and it isn’t always graceful suite-timeout is for the full suite, and only times out between tests. so, you could use both Michael #4: Listmonk and (py) listmonk Listmonk Self-hosted newsletter and mailing list manager (think mailchimp) Built on Go and Vue Backed by a company charing for this service as SaaS Still requires a mail infrastructure backend (I’m using Sendgrid) listmonk (on PyPI) API Client for Python Created by Yours Truly I tried 4 other options first, they were all bad in their own way. Features: ➕Add a subscriber to your subscribed users. 🙎 Get subscriber details by email, ID, UUID, and more. 📝 Modify subscriber details (including custom attribute collection). 🔍 Search your users based on app and custom attributes. 🏥 Check the health and connectivity of your instance. 👥 Retrieve your segmentation lists, list details, and subscribers. 🙅 Unsubscribe and block users who don't want to be contacted further. 💥 Completely delete a subscriber from your instance. 📧 Send transactional email with template data (e.g. password reset emails). These pair well in my new docker cluster infrastructure Calls to the API from a client app (e.g. Talk Python Training) are basically loopback on the local docker bridge network. Extras Michael: Every github repo that has “releases” has a releases RSS feed, e.g. Umami Kolo Django + VS Code Warp Terminal on linux bpytop and btop - live server monitoring Joke: The cloud, visualized
#367 A New Cloud Computing Paradigm at Python Bytes
Topics covered in this episode: Leaving the cloud PEP 723 - Inline script metadata Flet for Android harlequin: The SQL IDE for Your Terminal. Extras Joke Watch on YouTube About the show Sponsored by Bright Data : pythonbytes.fm/brightdata Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Leaving the cloud Also see Five values guiding our cloud exit We value independence above all else. We serve the internet. We spend our money wisely. We lead the way. We seek adventure. And We stand to save $7m over five years from our cloud exit Slice our new monster 192-thread Dell R7625s into isolated VMs Which added a combined 4,000 vCPUs with 7,680 GB of RAM and 384TB of NVMe storage to our server capacity They created Kamal — Deploy web apps anywhere A lot of these ideas have changed how I run the infrastructure at Talk Python and for Python Bytes. Brian #2: PEP 723 - Inline script metadata Author: Ofek Lev This PEP specifies a metadata format that can be embedded in single-file Python scripts to assist launchers, IDEs and other external tools which may need to interact with such scripts. Example: # /// script # requires-python = ">=3.11" # dependencies = [ # "requests<3", # "rich", # ] # /// import requests from rich.pretty import pprint resp = requests.get("https://peps.python.org/api/peps.json") data = resp.json() pprint([(k, v["title"]) for k, v in data.items()][:10]) Michael #3: Flet for Android via Balázs Remember Flet? Here’s a code sample (scroll down a bit). It’s amazing but has been basically impossible to deploy. Now we have Android. Here’s a good YouTube video showing the build process for APKs. Brian #4: harlequin: The SQL IDE for Your Terminal. Ted Conbeer & other contributors Works with DuckDB and SQLite Speaking of SQLite Jeff Triplett and warnings of using Docker and SQLite in production Anže’s post and and article: Django, SQLite, and the Database is Locked Error Extras Brian: Recent Python People episodes Will Vincent Julian Sequeira Pamela Fox Michael: PageFind and how I’m using it When "Everything" Becomes Too Much: The npm Package Chaos of 2024 Essay: Unsolicited Advice for Mozilla and Firefox SciPy 2024 is coming to Washington Joke: Careful with that bike lock combination code
#366 Put It In The Backlog
Topics covered in this episode: Python 3.13 gets a JIT UniDep - Unified Conda and Pip Dependency Management Don’t Start Pull Requests from Your Main Branch instld: The simplest package management Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Python 3.13 gets a JIT Anthony Shaw Great article that walks through JIT concepts with a small example as if you were writing a parser in Python instead of C. Covers What is a JIT? What is a copy-and-patch JIT? and Why? How does the Python JIT work? Is it faster? This is a building block to future improvements Michael #2: UniDep - Unified Conda and Pip Dependency Management 🔄 Single requirements.yaml for both #Conda & #Pip. ⚙️ Works with pyproject.toml & setup.py. 🏢 Perfect for monorepos. 🔒 Create consistent conda-lock files for multiple projects. 🌍 Platform-specific support. 🚀 unidep install for easy setup. Full source page. Brian #3: Don’t Start Pull Requests from Your Main Branch Hynek Schlawack When contributing to other users’ repositories, always start a new branch in your fork. Reasons to not use main Forces you to only have one change in progress Merges will generate conflicts and you can’t pull from that branch anymore. Need to kill the fork and start over If the target repo has branch protection on, then maintainers can’t push to your branch. Hynek also provides a way to fix things if you’ve already started your changes on a main branch fork. Michael #4: instld: The simplest package management Thanks to this package, it is very easy to manage the lifecycle of packages. ⚡ Run your code without installing libraries. ⚡ You can use 2 different versions of the same library in the same program. ⚡ You can use incompatible libraries in the same project, as well as libraries with incompatible/conflicting dependencies. ⚡ It's easy to share written scripts. The script file becomes self-sufficient - the user does not need to install the necessary libraries. ⚡ The library does not leave behind "garbage". After the end of the program, no additional files remain in the system. Extras Brian: The Complete pytest Course is now actually complete Although updates will happen when and if necessary as pytest/Python changes. To celebrate, use code 2024 in January for 10% off any pricing option. More episodes of Python People and Python Test on the way now That course took up a lot of my time in late 2023 Just released an episode with Will Vincent and Python Test will have a new episode this week and for the foreseeable future. Let me know if you want to be on Python People or Python Test Michael: Hatch follow up: Great coverage of Hatch v1.8.0! One small correction: only the binaries for Hatch are signed with the certificate from the PSF. - Ofek PyPI new user registration temporarily suspended Pagefind and how I’m using it Talk Python Live: Data Doodles event coming early Feb New essay: AI Features a Waste of Time? Joke: Put it in the backlog
#365 Inheritance, but not Inheritance!
Topics covered in this episode: * Hatch v1.8* svcs: A Flexible Service Locator for Python Steering Council 2024 Term Election Results Python protocols. When to use them in your projects to abstract and decoupling Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Hatch v1.8 Hatch now manages installing Python for you. Hatch can build .app and .exe stand-alone binaries for you The macOS ones are signed (signed!) Discussion here Brian #2: svcs : A Flexible Service Locator for Python Hynek A library to help structure and test Python web applications. “svcs (pronounced services) is a dependency container* for Python. It gives you a central place to register factories for types/interfaces and then imperatively acquire instances of those types with automatic cleanup* and **health checks.” “Benefits: Eliminates tons of repetitive boilerplate code, unifies acquisition* and cleanups of services, provides full static type safety for them, simplifies testing through loose coupling, improves live introspection and monitoring* with **health checks.” Hynek has started a YouTube channel, and is starting with an explanation of svcs. Yes, Hynek, we want more videos. I like that it’s not a beginner level. My request for future videos: just past beginner, and also intermediate level. There are plenty of basics videos out there, not as many filling the gaps between beginner and production. Michael #3: Steering Council 2024 Term Election Results The 2024 Term Python Steering Council is: Pablo Galindo Salgado Gregory P. Smith Emily Morehouse Barry Warsaw Thomas Wouters Full results are available in PEP 8105 . How do you become a candidate? Candidates must be nominated by a core team member. If the candidate is a core team member, they may nominate themselves. Brian #4: Python protocols. When to use them in your projects to abstract and decoupling Carlos Vecina “Protocols are an alternative (or a complement) to inheritance, abstract classes and Mixins.” Understanding interactions between ABC, MixIns and Protocols in Python With examples Extras Brian: Donations. It’s a decent time of the year to donate to projects that help you Python Software Foundation Django Software Foundation Python Bytes Also, look for “Sponsor this project” links in GitHub for projects you depend on. Michael: Mastodon guidelines (mine): If you have a picture and description, I’ll probably follow you back If you have posts that seem relevant +1 If you have a verified webpage +1 If your account is private, won’t. I don’t understand really since private group messages already exist and the profile itself is public. Speaking of Mastodon. I had a productive conversation with the PSF and others around masks and conferences. Dropbox spooks users by sending data to OpenAI for AI search features There was a comment in the above article to the effect of “Once you give your data to a third party (even trusted like Dropbox), you no longer control that data.” That sent me searching and thinking… sync.com? proton drive (discount code)? nextcloud? filen.io? icedrive.net? ownCloud’s recent CVE makes me a bit nervous of self-hosted options. Either way, Cryptomator is very interesting. Beyond privacy, this got me thinking, just how many hours of dev time have been diverted to add mediocre-at-best AI features to everything? I’m doing a big digital decluttering and have lots to say on that soon. Not submitting my talks to PyCascades this year. But I did submit 3 talks to PyCon US. 🤞 I will be giving the keynote at PyCon Philippines. Joke: The dream is dead?
#364 Holy Match-Cases Batman!
Topics covered in this episode: A Python/Django Advent calendar Dropbase helps you build internal web apps with Python Real-world match/case Extra, extra, extra, so many extras! Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: A Python/Django Advent calendar James Bennett’s take on an Advent Calendar “I’m going to try to publish one short blog post each day of Advent 2023, each covering a small but hopefully useful tip or bit of information for Python and/or Django developers” First post also discusses using enums A couple cool testing posts Don’t mock Python’s HTTPX I didn’t know HTTPX had built in transport mocking, very cool Test your documentation doctest discussion Michael #2: Dropbase helps you build internal web apps with Python Build fullstack web apps for your internal teams. Import existing Python scripts Quickly layer UIs and granular permissions on top. Turn any SQL SELECT into an admin panel with Smart Tables. Watch the video for the zen of it. Freemium model Brian #3: Real-world match/case Ned Batchelder Structural pattern matching example taken from a GitHub bot Matching nested dictionaries, pulling out bits of data The examples of not just matching but using case [structure] if [test on component] are neat. Michael #4: Extra, extra, extra, so many extras! WAY better DNS with Bunny.net DNS Terminal Secrets essay Meet the Supporting Developer in Residence (via Pycoders) Songs in Python code BohemianRhapsody.py MoneyForNothing.py PyCascades 2024 Project names blocked on PyPI to avoid name collision for downstream free-threaded Python distributions An Open Letter to the Python Software Foundation PSF’s official mission https://discuss.python.org/t/python-3-12-1-now-available/40603 https://discuss.python.org/t/python-3-11-7-is-available/40778 Obfuscated Python winning (via Johannes Lippmann) Extras Brian: Python for VSCode, Dec 2023 release, rolls out better test discovery to everyone. Forcing pip to use virtualenv Advent of Code Joke: Too many open tabs
#363 DNS Again? It's Always DNS.
Topics covered in this episode: Fixit 2: Meta’s next-generation auto-fixing linter FastUI Mail list / newsletter conversation CLIs from type hints Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Complete pytest Course Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Fixit 2: Meta’s next-generation auto-fixing linter via Bart Kappenburg Fixit is dead! Long live Fixit 2 – the latest version of our open-source auto-fixing linter. Fixit provides a highly configurable linting framework with support for auto-fixes, custom “local” lint rules, and hierarchical configuration, built on LibCST. Fixit 2 is available today on PyPI. Created by Meta’s Python Language Foundation team — a hybrid team of both PEs and traditional SWEs — helps own and maintain the infrastructure and tooling for Python. Interesting comments on this article on Hacker News I wonder if ruff format was already a thing when Fixit was adopted, whether it would exist? Brian #2: FastUI Samuel Colvin “FastUI is a new way to build web application user interfaces defined by declarative Python code.” MK: Reminds me of the code matches DOM style of Flutter. See code samples at the end. Michael #3: Mail list / newsletter conversation I’ve been tired of Mailchimp for a long time Raising the prices month over month by $100 several months may be the straw But what are the options? Lets ask Mastodon: emailoctopus.com listmonk.app [self hosted, open source] keila.io [self/saas, open source] mailyherald.org [self hosted, open source] sendportal.io [self hosted, open source] brevo.com buttondown.email [django] zoho.com/campaigns/ sendy.co [use your own bulk emailer (e.g. sendgrid or aws ses) convertkit.com mautic.org [open source] constantcontact.com getresponse.com convertkit.com Brian #4: CLIs from type hints From Sander76 Pydantic Argparse “is a Python package built on top of pydantic which provides declarative typed argument parsing using pydantic models.” Clipstick is a “cli-tool based on Pydantic models.” tyro “is a tool for generating command-line interfaces and configuration objects in Python.” tyro includes support for dataclasses and attrs in place of Pydantic Extras Brian: Django 5.0 has been released vim-keybindings-everywhere-the-ultimate-list - submitted by Paul Barry PythonTest (the podcast formerly known as Test & Code, to be read in an undertone similar to the way one used to say “The artist formerly known as Prince”) has moved form testandcode.com to podcast.pythontest.com Plus more guests are listed now. I think I’ve gone backwards from current to episode 182. I tried to get my kid to help out, unsuccessfully. May have to hire someone to help. grrr. Michael: Essay: Don't Sweat the Ad Blocker Drama A story: my project this weekend, unify my over 20 domains to one host Joke: Honest LinkedIn
#362 You can deprecate a global variable?
Topics covered in this episode: Habits of great software engineers Flask 3.0 Build Conway's Game of Life With Python polars business Extras Joke Watch on YouTube About the show Sponsored by Scout APM Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Habits of great software engineers As we wind up the year, many people are thinking about goals for the new year. Here’s a decent list to think about Focusing beyond the code Efficiency / Antifragility Joy of tinkering Knowing the why Thinking in systems Tech detox The art of approximation Transferring Knowledge to Other Problems Making Hard Things Easy Playing the Long Game Developing a Code Nose Strong Opinions loosely held Michael #2: Flask 3.0 Deprecate the __version__ attribute. Use feature detection, or importlib.metadata.version("flask"), instead. #5230 How do you even do that? This is news to me: [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [metadata] name = "your-package-name" version = "0.1.0" Remove previously deprecated code. #5223 Brian #3: Build Conway's Game of Life With Python Leodanis Pozo Ramos CLI curses version Nice walk through of breaking the problem into parts. Michael #4: polars business It's a plugin for Polars, which allows you to do business day arithmetic. The big advantage of using this directly (as opposed to converting to pandas/numpy, using their business day tools, and then converting back) is that polars-business fits right in with the Polars lazy API. This means you'll still be able to get the gains from the Polars query optimiser without having to step into eager execution. All you need to use is it is pip install polars-business Written in Rust, but end-users doesn't need Rust to run it, Python is all you need. Extras Brian: BLACKFRIDAY code still works for 50% off The Complete pytest Course, Full Course + Community Access, through Nov 30 Also Debugging chapter is up, and it includes a small TDD example. Michael: Dear Python Community by Kenneth Reitz Python 3.13a2 out and Major new features of the 3.13 series, compared to 3.12 Thank you Black Friday supporters. Joke: ai vs dev
#361 Proper way to comment your code!
Topics covered in this episode: The many shapes and sizes of keyboards appeal - a CLI framework from Larry Hastings Graphinate: Data to Graphs A Disorganized List of Maintainer Tasks Extras Joke Watch on YouTube About the show Sponsored by Scout APM Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: The many shapes and sizes of keyboards Many keyboards discussed Focus on health and safety (as it should!) I swear by Microsoft Sculpt Ergonomic (which wasn’t mentioned) More options still over at Wire Cutter Brian #2: appeal - a CLI framework from Larry Hastings “Give your program APPEAL!” Appeal is a command-line argument processing library for Python, like argparse, optparse, getopt, docopt, Typer, and click. But Appeal takes a refreshing new approach. Hello World example: import appeal app = appeal.Appeal() @app.command() def hello(name): print(f"Hello, {name}!") app.main() looks fun, no idea how to test with it “yet”. But I plan on looking into that. Michael #3: Graphinate: Data to Graphs via Eran Rivlis Graphinate is a python library that aims to simplify the generation of Graph Data Structures from Data Sources. Write a function to definite the edges as a generator, call materialize Based on NetworkX See the github page for visual examples Brian #4: A Disorganized List of Maintainer Tasks David Lord Plus, David Lord, lead maintainer of Flask, Jinja, Click, … on Pallets, also PSF Fellow, has a blog. Neat. TLDR; Next time you want to ask "When's the next release?", instead look at the project and see where you can start getting involved. The more help maintainers have, the more they can get done. Long list of stuff David thinks about when maintaining a project. My list is shorter, but it’s still long, and my projects are tiny in comparison to his Extras Brian: Do you do enough testing? pytest to the Rescue! webinar from this morning The Complete pytest Course will be 16 chapters, 11 are released, the 12th is recorded and almost released, and the 13th should be next week, … I should be done with all 16 by the end of the year. Testing argparse Applications Python Test Podcast episode 109: Testing argparse Applications Blog post on pythontest.com: Testing argparse Applications Black Friday sale on The Complete pytest Course Use code BLACKFRIDAY for 50% off of The Complete pytest Course, Full Course + Full Access Michael: It’s Black Friday at Talk Python Python 3.13.0 alpha 1 is now available Python Developers Survey 2023 Joke: The proper way to comment your code!