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.
#340 Snorkel not included
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. 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. Ask me anything episode: Submit your question(s) for our upcoming AMA episode: form here. Thank you! Brian #1: PythonGUIS Martin Fitzpatrick A site with a collection of resources, guides, books, comparisons, etc, around GUIs in Python. Martin recommends starting with PyQT6 However, there are tutorials covering PyQT6 PySide6 PyQT5 TkInter PySide even Kivy Michael #2: JupyterLab 4.0 is Here The next major release of our full-featured development environment You can upgrade by running pip install --upgrade jupyterlab or conda install -c conda-forge jupyterlab. JupyterLab is now faster, thanks to improvements such as CSS rules optimization, CodeMirror 6, MathJax 3, and notebook windowing. JupyterLab 3 was when working with large notebooks. There are additional performance improvements available via opt-in settings: Faster tab-switching on Chromium browsers: “Settings” → “JupyterLab Shell” → switch “Hidden mode” to “contentVisibility” Better performance with long notebooks: “Settings” → “Notebook” → switch “Windowing mode” to “full” An upgraded text editor. Better real time collaboration. Bug fixes. More than 100 bugs have been addressed and resolved, enhancing JupyterLab’s stability and performance. Brian #3: Proposing a struct syntax for Python Brett Cannon This would be a cool syntax for a data only type: struct Point(x: int, y: int) No positional only parameters No inheritance No methods Instances would be immutable, so p = Point(1, 2) would create an object that could be used as a key. A data only focused set of types. Michael #4: Python 3.13 Removes 20 Stdlib Modules via PyCoders From PEP 594 – Removing dead batteries from the standard library we’re saying goodbye to aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib As well as the 2to3 program and lib2to3 module in Python. Python 3.12 final release is scheduled in 4 months (October 2023) and Python 3.13 final release is scheduled in 1 year and 4 months (October 2024). Extras Brian: Affirming your PSF Membership voting status You have until June 15 to affirm your voting rights in the upcoming Board Election, if you care about such things. Michael: 5 Career Tips for Budding Python Developers video PyCon US 2023 videos are up Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 beta 2 are now available Joke: Snorkel not included
#339 Actual Technical People
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. 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: pystack PyStack is a tool that uses forbidden magic to let you inspect the stack frames of a running Python process or a Python core dump, helping you quickly and easily learn what it's doing. PyStack has the following amazing features: 💻 Works with both running processes and core dump files. 🧵 Shows if each thread currently holds the Python GIL, is waiting to acquire it, or is currently dropping it. 🗑️ Shows if a thread is running a garbage collection cycle. 🐍 Optionally shows native function calls, as well as Python ones. In this mode, PyStack prints the native stack trace (C/C++/Rust function calls), except that the calls to Python callables are replaced with frames showing the Python code being executed, instead of showing the internal C code the interpreter used to make the call. 🔍 Automatically demangles symbols shown in the native stack. 📈 Includes calls to inlined functions in the native stack whenever enough debug information is available. 🔍 Optionally shows the values of local variables and function arguments in Python stack frames. 🔒 Safe to use on running processes. PyStack does not modify any memory or execute any code in a process that is running. It simply attaches just long enough to read some of the process's memory. ⚡ Optionally, it can perform a Python stack analysis without pausing the process at all. This minimizes impact to the debugged process, at the cost of potentially failing due to data races. 🚀 Super fast! It can analyze core files 10x faster than general-purpose tools like GDB. 🎯 Even works with aggressively optimized Python interpreter binaries. 🔍 Even works with Python interpreters' binaries that do not have symbols or debug information (Python stack only). 💥 Tolerates memory corruption well. Even if the process crashed due to memory corruption, PyStack can usually reconstruct the stack. 💼 Self-contained: it does not depend on external tools or programs other than the Python interpreter used to run PyStack itself. Brian #2: Securing PyPI accounts via Two-Factor Authentication Donald Stufft “… every account that maintains any project or organization on PyPI will be required to enable 2FA on their account by the end of 2023.” “One of the key security promises that PyPI makes is that when you're downloading something, that only the people associated with that project are going to be able to upload, delete, or otherwise modify a project. That when you look at that project and see that it is owned by someone that you trust, that you can be assured that nobody else is making changes to that package on PyPI.” If you maintain a package on PyPI to a point where you are uploading to PyPI or plan to soon, enable 2FA on you account. May as well do it sooner than later. But officially, you have the rest of the year. This has already been a requirement for “critical projects” since last summer. (top 1% of downloads, about 3,500 projects.) See episode 293. Now it’s going to be for everyone. Michael #3: Propan - a declarative Python MQ framework Propan is a powerful and easy-to-use Python framework for building asynchronous web services that interact with any MQ Broker. It's following by fastapi, simplify Message Brokers around code writing and provides a helpful development toolkit, which existed only in HTTP-frameworks world until now. It is a modern, high-level framework on top of popular specific Python brokers libraries, based on pydantic and fastapi, pytest concepts. The key features are Simple: Designed to be easy to use and learn. Intuitive: Great editor support. Autocompletion everywhere. Dependencies management: Minimization of code duplication. Access to dependencies at any level of the call stack. Integrations: Propan is fully compatible with any HTTP framework you want MQ independent: Single interface to popular MQ: Redis (based on redis-py) RabbitMQ (based on aio-pika) Kafka (based on aiokafka) SQS (based on aiobotocore) Nats (based on nats-py) RPC: The framework supports RPC requests over MQ, which will allow performing long operations on remote services asynchronously. Great to develop: CLI tool provides great development experience: framework-independent way to manage the project environment application code hot reload robust application templates Testability: Propan allows you to test your app without external dependencies: you do not have to set up a Message Broker, you can use a virtual one! Brian #4: Makefile tricks for Python projects Ricardo Ander-Egg A pretty short basic starter template Makefile for Python projects with some cool snippets. Some default settings to have make behave sanely exit on error, warn about undefined variables, disable built-in rules set up working directory correctly if called from a different dir A $(py) definition that picks up the virtual environment if it’s there. Also $(pip) from the virtual env. Default goal and help message cool trick so that make with no arguments just prints the help And also picks up target comments as help text for the target. Neat. Injecting paths into PYTHONPATH, and an example on how that works if you need it. A .venv target create a virtual environment, update setuptools, wheel, build, and install requirments Extras Michael: PyCon Portugal CFP DjangoCon 2024 Apple Vision Pro Duet App Joke: Actual technical people
#338 Scripting iOS with Python
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 Special guest: GUEST_PROFILE 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: The Basics of Python Packaging in Early 2023 Jay Qi Good description of a minimal-ish pyproject.toml file, which includes a build backend and project metadata. That’s all you need for a Python-only project. Discussion of how to choose a build backend. Mostly it’s baed on extra features you might want, like hatchling’s include/exclude features for source distributions. Some discussion of frontend choices. Nice discussion of non-Python-only builds. Specifically, if you need to compile C or C++ extensions, you can use scikit-build-core, or meson-python, or setuptools. Related: "Sharing is Caring - Sharing pytest Fixtures" by Brian Okken (PyCascades 2023) My PyCascades 2023 on packaging pytest plugins is up on YouTube Michael #2: vecs via Oli Python collection-like interface to storing and searching vectors in postgres. Vector search is a key component in building AI chatbots, and semantic document search. If you're familiar with the space, it's effectively Pinecone built on free OSS It's under the Supabase github org but it's fully open source, and compatible with any pgvector vendor, e.g. RDS, or locally in docker If you’re on macOS and need Postgres, Postgres App is a good option. Brian #3: Introducing Grasshopper - An Open Source Python Library for Load Testing Jacob Fiola “Grasshopper is a library for automated load testing, written in Python.” Open source project from Alteryx, On GitHub and PyPI under the name locust-grasshopper Built on Locust. Adds Tag-based suites for trend analysis and evaluating changes. Custom trends. Useful for actions that span multiple http calls, and you want to see timing trends for the whole action. Checks. Checks validate boolean conditions in the test. Custom tagging for all metrics Send data to time series db & dashboards. Thresholds. Reporting results to other locations. Some reusable base classes that take care of the majority of the boilerplate that tests often contain Readme has a very thorough introduction including configuration and samples. Michael #4: memocast by Daniel Engvall A small iOS app for e.g. iPhone that allow you to add links heard in podcasts into reminders. Good example of how to use Pythonista to build python scripts for iOS Pythonista just made an update (2 weeks ago) so that'd use Python 3.10 on the iOS which makes it even more interesting. Extras Brian: Help test Python 3.12 beta! Python Language Summit write-ups available PyPI was subpoenaed Michael: You Can Ignore This Post Joke: Careful or you might end up summoning a demon.
#337 Backtracking For a Package
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 Special guest: GUEST_PROFILE 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: Ruff PyCharm plugin via John Hagen Ruff PyCharm plugin has great integration, it will highlight Ruff lint errors in the IDE as you type and you can even apply Alt+Enter (⌥⏎ on Mac) quick fixes through the IDE. Ruff will automatically fix the fixable issues. John also added additional PyCharm-specific instructions for black/Ruff Brian #2: Writing Python like it's Rust Kobzol Rust lessons guiding use of types and type hints in Python Add type hints tun function signatures Use dataclasses instead of tuples or dictionaries to increase clarity and type safety Union types to clarify | typing Michael #3: Pip 23.1 Released - Massive improvement to backtracking Pip 23.1 was released last month Highlight the significant improvement in backtracking that is part of the requirement resolver process in Pip. This process involves Pip finding a set of packages that meet your requirements and whose requirements themselves don't conflict. Prior to Pip 20.3, the default process for Pip would allow conflicting requirements to install if they were transitive dependencies where the last one specified would be the one installed. Once the new resolver was turned on by default it immediately hit problems where backtracking would get stuck for a long time. Pip separates out the resolution logic into a library called resolvelib. It had been discovered that there was a logical error under certain circumstances, and also there was a known better backtracking technique it could employ called backjumping. Both of these were recently fixed and implemented in resolvelib, which were then vendored in to Pip 23.1. Brian #4: Markdown Code Runner markdown-code-runner is a Python package that automatically executes code blocks within a Markdown file, including hidden code blocks, and updates the output in-place. Works with Python & Bash see also cog Extras Michael: Python 3.12.0a7 is out python3 -m venv --upgrade-deps venv (via John Hagen) Talk submissions are now open for both remote and in-person talks at the 2023 PyConZA? The conference will be held on 5 and 6 October 2023 in Durban, South Africa. South Africa is GMT+2, so the times are convenient for Africa, Europe and much of Asia, although probably less so for the rest of the world. All details are on za.pycon.org - via Kim van Wik Trail discovery/riding apps onX offroad Gaia Picture of Michael on one of these trails Joke: User Inyerface
#336 We found one of your batteries
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. 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's Missing Batteries: Essential Libraries You're Missing Out On Martin Heinz Fun collection of a bunch of libraries you may not know about (or forgot about), with code examples. Utilities boltons : iterate through json and dates, quickly grab data out of nested structures, and convert nested data with jsonutils, timeutils, and iterutils sh : conveniently call shell funcitons Data Validation validators : validate email addresses, credit cars, IP addresses, and more. the fuzz : fuzzy string comparisons Debugging stackprinter : nice stack traces with exception messages higlighted Testing freezegun : stop time, change dates, … dirty_equals : comparing things that are kinda equal CLI tqdm : add a progress bar to command line apps Michael #2: awesome-polars A curated list of Polars talks, tools, examples & articles. Mostly articles and tutorials however. Brian #3: Running Headless Selenium in Python (2023) Siddiqi First off, if you are doing automated testing with Selenium, I hope you already know about headless. It’s awesome and speeds up testing. Next, there’s changes to how you code headless, as of Selenium 4.8.0 (Jan. 2023). Old: options.headless` `**=**` `True New: options.add_argument('--headless=new') for Chrome options.add_argument('--headless') for Firefox Reasons: Read Headless is Going Away! post on Selenium blog. Subtitle: “Now that we got your attention, headless is not actually going away, just the convenience method to set it in Selenium” Michael #4: Gracy Gracy helps you handle failures, logging, retries, throttling, and tracking for all your HTTP interactions. Has support for Parsing per status code Throttling Retries Custom validation Record/replay for testing A bit non-pythonic but perhaps inspriation for some out there Extras Michael: Mobile apps are finally out Take the git course for free for a limited time. Michael's blog post announcing the apps Joke: It’s practice
#335 Should you get your mojo on?
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. 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: Introducing 'Trusted Publishers’ PyPI package maintainers can adopt a new, more secure publishing method that does not require long-lived passwords or API tokens to be shared with external systems. Our term for using the OpenID Connect (OIDC) standard to exchange short-lived identity tokens between a trusted third-party service and PyPI. Instead, PyPI maintainers can configure PyPI to trust an identity provided by a given OpenID Connect Identity Provider (IdP). These API tokens never need to be stored or shared rotate automatically by expiring quickly provide a verifiable link between a published package and its source Additional security hardening is available Brian #2: Mojo : a new programming language for all AI developers. Mojo may be the biggest programming language advance in decades - fast.ai blog Suggested by many listeners “Mojo combines the usability of Python with the performance of C, unlocking unparalleled programmability of AI hardware and extensibility of AI models.” A programming language compatible with Python, with performance similar to C++/Rust. “Mojo is designed to become a superset of Python over time by preserving Python’s dynamic features while adding new primitives for systems programming.” - emphasis from Brian It’s not there yet, but still super cool Built on a MLIR, not LLVM “How compatible is Mojo with Python really? Mojo already supports many core features of Python including async/await, error handling, variadics, etc, but… it is still very early and missing many features - so today it isn’t very compatible. Mojo doesn’t even support classes yet!” Michael #3: django-prose Wonderful rich-text editing for your Django project. Rendering rich-text in templates Small rich-text content (as model fields) Django Prose is using Bleach to only allow certain tags and attributes See the website for a screenshot of it in action Brian #4: pylyzer is a static code analyzer / language server for Python, written in Rust. Shunsuke Shibayama Suggested by Owen Features fast detailed analysis type checking plus things like out-of-bounds accesses to lists, and non-existent key references to dicts more readable reports and a VS Code extension pylyzer vs ruff “Ruff, like pylyzer, is a static code analysis tool for Python written in Rust, but Ruff is a linter and pylyzer is a type checker & language server. pylyzer does not perform linting, and Ruff does not perform type checking.” Some limitations and incomplete “todo list”. See README for more details. Joke: Escape Room
#334 Packaging Organizations
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: rye - Python workflow tool Armin Ronacher Rust built tool, currently only for Linux and MacOS Project workflow commands, like init - new project add - add a dependency (including optional) remove - remove a dependency build - build wheel lock - update lock file virtualenv commands add —dev - install in environment sync - install/update dependencies in env based on pyprojec.toml run - run command within environment Install Python fetch - Fetches a Python interpreter for the local machine Register existing Python toolchain Helper utility to manage Python toolchains Kinda like pipx install - Installs a package as global tool uninstall - Uninstalls a global tool I didn’t see that it added anything to my PATH, so this addition made it work: Bonus Everything lives under ~/.rye So it’s easy to stop using, and doesn’t muck up see also Simon Willison’s A few notes on Rye Python Bytes #332, where we talked about huak Michael #2: PyPI Organizations The first step in our plan to build financial support and long-term sustainability of the Python Packaging Index (PyPI) Small fee for organizations rather than individual users Like Github orgs Brian #3: 5 tips to learn any new Python library faster Bob Belderbos The tiips RTFM - at lest the getting started docs Install it Explore the library - play. Bob recommends Jupyter notebook for this. Apply it to a real world problem - deliberate practice Build something with it (bonus) Teach it - blog, TIL, video tutorial, etc. Michael #4: Python gets down to (the) Metal Extras Brian: frogmouth - Markdown viewer / browser for your terminal, built with Textual. Michael: Was going to talk about Serenade, but seems to have gone silent. Packaging follow up discussion. Joke: It’s the progress that counts
#333 Live From PyCon
Watch on YouTube 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.orgx 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: Introducing Microsoft Security Copilot Security Copilot combines this advanced large language model (LLM) with a security-specific model from Microsoft. When Security Copilot receives a prompt from a security professional, it uses the full power of the security-specific model to deploy skills and queries that maximize the value of the latest large language model capabilities. Your data and stays within your control. It is not used to train the foundation AI models, and in fact, it is protected by the most comprehensive enterprise compliance and security controls. Brian #2: PEP 695 – Type Parameter Syntax “This PEP specifies an improved syntax for specifying type parameters within a generic class, function, or type alias. It also introduces a new statement for declaring type aliases.” To get a feel for this, jump to the examples One example Here is an example of a generic function today. from typing import TypeVar _T = TypeVar("_T") def func(a: _T, b: _T) -> _T: ... - And the new syntax. def func[T](a: T, b: T) -> T: ... Michael #3: Auto-GPT An experimental open-source attempt to make GPT-4 fully autonomous. This program, driven by GPT-4, chains together LLM "thoughts", to autonomously achieve whatever goal you set. Features 🌐 Internet access for searches and information gathering 💾 Long-term and short-term memory management 🧠 GPT-4 instances for text generation 🔗 Access to popular websites and platforms 🗃️ File storage and summarization with GPT-3.5 Brian #4: Astral : Ruff is now a company Charlie Marsh announces Astral, starting off with a healthy $4m in seed money. Not a bad start Astral will continue building high-performance developer tools for the Python ecosystem — to keep building Ruff, and to build more Ruff-like things. “to make the Python ecosystem more productive by building high-performance developer tools.” Undoubtedly Rust-ifying more of the Python tool chain. Related: In a discussion at PyCon, someone asked me if Ruff was a replacement for Black. My answer, “not really, more of a flake8 replacement and a few other tools, but a partial overlap with Black. Real answer is at the FAQ Is Ruff compatible with Black? Yes. Ruff is compatible with Black out-of-the-box, as long as the line-length setting is consistent between the two. As a project, Ruff is designed to be used alongside Black and, as such, will defer implementing stylistic lint rules that are obviated by autoformatting.” Extras Brian: Registration open for SciPy 2023 Michael: Android Mobile App is out. Please give us feedback Joke: Releasing to prod
#332 A Python, a Slurpee, and Some Chaos
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. 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: huak - A Python package manager written in Rust. Inspired by Cargo Suggested by Owen Tons of workflows activate - activate a virtual environment add add a dependency to a project pip install it into your virtual environment, and add it to the dependency list in pyproject.toml test - run pytest update update dependencies lint - run ruff, installing it first if necessary fix - autofix fixable lint conflicts build - build wheel in isolated virtual environment using hatchling Honestly I was considering building my own workflow tool, but this is darned close to what I want. Even though it’s still “in an experimental state”. There are rough edges (ruff edges, get it), but still, way cool. I just don’t know how to pronounce it. Is it like “walk”, or more like “whack”? Michael #2: PSF expresses concerns about a proposed EU law that may make it impossible to continue providing Python and PyPI to the European public After reviewing the proposed Cyber Resilience Act and Product Liability Act, the PSF has found issues that put the mission of our organization and the health of the open-source software community at risk. As currently written, the authors of open-source components might bear legal and financial responsibility for the way their components are applied in someone else’s commercial product. The risk of huge potential costs would make it impossible in practice for us to continue to provide Python and PyPI to the European public. Brian #3: ChaosToolkit Suggested by the maintainer, Sylvain Hellegouarch Declare and store your Chaos Engineering experiments as JSON/YAML files so you can collaborate and orchestrate them as any other piece of code. Extensible through an Open API Can be automated in CI/CD pipeline Michael #4: PEP 711 – PyBI: a standard format for distributing Python Binaries “Like wheels, but instead of a pre-built python package, it’s a pre-built python interpreter” Joke: It’s the effort that counts
#331 Python From the Future
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. 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: makeapp via Felix Ingram Simplifies Python application rollout and publishing. Link to its mention on Talk Python. Simplifies Python application rollout and publishing: Make a skeleton for your new application with one console command Automatically create a VCS repository for your application. Automatically check whether the chosen application name is not already in use. Customize new application layouts with skeleton templates. Put some skeleton default settings into a configuration file not to mess with command line switches anymore. Easily add entries to your changelog. Publish your application to remotes (VCS, PyPI) with single command. Brian #2: Looking forward to Python 3.12 We’re on 3.12.0a7 now, the last alpha, final is scheduled for October schedule So far, in 3.12.0a7 What’s new in Python 3.12 page has some examples of the Improved Error Messages Recent addition, PEP 684 - A Per-Interpreter GIL was approved recently “… sufficient isolation would facilitate true multi-core parallelism …” seems like a good thing. But also, “… this is an advanced feature meant for a narrow set of users of the C-API. “, so not really sure how this will affect us. Still, seems cool. Michael #3: Python 3.11.3 is out Fixes a HIGH level CVE in OpenSSL (so patch it) Lots of changes in Core and Builtins Brian #4: How to Make a Great Conference Talk Sebastian Witowski Lots of great advice for tech conf talks. Don’t skip the last half of this, getting your talk accepted is really when the work starts. Good sections to make sure you don’t miss Live demos “First of all - do you really need a demo? …” Rehearsing Don’t skip this. Do this. A lot. Out loud. With a timer. While standing. Memorize the first few minutes, and the last few. Know how you’re going to open and close. Night before get enough sleep Day of eat well. Don’t drink too much liquids. Be comfortable. Sebastian was honest in saying this stuff works for him, but do what works for you. From Brian: I deviate from Sebastian in quite a few places, but still don’t disagree with his advice. I can’t give a talk without slides, as I use them for prompts to know what I’m talking about next. My talks usually have a lot of code snippets. Obviously, that would be difficult without slides. I write my talk and my slides in Markdown. Sebastian writes in something else, then builds slides as visual aids. That’s cool. Do what works for you. Bonus tool from the article: demo-magic - If I’m ever tempted to live code again, I think I’ll try this instead. Extras Michael: NOW the CDN course is out. Django 4.2 released. Joke: Using A.I. for Efficiency
#330 Your data, validated 5x-50x faster, coming soon
Watch on YouTube About the show Sponsored by Influxdb 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: Pydantic V2 Pre Release Terrence Dorsey & Samuel Colvin Alpha release available to everyone: pip install --pre -U "pydantic>=2.0a1" Headlines: pydantic-core - all validation logic rewritten in Rust and moved to separate package, pytest-core 5-50x faster separation will aid safety and maintainability Lots ready for experimentation BaseModel, Dataclasses, Serialization, … Much still under construction Docs, BaseSettings→ pydantic-settings, … Michael #2: microdot The impossibly small web framework for Python and MicroPython Microdot is a minimalistic Python web framework inspired by Flask, and designed to run on systems with limited resources such as microcontrollers. It runs on standard Python and on MicroPython. Support for async, websockets, tls, even ASGI servers. Less mem usage by a big margin. Brian #3: GitHub Actions Tools: watchgha, build and inspect, and pytest annotate failures watchgha Ned Batchelder Watch GH Actions progress on the command line build-and-inspect-python-package Hynek Test the build of wheels, check contents, lint README print sdist contents, wheel contents, and metadata pytest-github-actions-annotate-failures utgwkk Nice traceback annotations for pytest Michael #4: PEP 709 – Inlined comprehensions by Carl Meyer Comprehensions are currently compiled as nested functions, which provides isolation of the comprehension’s iteration variable, but is inefficient at runtime. This PEP proposes to inline list, dictionary, and set comprehensions into the code where they are defined, and provide the expected isolation by pushing/popping clashing locals on the stack. This change makes comprehensions much faster: up to 2x faster for a microbenchmark of a comprehension alone. Extras Michael: Python Web Apps that Fly with CDNs Course Joke: Can’t watch movies
#329 Creating very old Python code
Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. Michael #1: Prefix-cache via Brendan Hannigan You can set an environment variable or use it as a command line argument and then instead of creating tons of __pycache__ folders to store your *.pyc files right next to the source code, it puts them in some specified folder. Introduced in python 3.8. Brian #2: NiceGUI Suggested by several listeners Browser based GUI “NiceGUI is an easy-to-use, Python-based UI framework, which shows up in your web browser. You can create buttons, dialogs, Markdown, 3D scenes, plots and much more. It is great for micro web apps, dashboards, robotics projects, smart home solutions and similar use cases. You can also use it in development, for example when tweaking/configuring a machine learning algorithm or tuning motor controllers.” - from the README Michael #3: flask-ngrok A simple way to demo Flask apps from your machine. Makes your Flask apps running on localhost available over the internet via ngrok. Great for testing API consumers too. app = Flask(__name__) run_with_ngrok(app) # Start ngrok when app is run # Endpoints ... if __name__ == '__main__': app.run() Brian #4: No-async async with Python Will McGugan Allowing async while not requiring async Await me (maybe) borrowed from Simon Willison’s The “await me maybe” pattern for Python asyncio Optionally awaitable Providing API methods that can be called by both async and non-async code. The called method really is async, but if a caller doesn’t want to know when the code is done, it can ignore the return value and not await. MK: I had to solve a similar problem in fastapi-chameleon MK: Syncify async functions. Extras: Brian: PyPI has a blog Docker no longer sunsetting free team plan Jokes: Long-lived software Mysteries make life more interesting last paragraph, discussing the cov fixture of pytest-cov
#328 We are going to need some context here
Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. 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: zipapp Part of standard library since 3.5 Yet another thing I learned recently from Brett Cannon “This module provides tools to manage the creation of zip files containing Python code, which can be executed directly by the Python interpreter. The module provides both a Command-Line Interface and a Python API.” Including: Creating Standalone Applications with zipapp Michael #2: Reverse engineering the Apple News app with #python and #nerd power As we navigate the digital world, we often come across articles we don't have time to read but still want to save for later. One way to accomplish this is by using the Read Later feature in Apple News. But what if you want to access those articles outside the Apple News app, such as on a different device or with someone who doesn't use Apple News? Or what if you want to automatically post links to those articles on your blog? That's where the nerd powers come in. The linked article shows how to use Python to solve your own problem Leading to Rhet Turnbull’s CLI: apple-news-to-sqlite Brian #3: What is a context manager? Trey Hunner Also look at all the cool goodies in contextlib from standard library @contextmanager closing suppress redirect_stdout, redirect_stderr chdir Michael #4: nox-poetry: Use Poetry inside Nox sessions via 2 people: John Hagen and Marc Prewitt This package provides a drop-in replacement for the nox.session decorator, and for the nox.Session object passed to user-defined session functions. Comes from Claudio Jolowicz's hypermodern python cookiecutter Covered this on Talk Python: talkpython.fm/episodes/show/362/hypermodern-python-projects This session performs the following steps: Build a wheel from the local package. Install the wheel as well as the pytest package. Invoke pytest to run the test suite against the installation. Consider what would happen in this session if we had imported @session from nox instead of nox_poetry: Package dependencies would only be constrained by the wheel metadata, not by the lock file. In other words, their versions would not be pinned. The pytest dependency would not be constrained at all. Poetry would be installed as a build backend every time. Extras Brian: Sharing is Caring: Sharing pytest fixtures talk availabe at about 2:40:58 on Day 2 video of PyCascades 2023. Also full Day 1 and Day 2 Michael: Wired connection to remote mesh router == wow! Using the Linksys Atlas Max 6E Joke: UnsafeWarnings
#327 Untangling XML with Pydantic
Watch on YouTube About the show Sponsored by Compiler Podcast from Red Hat. 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-xml extension via Ilan Recall untangle. How about some pydantic in the mix? pydantic-xml is a pydantic extension providing model fields xml binding and xml serialization / deserialization. It is closely integrated with pydantic which means it supports most of its features. Brian #2: How virtual environments work Brett Cannon This should be required reading for anyone learning Python. Maybe right after “Hello World” and right before “My first pytest test”, approximately. Some history of environments Back in the day, there was global and your directory. How environments work structure: bin, include, and lib pyvenv.cfg configuration file How Python uses virtual environments What activation does, and that it’s optional. Yes, activation is optional. A new project called microvenv that helps VS Code. Mostly to fix the “Debian doesn’t ship python3 with venv” problem. It doesn’t include script activation stuff It’s super small, less than 100 lines of code, in one file. Michael #3: DbDeclare Declarative layer for your database. https://raaidarshad.github.io/dbdeclare/guide/controller/#example Sent in by creator raaid DbDeclare is a Python package that helps you create and manage entities in your database cluster, like databases, roles, access control, and (eventually) more. It aims to fill the gap between SQLAlchemy (SQLA) and infrastructure as code (IaC). You can: Declare desired state in Python Avoid maintaining raw SQL Tightly integrate your databases, roles, access control, and more with your tables Migrations like alembic coming too. Brian #4: Testing multiple Python versions with nox and pyenv Seth Michael Larson This is a cool “what to do first” with nox. Specifically, how to use it to run pytest against your project on multiple versions of Python. Example noxfile.py is super small import nox @nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]) def test(session): session.install(".") session.install("-rdev-requirements.txt") session.run("pytest", "tests/") How to run everything, nox or nox -s test. How to run single sessions, nox -s test-311 for just Python 3.11 Also how to get this to work with pyenv. pyenv global 3.8 3.9 3.10 3.11 3.12-dev This reminds me that I keep meaning to write a workflow comparison post about nox and tox. Extras Michael: GitHub makes 2FA mandatory next week for active developers New adventure bike [image 1, image 2]. Who’s got good ideas for where to ride in the PNW? Wondering why I got it, here’s a fun video. Joke: Case of the Mondays
#326 Let's Go for a PyGWalk
Watch on YouTube About the show Sponsored by Microsoft for Startups Founders Hub. 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: Data Classification : Does Python still have a need for class without @dataclass? Glyph dataclasses have been in the the language since 3.7 That’s pretty much all modern Python, right? “…, is there any point to having non-@dataclass classes any more? Is there any remaining justification for writing them in new code?” Options: class just becomes a dataclass if you have typehinted members in it. data instead of class, to avoid decorators Michael #2: PyGWalker Turn your pandas dataframe into a Tableau-style User Interface for visual analysis. Works with pandas and polars Open-source alternative to Tableau It allows data scientists to analyze data and visualize patterns with simple drag-and-drop operations. Brian #3: An opinionated Python boilerplate Duarte O.Carmo Tools and processes for new projects pip-tools - Pip-tools strikes the right balance between simplicity, effectiveness, and speed. especially for generating pinned requirements.txt files, if necessary pyproject.toml - for configuration. packaging, but also any tool that supports it. ruff black, isort no pre-commit hooks, just run it in CI Michael #4: Front Matter VS Code via Mark Little If you have content that supports frontmatter and is markdown-based, check this out. Stay in your editor and easily create, manage, and publish content. Don’t make front matter mistakes When was it published? What is the timezone text formatting again? Learn new features of your existing static site (e.g. article image) Manage images and more. Extras Brian: VSCode improves IntelliSense support for pytest in Feb release Michael: AI search wars get weird Proton Drive is Out of Beta, Available for Everyone Joke: Is your computer on? Is it on fire?