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.

Ladybug Podcast
We're Emma Bostian, Sidney Buckner, Kelly Vaughn, and Ali Spittel - four seasoned software developers working in different sectors. Since there's a major lack of technical podcasts out there, we've decided to start one. Just kidding -- there's already a ton! But, we wanted to add our voices to the space and share our experiences and advice. We'll have great discussions around how to start coding, the hot technologies right now, how to get your first developer job, and more!
Check out our website!

The Infinite Monkey Cage
Brian Cox and Robin Ince host a witty, irreverent look at the world through scientists' eyes.
#355 Python 3.12 is Out!
Topics covered in this episode: 3.12 is out! Trouble with virtualenv caching, a tale of 3.12 update Python Developers Survey 2022 Results Scientific Python Library Development Guide 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: 3.12 is out! What’s new PEP 695, type parameter syntax and the type statement PEP 692, using TypedDict to annotate **kwargs PEP 698, typing.override() decorator PEP 701, f-strings in the grammar PEP 684, a unique per-interpreter GIL PEP 669, low impact monitoring Improved ‘Did you mean …’ suggestions for NameError, ImportError, and SyntaxError exceptions PEP 688, using the buffer protocol from Python The pathlib.Path class now supports subclassing The os module received several improvements for Windows support A command-line interface has been added to the sqlite3 module isinstance() checks against runtime-checkable protocols enjoy a speed up of between two and 20 times The asyncio package has had a number of performance improvements, with some benchmarks showing a 75% speed up. A command-line interface has been added to the uuid module Due to the changes in PEP 701, producing tokens via the tokenize module is up to up to 64% faster. PEP 683, immortal objects PEP 709, comprehension inlining Brian #2: Trouble with virtualenv caching, a tale of 3.12 update Michael #3: Python Developers Survey 2022 Results I did a “first reactions” video too Brian #4:Scientific Python Library Development Guide Announcement and Overview by Henry Schreiner Extras Brian: The Complete pytest Course is now at courses.pythontest.com Still on Teachable, just with a custom domain Also, just released Chapter 8 today. Michael: Moving to Mona App (was using Ivory) for Mastodon Making bank on .ai Vivaldi on iOS Joke: Thought it would be easy
#354 Python 3.12 is Coming!
Topics covered in this episode: logmerger The third and final Python 3.12 RC is out now The Python dictionary dispatch pattern Visualizing the CPython Release Process Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast 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: logmerger Paul McGuire logmerger is a TUI for viewing a merged display of multiple log files, merged by timestamp. Built on textual Awesome flags: --output - to send the merged logs to stdout --start START and --end END start and end time to select time window for merging logs Caveats: new. no pip install yet. so clone the code or download perhaps I jumped the gun on covering this, but it’s cool Michael #2: The third and final Python 3.12 RC is out now Get your final bugs fixed before the full release Call to action: We strongly encourage maintainers of third-party Python projects to prepare their projects for 3.12 compatibilities during this phase How to test. Discussion on the issue. Count down until October 2nd, 2023. Brian #3: The Python dictionary dispatch pattern I kinda love (and hate) jump tables in C We don’t talk about dictionary dispatch much in Python, so this is nice, if not dangerous. Short story: you can store lambdas or functions in dictionaries, then look them up and call them at the same time. Also, I gotta shout out to the first blogroll I’ve seen in a very long time. Should we bring back blogrolls? Michael #4: Visualizing the CPython Release Process by Seth Larson Here’s the deal (you should see the image in the article 😉 ) Freeze the python/cpython release branch. This is done using GitHub Branch Protections. Update the Release Manager's fork of python/cpython. Run Python release tools (release-tool, blurb, sphinx, etc). Push diffs and signed tag to Release Manager's fork. Git tag is made available to experts for Windows and macOS binary installers. Source tarballs, Windows, and macOS binary installers built and tested concurrently. 6a: Release manager builds the tgz and tar.xz source files for the Python release. This includes building the updates documentation. 6b: Windows expert starts the Azure Pipelines configured to build Python. 6c: macOS Expert builds the macOS installers. All artifacts (source and binary) are tested on their platforms. Release manager signs all artifacts using Sigstore and GPG. All artifacts are made available on python.org. After artifacts are published to python.org, the git commit and tag from the Release Manager's fork is pushed to the release branch. Extras Brian: The Complete pytest Course, part 2, Ch 7 Testing Strategy went up this weekend. Only 9 more chapters to go “Test & Code” → “Python Test” Full version: “The Python Test Podcast” → “Test & Code” → “Python Test” Also: “Python (Bytes | People | Test)” Michael: If you’re at PyBay, come say “hi” EuroPython 2023 Videos up Django + HTMX has a few days of early-bird discount left Joke: Are you sleeping?
#353 Hatching Another Episode
Topics covered in this episode: OverflowAI Switching to Hatch Alpha release of the Ruff formatter What is wrong with TOML? Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python Testing with pytest, full 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: OverflowAI Integration of generative AI into our public platform, Stack Overflow for Teams, and brand new product areas, like an IDE integration. Have a conversation about the search results and proposed answer with GenAI Coming with IDE integration too. Check out the video on their page for some more detail than the article. Brian #2: Switching to Hatch Oliver Andrich Hatch has some interesting features Template built from hatch new myproject includes isolating dev, test, lint virtual environments. Each env can have scripts Test matrix ala tox, but possibly easier to express complex matrices. May not even need tox then, but then now you have hatch. A way to specify which optional dependencies needed for default environment. Notes from Brian One premise is that lots of projects are now using hatch. I don’t know if that’s true. A quick spot check of a few projects include projects that use hatchling. While hatchling is the back end to hatch, they are not the same. I use hatchling a lot now, but haven’t picked up using hatch. But I do want to try it more after reading this article. Michael #3: Alpha release of the Ruff formatter vis Sky Kasko Charlie Marsh announced that an alpha version of a Ruff formatter has been released in Ruff v0.0.289. The formatter is designed to be a drop-in replacement for Black, but with an excessive focus on performance and direct integration with Ruff. Sky says: I can't find any benchmarks that have been released yet, but I did some extremely unscientific testing and found the Ruff formatter to be around 5 to 10 times faster than Black when running on already-formatted code or in a small codebase, and 75 times faster when running on a large codebase of unformatted code. (The second outcome probably isn't very important since most people would not often be formatting thousands of lines of completely unformatted code.) For more info, see the README: https://github.com/astral-sh/ruff/blob/main/crates/ruff_python_formatter/README.md Brian #4: What is wrong with TOML? Colm O'Connor Suggested by Will McGugan This is a comparison of TOML vs StrictYAML under the use case of “readable story tests”. TLDR; For smallish things like pyproject.toml, toml is fine. For huge files, something like StrictYAML may be less horrible. from Brian: Short answer: Nothing, unless you’re doing crazy things with it. Re “readable story tests”: WTF? Neither of these are something I’d like to maintain. Extras Brian: Python Testing with pytest, the course New intro video to explain what the course is about Using Teachable video like notes, mini-viewer, and speed controls Chapter on “Testing Strategy” is next Michael: HTMX + Django: Modern Python Web Apps, Hold the JavaScript Course Coding in Rust? Here's a New IDE by JetBrains Delightful Machine Learning Apps with Gradio out on Talk Python Joke: The 5 stages of debugging
#352 Helicopter Time Comes to Python
Topics covered in this episode: Heliclockter - Like datetime, but more timezone-aware Wagtail 5 Git log customization MiniJinja template engine Extras Joke Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast 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: Heliclockter - Like datetime, but more timezone-aware Suggested by Peter Nilsson The library exposes 3 classes: datetime_tz, a datetime ensured to be timezone-aware. datetime_local, a datetime ensured to be timezone-aware in the local timezone. datetime_utc, a datetime ensured to be timezone-aware in the UTC+0 timezone. Michael #2: Wagtail 5 Wagtail is the leading open-source Python CMS, based on Django. Anything you can do in Python or Django, you can do in Wagtail. Wagtail 5.0 provides even more options for your content creation experience Dark mode has arrived SVG support Enhanced accessibility checker Delete more safely Some breaking changes in it because this release removes some of the old code paths that were maintained to give people more time to adapt their code to the new upgrades Add custom validation logic to your Wagtail projects. You can now attach errors to specific child blocks in StreamField. Brian #3: Git log customization Justin Joyce Just a simple git log --oneline makes the log so much more readable, but don’t stop there. --graph helps to show different branches -10 shows the last 10 commits. And this beauty in .gitconfig makes git lg mostly do what you want most of the time: [alias] lg = log --graph -10 --format='%C(yellow)%h%Creset %s %Cgreen(%cr) %C(bold blue)[HTML_REMOVED]%Creset' Michael #4: MiniJinja template engine MiniJinja is a powerful but minimal dependency template engine for Rust compatible with Jinja/Jinja2 Comes with integration back into Python via minijinja-py package. MiniJinja has a stronger sandbox than Jinja2 and might perform ever so slightly better in some situations. However you should be aware that due to the marshalling that needs to happen in either direction there is a certain amount of loss of information. Compiles to WebAssembly Extras Brian: The pytest Primary Power course is ready. To celebrate wrapping up the first course, pytest Primary Power is $49, the bundle is $99. Bundle: This + next 2 courses + access to repo, discussion forum, Slack, and Discord Michael: New HTMX, language course, and data science course coming at Talk Python. Add your name here to get notified. I’ll be at PyBay 2023 on Oct 8, 2023 Use "friendofspeaker" with for a 20% discount on the regular tickets. Follow up from docstrings: From Rhet John Hagen: You can certainly omit the type information from the docstring when you are using typehints. This is the way I've seen almost all modern usages of Google style docstrings nowadays. They still have some examples that include the type information because the original standard pre-dated Python 3 type annotations. Here is a simple example: https://github.com/johnthagen/python-blueprint/blob/main/src/fact/lib.py#L5 This also shows off the next point that you brought up: can I document all of the exceptions that a function could raise. Google docstrings have the "Raises:" block for this, and I find it pretty nice and concise for when this is needed. Also, PyCharm can be configured to autocomplete and render Google style docstrings https://www.jetbrains.com/help/pycharm/settings-tools-python-integrated-tools.html Tools | Python Integrated Tools | Docstrings | Docstring Format: Google What's nice about this, is that then PyCharm will render the google style docstrings in the Quick Doc function (Ctrl+Q), making the headers bold and larger and lists look nice so it's easy to read. Joke: Fully optimized my algorithm
#351 A Python Empire (or MPIRE?)
Topics covered in this episode: mpire mopup - the macOS Python.org Updater Immortal Objects for Python Common Docstring Formats in Python Extras Joke Watch on YouTube About the show Sponsored by Sentry: pythonbytes.fm/sentry 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: mpire A Python package for easy multiprocessing, but faster than multiprocessing MPIRE is faster in most scenarios, packs more features, and is generally more user-friendly than the default multiprocessing package. Tons of features. Nice intro article with benchmarks. Brian #2: mopup - the macOS Python.org Updater Glyph Lefkowitz On a mac, install Python with the standard Python.org installer. Then, periodically, update with python3 -m mopup I just did it and went from Python 3.11.4 to 3.11.5 See also Get Your Mac Python From Python.org for reasons to use python.org over other ways, also from Glyph. Michael #3: Immortal Objects for Python Instagram has introduced Immortal Objects – PEP-683 – to Python. Brian #4: Common Docstring Formats in Python Scott Robinson I don’t mean to disrespect Scott, but I’m honestly curious if this is really common. I like docstrings for the “why” of a function. And prefer type hints for types. Let me know what you use, at @brianokken@fosstodon.org Extras Brian: In search for a working retro Lunar Lander in Python Michael: Releases follow up North Korean hackers behind malicious VMConnect PyPI campaign Joke: It’s Bingo Time!
#350 You've Got The Stamina For This Episode
Topics covered in this episode: Make Each Line Count, Keeping Things Simple in Python Parsel A Comprehensive Guide to Python Logging with Structlog Stamina Extras Joke Watch on YouTube About the show Sponsored by Sentry: pythonbytes.fm/sentry 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: Make Each Line Count, Keeping Things Simple in Python Bob Belderbos Some great tips to help you simplify your Python code to make it more understandable and maintainable. Michael #2: Parsel Parsel is a BSD-licensed Python library to extract data from HTML, JSON, and XML documents. Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors. It supports: CSS and XPath expressions for HTML and XML documents JMESPath expressions for JSON documents Regular expressions # Want a RSS feed detail from a website standard HTML? selector = parsel.Selector(text=html_text) for link in selector.css('head > link'): rel = link.xpath('.//@rel').get() rel_type = link.xpath('.//@type').get() href = link.xpath('.//@href').get() Brian #3: A Comprehensive Guide to Python Logging with Structlog Stanley Ulili structlog is an awesome logging tool, and already has great documentation. However, this article is a great starting point, highlighting: how easy it is to get started using structlog configuring the default log level changing the formatting customizing the time stamp adding custom fields adding contextual data filtering async … Michael #4: Stamina via Matthias Bach, by Hynek Production-grade Retries Made Easy stamina is an opinionated wrapper around the great-but-unopinionated Tenacity package. Its goal is to be as ergonomic as possible, while doing the right thing by default, while minimizing potential for misuse. General additions on top of Tenacity Retry only on certain exceptions. Exponential backoff with jitter between retries. Limit the number of retries and total time. Automatic async support. Preserve type hints of the decorated callable. Count (Prometheus) and log (structlog) retries with basic metadata, if they’re installed. Easy global deactivation for testing. Extras Brian: The “pytest fixtures” chapter of the pytest course is available now. Also, the PYTHONBYTES 20% discount still active for bundle through the end of August. Michael: Python 3.12.0 release candidate 1 released PyCon UK: The conference takes place from the 22nd to the 25th of September in Cardiff, Wales. The schedule is available at 2023.pyconuk.org/schedule/ and tickets are available at 2023.pyconuk.org/tickets/. PyData Eindhoven 2023, Nov 30 CFP open PyData Seattle Language Creators Charity Fundraiser: Adele Goldberg - Smalltalk, Guido Van Rossum, Anders Hejlsberg, C#, and James Gosling - Java. September 19, 2023: 12:00 - 4:00 PM, in person only. Joke: Librarian chatgpt-failures
#349 Djangonauts: Ready for Takeoff!
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast 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: Omnivore app Omnivore is the free, open source, read-it-later app for serious readers. Distraction free. Privacy focused. Open source. Designed for knowledge workers and lifelong learners. Save articles, newsletters, and documents and read them later — focused and distraction free. Add notes and highlights. Organize your reading list the way you want and sync it across all your devices. Syncs with popular Personal Knowledge Management systems including Logseq and Obsidian Wait, what’s Logseq? :) A privacy-first, open-source platform for knowledge management and collaboration. Kinda like Notion? Brian #2: Djangonaut.space “Where contributors launch” This is a group mentoring program where individuals will work self-paced in a semi-structured learning environment over the course of three months. Djangonauts are members of the community who wish to level up their current Django code contributions and potentially take on leadership roles in Django in the future. Michael #3: Server-side hot reload Thanks to Alex Riviere for some improvements Bill Mill suggests websockets and Adam Johnson points he built something like this for Django (sorta) with django-browser-reload To make it work just: Include this script in your web projects for dev-time auto reloading of web browser when any change is detected in content. Works across all web technologies, built out on a FastAPI / Tailwind project. General workflow looks like: Edit the source CSS file Tailwind watcher generates a built CSS file Built CSS file is included the Python web HTML template Template appends a hash ID for the state of the CSS file Changes to the source CSS thus trigger a change in the final ID New ID means the page contents change and the script does a reload Even works for static resources if you put a “version” indicator on them: [HTML_REMOVED] [HTML_REMOVED] Brian #4: Python in Excel Anaconda working with Microsoft to have Python built in to Excel. “Python in Excel is currently in preview and is subject to change based on feedback. To use this feature, join the Microsoft 365 Insider Program and choose the Beta Channel Insider level.” from Microsoft Support article: Getting started with Python in Excel Extras Brian: Working on videos for “Ch3 : pytest Fixtures” for the Python Testing with pytest Course Bundle Adding some drawings and some more bonus videos. Thanks to everyone who’s signed up already. I’ve pushed the 20% discount out till the end of August. I also finally listed it on pythontest.com/courses Also lots of new interviews for pythonpeople.fm, and I’m expecting at least one new episode of testandcode.com this week. It’s going to be a busy week. Michael: PyCon Sweden CFP is open Be on Talk Python around Mobile Apps? Joke: The Password Game KennyLog-in.com - secure password generator
#348 JavaScript in Your Python
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast 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: Differentiating between writing down dependencies to use packages and for packages themselves Brett Cannon Why can’t we just use pyproject.toml and stop using requirements.txt? Nope. At least not yet. They’re currently for different things. pyproject.toml There’s project.dependencies and project.optional-dependencies.tests that kinda would work for listing dependencies for an app. But you can’t say pip install -r pyproject.toml. It doesn’t work. And that’s weird. project is intended for packaged projects. requirements.txt for applications and other non-packaged projects It has specific versions works great with pip What then? Either we stick with requirements.txt Or we invent some other file, maybe requirements.toml? Or maybe (Brian’s comment), add something like [application] and application.dependencies and application.optional-dependencies.tests to pyproject.toml Michael #2: PythonMonkey PythonMonkey is a Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment. This product is in an early stage, approximately 80% to MVP as of July 2023. It is under active development by Distributive. External contributions and feedback are welcome and encouraged. It will enable JavaScript libraries to be used seamlessly in Python code and vice versa — without any significant performance penalties. Call Python packages like NumPy from within a JavaScript library, or use NPM packages like [crypto-js](https://www.npmjs.com/package/crypto-js) directly from Python. Executing WebAssembly modules in Python becomes trivial using the WebAssembly API and engine from SpiderMonkey. More details in Will Pringle’s article. Brian #3: Quirks of Python package versioning Seth Larson Yes, we have SemVer, 1.2.3, and CalVer, 2023.6.1, and suffixes for pre-release, 1.2.3pre1. But it gets way more fun than that, if you get creative Here’s a few v is an optional prefix, like v.1.0 You can include an “Epoch” and separate it from the version with a !, like 20!1.2.3 Local versions with alphanumerics, periods, dashes, underscores, like 1.0.0+ubuntu-1. PyPI rejects those. That’s probably good. Long versions. There’s no max length for a version number. How about 1.2.3.4000000000000000001? Pre, post, dev aren’t mutually exclusive: 1.0.0-pre0-post0-dev0 More craziness in article - Michael #4: bear-type Beartype is an open-source PEP-compliant near-real-time pure-Python runtime type-checker emphasizing efficiency, usability, and thrilling puns. Annotate @beartype-decorated classes and callables with type hints. Call those callables with valid parameters: Transparent Call those callables with invalid parameters: Boom Traceback: raise exception_cls( beartype.roar.BeartypeCallHintParamViolation: @beartyped quote_wiggum() parameter lines=[b'Oh, my God! A horrible plane crash!', b'Hey, everybody! Get a load of thi...'] violates type hint list[str], as list item 0 value b'Oh, my God! A horrible plane crash!' not str. Extras Brian: Python Testing with Pytest Course Bundle: Limited Pre-Release Beta Use code PYTHONBYTES now through Aug 17 for 20% discount What’s a pre-release beta? There’s a video. Check out the link. Error-tolerant pytest discovery in VSCode Finally! But you gotta turn it on. Also, I gotta talk to them about the proper non-capitalization of pytest. We’re at RC1 for Python 3.12.0 Hard to believe it’s that time of year again Michael: PyPI hires a Safety & Security Engineer, welcome Mike Fiedler PackagingCon October 26-28 Cloud Builders: Python Conf (born in Ukraine): September 6, 2023 | online Joke: Learning JavaScript
#347 The One About Context Mangers
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast 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: async-timeout An asyncio-compatible timeout context manager. The context manager is useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for() is not suitable. Not finished yet timeout can be rescheduled by shift_by() or shift_to() methods Brian #2: PyPI Project URLs Cheatsheet Daniel Roy Greenfield There’s some cool icons available under “Project Links” on pypi.org project pages. How do you get those? And which ones are available. Daniel has found out where to look, and built us a cheat sheet. Nice. Michael #3: httpx-sse Consume Server-Sent Event (SSE) messages with HTTPX. SSE are super lightweight, server → client only subscriptions. Like websockets but less overhead (especially for iot and mobile devices) httpx-sse provides the connect_sse and aconnect_sse helpers for connecting to an SSE endpoint. The resulting EventSource object exposes the .iter_sse() and .aiter_sse() methods to iterate over the server-sent events. Brian #4: Creating a context manager in Python Trey Hunner Context managers are those things you use in a with block. There’s a bunch of cool built in ones. Building your own is a handy skill to have to clean up your code, and they’re pretty easy, with Trey’s tutorial. Shown is a great example of temporarily modifying an environmental variable. Then he gets into what you need to know about as, __enter__, and __exit__. Extras Brian: I think I’ll nix the intro music to Python People. I didn’t know what music to use, so I re-used the music from Test & Code. And I got some very honest feedback that it just doesn’t fit and was better without it. So I’ll rip it out soon. BTW, next episode to be released is with Bob Belderbos from PyBites. Should be later this week. Michael: Facebook and Instagram start blocking news in Canada Joke: day 1 and I hate it
#346 Have you lost your GIL?
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Python People Podcast 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 Steering Council notice about PEP 703 (Making the Global Interpreter Lock Optional in CPython) Thomas Wouters Suggested by John Hagen “We intend to accept PEP 703, although we’re still working on the acceptance details.” Moving forward in 3 stages short-term, no-GIL experimental build in 3.13 or 3.14 mid-term, declare support for no-GIL version long-term, no-GIL becomes default and remove any vestiges of the GIL No commitment and timeframe is nebuous long-term means 5+ years Need community support “We want to be able to change our mind if it turns out, any time before we make no-GIL the default, that it’s just going to be too disruptive for too little gain.” Michael #2: Google's post-cookie world could turn into DRM for the internet A new authentication system could let websites block extensions or jailbroken devices. Google has been trying to implement plans to move beyond cookies for years without denying its partners the means to sell targeted ads. One recent proposal to guarantee user privacy and security could come at the cost of freedom of functionality. Comments are somewhat interesting. More info in a second article. Vivaldi has a response here. Brave won’t ship with it. Brian #3: How ruff changed my Python programming habits Matthias Kestenholz “…there’s always a trade off between development speed (waiting on git commit is very boring) and strictness. “ “ruff is so fast that enabling additional rules is practically free in terms of speed...” ruff has way more rules since last I checked. They are just mostly turned off by default. The article suggests a bunch to try turning on. See also ruff config settings turn on flake8-bugbear while leaving on defaults with select = ["E", "F", "B"] lots of rules to choose from ruff-pre-commit to run these with pre-commit Michael #4: pathlib api extended to use fsspec backends via Justin Flannery Expanding on the capabilities of fsspec, the same GitHub organization also supports another powerful library called universal_pathlib. universal_pathlib is a python library that aims to extend Python's built-in pathlib.Path api to use a variety of backend filesystems using fsspec. This seamless replacement allows developers to leverage the familiar and powerful pathlib API on any type of filesystem. upath.Path is a drop-in replacement for pathlib.Path and is an excellent addition to your toolkit. Joke: Understanding pointers
#345 Some Big Time Releases
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Python People Podcast 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: Cython 3.0 Long in development, the new major release of the Python-to-C compiler sheds legacy Python support and readies Cython developers for big changes in Python. Cython 3 cleans up and modernizes Cython. Pure Python mode allows Python developers to use their existing Python linting and code analysis tools on Cython. Brian #2: Reading code : An important but seldom-discussed skill Eric Matthes A cool walk through of several techniques to read code Strategies Ignore function definitions And in the example, also ignore comments Simplify repetitive blocks Examples shows mentally lumping a bunch of print statements into “print message” Utilize IDE tools, like folding to hide functions your not looking at Also includes a note about writing readable code. Notes: People believe your function and variable names, they should be descriptive, and they should not be deceptive. Michael #3: Major new version of MicroPython: v1.20.0 via Matt Trentini >10 months, >1000 mainline commits from >100 contributors This release of MicroPython introduces a new lightweight package manager called mip. In the MicroPython runtime, core/built-in types have been compressed by only including in the C-level type struct as many slots for C function pointers as is needed for a given type → Any third-party C extensions will need to be updated to work with this change. Massive list of detailed changes. Brian #4: Advanced Python Tips for Development Scofield Idehen There’s 15 in the article, here’s a few 1 & 2. Use List Comprehensions and Generator Expressions. It’s cool to see them side by side enumerate() is fun Embrace zip(). It’s weird, but very useful. Utilize slots to Reduce Memory Usage Extras Brian: Hear the story behind the quote “I came for the language, but I stayed for the community.” and learn about fountain pens, tea, and a Murderbot, on this week‘s Python People. Michael: Search (LLM like) Talk Python: explore-talk-python-to-me.streamlit.app by Aguss Joke: You’re full stack now Seriously, take the HTMX course :)
#344 AMA: Ask Us Anything
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast 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. Main topic: AMA questions from the audience. Use the transcript search to find timestamps if you want to locate a particular one. Extras Michael: Deputy CPython Developer in Residence position accepting applications. My Make Your Python Web App Fly Around the World with CDNs talk at PWC 2023 is online. “Joke”: Ode to Python recommended by FelixTheCat
#343 So Much Pydantic!
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast 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: Pydantic v2 released Pydantic V2 is compatible with Python 3.7 and above. There is a migration guide. Check out the bump-pydantic tool to auto upgrade your classes Brian #2: Two Ways to Turbo-Charge tox Hynek Not just tox run-parallel or tox -p or tox --``parallel , but you should know about that also. The 2 ways Build one wheel instead of N sdists Run pytest in parallel tox builds source distributions, sdists, for each environment before running tests. that’s not really what we want, especially if we have a test matrix. It’d be better to build a wheel once, and use that for all the environments. Add this to your tox.ini and now we get one wheel build [testenv] package = wheel wheel_build_env = .pkg It will save time. And a lot if you have a lengthy build. Run pytest in parallel, instead of tox in parallel, with pytest -n auto Requires the pytest-xdist plugin. Can slow down tests if your tests are pretty fast anyway. If you’re using hypothesis, you probably want to try this. There are some gotchas and workarounds (like getting coverage to work) in the article. Michael #3: Awesome Pydantic A curated list of awesome things related to Pydantic! 🌪️ Notable items for me: ML: spaCy 🌟(26575) - spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more. ray 🌟(26496) - Ray provides a simple, universal API for building distributed applications. jina 🌟(18734) - Jina is geared towards building search systems for any kind of data, including text, images, audio, video and many more. With the modular design & multi-layer abstraction, you can leverage the efficient patterns to build the system by parts, or chaining them into a Flow for an end-to-end experience. Data Beanie 🌟(1287) - Beanie - is an Asynchronous Python object-document mapper (ODM) for MongoDB, based on Motor and Pydantic. Utilities datamodel-code-generator 🌟(1694) - Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources. Goodconf 🌟(99) - A thin wrapper over Pydantic's settings management. Allows you to define configuration variables and load them from environment or JSON/YAML file. Also generates initial configuration files and documentation for your defined configuration. Brian #4: CLI tools hidden in the Python standard library Simon Willison (and hat tip to Seth Larson) Simon looked for all of the command line goodies in the standard library. I knew about python -m http.server to run a server at port 8000 from the local directory, but there’s so much more. Here are a few python -m gzip --decompress pypi.db.gz as a gzip utility. Especially handy on Windows as it doesn’t come with gzip by default python -m base64 with -d decode, -e encode, and -t encode and decode python -m asyncio for an asyncio REPL Tokenize a Python file with python -m tokenize somefile.py View the AST with python -m ast somefile.py Pretty print JSON with python -m json.tool Extras Brian: Congrats to Seth Larson, PSFs first Security Developer-in-Residence Announcing Our New Security Developer in Residence! - PSF announcement I am the first PSF Security Developer-in-Residence - Seth’s announcement PythonPeople.fm is live "The NEW podcast about the people who make the Python community awesome.” I’m focusing more on the people, and less on the tech. First episode is with Michael Kennedy Upcoming episodes in the works with Paul Everitt, Paul McGuire, and Steve Holden. More people scheduled, many asked, and many more to be asked. Michael: MongoDB with Async Python course is out! (talkpython.fm/async-mongodb) Meta commits to dedicate three engineer-years to implement the removal of the GIL from Python PyPI has a blog Joke: Containers, that’ll fix it Bonus dad joke: 5 ants rent an apartment. Invite 5 other ants to share the rent. Now there are tenants.
#342 Don't Believe Those Old Blogging Myths
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast 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: Plumbum: Shell Combinators and More Suggested by Henry Schreiner last week. (Also, thanks Michael for the awesome search tool on PythonBytes.fm that includes transcripts, so I can find stuff discussed and not just stuff listed in the show notes.) Plumbum is “ a small yet feature-rich library for shell script-like programs in Python. The motto of the library is “Never write shell scripts again”, and thus it attempts to mimic the shell syntax (shell combinators) where it makes sense, while keeping it all Pythonic and cross-platform.” Supports local commands piping redirection working directory changes in a with block. So cool. lots more fun features Michael #2: Our plan for Python 3.13 The big difference is that we have now finished the foundational work that we need: Low impact monitoring (PEP 669) is implemented. The bytecode compiler is a much better state. The interpreter generator is working. Experiments on the register machine are complete. We have a viable approach to create a low-overhead maintainable machine code generator, based on copy-and-patch. We plan three parallelizable pieces of work for 3.13: The tier 2 optimizer Enabling subinterpreters from Python code (PEP 554). Memory management Details on superblocks Brian #3: Some blogging myths Julia Evans <from Brian: I’m not sure if I’m including this to convince all of you to blog more, or to convince myself. Hopefully both happens.> myths (more info of each in the blog post): you need to be original you need to be an expert posts need to be 100% correct writing boring posts is bad you need to explain every concept page views matter more material is always better everyone should blog I’d add Write posts to help yourself remember something. Write posts to help future prospective employers know what topics you care about. You know when you find a post that is outdated and now wrong, and the code doesn’t work, but the topic is interesting to you. Go ahead and try to write a better post with code that works. Michael #4: Jupyter AI A generative AI extension for JupyterLab An %%ai magic that turns the Jupyter notebook into a reproducible generative AI playground. This works anywhere the IPython kernel runs (JupyterLab, Jupyter Notebook, Google Colab, VSCode, etc.). A native chat UI in JupyterLab that enables you to work with generative AI as a conversational assistant. Support for a wide range of generative model providers and models (AI21, Anthropic, Cohere, Hugging Face, OpenAI, SageMaker, etc.). Official project from Jupyter Provides code insights Debug failing code Provides a general interface for interaction and experimentation with currently available LLMs Lets you collaborate with peers and an Al in JupyterLab Lets you ask questions about local files Video presentation: David Qiu - Jupyter AI — Bringing Generative AI to Jupyter | PyData Seattle 2023 Extras Brian: Textual has some fun releases recently Textualize youtube channel with 3 tutorials so far trogon to turn Click based command line apps into TUIs video example of it working with sqlite-utils. Python in VSCode June Release includes revamped test discovery and execution. You have to turn it on though, as the changes are experimental: "python.experiments.optInto": [ "pythonTestAdapter", ] I just turned it on, so I haven’t formed an opinion yet. Michael: Michael’s take on the MacBook Air 15” (black one) Joke: Phishing
#341 Shhh - For Secrets and Shells
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast 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: Pydantic roadmap via Mario Munoz Back in February [Samuel] [announced](https://pydantic.dev/announcement/) Pydantic Inc., but I didn't explain what services we were building. The problem is that even with Pydantic in your corner, working with data when it leaves Python often still sucks. We want to build a data platform to make working with data quick, easy, and enjoyable — where developer experience is our north star. There are five key components to the Pydantic Data Platform that we're thinking of building. Python Analytics/Observability — a logging and metrics platform with tight Python and Pydantic integration, designed to make the data flowing through your application more readily usable for both engineering and business analytics. More info... Data Gateway for object stores — Add validation, transformation and cataloguing in front of object stores like S3, with a schema defined in Pydantic models then validated by our Rust service. More info... Data Gateway for data warehouses — the same service as above, but integrated with your existing data warehouse. More info... Schema Catalog — for many, Pydantic already holds the highest fidelity representation of their data schemas. Our Schema Catalog will take this to the next level, serving as an organization-wide single source of truth for those schemas, tracking their changes, and integrating with our other tools and your wider platform. More info... Dashboards and UI powered by Pydantic models — a managed platform to deploy and control dashboards, auxiliary apps and internal tools where everything from UI components (like forms and tables) to database schema would be defined in Python using Pydantic models. More info... Tell them what you think with their survey Brian #2: The Right Way to Run Shell Commands From Python Martin Heinz Should have a tagline of “especially if you’re on Mac or Linux”. Includes discussion of Python native tools - recommended a few os module functions - but otherwise avoid relying too much on os. subprocess.run() - stick with run() if you can. sh third party package - should be second choice if on Linux or Mac Michael #3: US: Yep, We're Buying Your Data, Including Your Embarrassing Secrets Digital information can be purchased from commercial data brokers and 'deanonymized' to ID the person it's tied to, including US citizens, the Office of the Director of National Intelligence says. The Office of the Director of National Intelligence (ODNI) on Friday declassified(Opens in a new window) a report from January 2022 that outlines the US government’s approach to using Commercially Available Information (CAI), which can come from data brokers working in the internet ad and analytics industries. The purchased information includes details from users' smartphones and social media accounts. To all the “please disable your ad blockers” companies out there 1) It’s not just about supporting your website 2) Ad blockers are not just avoiding ads. 3) It’s not even necessary (our ads are not blocked on the podcast or the website) Consider browser != Chrome and/or nextdns.io for your whole network Brian #4: Pro-Tip – pytest fixtures are magic! Frank Wiles “The magic of pytest fixtures is how they are injected into your tests for you to use and their composability. When done well, writing tests is considerably easier and actually fun.” Setup code is often the biggest headache of test writing. pytest fixtures help solve the setup problem. Fixtures are used by just including them in a tests parameter list can build on top of each other can be used in any test in the project, if you put it in a central conftest.py can return all kinds of things: static data, instantiated objects, callables to make other things, Frank includes an interesting way to organize fixtures such that they are defined in local test directories but usable across a project, under “Organizing Your Fixtures”. Plugins with fixtures: A shoutout to pytest-django and a Revsys plugin called django-test-plus. Built-in fixtures. See also tmp_path. autouse One bit of incorrect info: autouse doesn’t work like that. The value of global_thing cannot be grabbed unless you list it in the parameter list. It will run before every function (since it’s scope=``"``function``" by default), but you gotta list it to get the value. To be fair, it’s really hard to come up with good autouse examples. Partly because there are so few good reasons to use autouse. Extras Brian: Porting Python projects to Rust International Obfuscated Python Code Competition Michael: Remember the AMA (submit your question). “Scheduled” on July 11th at 11am. Joke: Marked as duplicate