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.

#366 Put It In The Backlog

January 09, 2024 00:32:01 23.18 MB Downloads: 0

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!

December 20, 2023 00:34:29 49.79 MB Downloads: 0

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!

December 12, 2023 00:27:09 39.72 MB Downloads: 0

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.

December 05, 2023 00:39:01 37.6 MB Downloads: 0

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?

November 28, 2023 00:28:10 27.18 MB Downloads: 0

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!

November 21, 2023 00:29:39 29.01 MB Downloads: 0

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!

#360 Happy Birthday!

November 07, 2023 00:35:44 34.43 MB Downloads: 0

Topics covered in this episode: exclude_also with coverage.py Writeside Extra, extra, extra Chrome not proceeding with Web Integrity API deemed by many to be DRM 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. Note: No episode next week. Michael will be at Microsoft Ignite in Seattle. Happy Birthday to us (7 years old today)! Brian #1: exclude_also with coverage.py Interesting exchange between Pamela Fox, Hugo van Kemenade, and myself where we all discover exclude_also, even though it’s been there since February This is cool because you can exclude common “should I cover this? It’s just for debugging.” kinda stuff, and other “I don’t wanna test that” places. To exclude code blocks, we can use *# pragma: no cover* in the code. Or we can list lines in coverage setting with exclude_lines, but you have to also list # pragma: no cover, which is weird. exclude_also just just right. It leaves all the inline excludes alone, and adds some regexes, and you can even just have one if that’s all you need, like if __name__ == .__main__.: See coverage docs Michael #2: Writeside An IDE for writing the docs Write, test, build, and publish docs Docs-as-code out of the box Doc quality automation: Ensure documentation quality and integrity with 100+ on-the-fly inspections in the editor as well as tests in Live Preview and during build. Comes as a separate IDE as well as a plugin for PyCharm, etc. Pricing will be free + paid premium version (like PyCharm), fully free for now Brian #3: Extra, extra, extra Welcome Marie Nordin as the new PSF Community Communications Manager Woohoo! Pablo Galindo and Łukasz Langa started a podcast, called core.py Inside look into Python 3.13 Two episodes so far The first core sprint for 3.13 Details on removing the GIL regexcrossword Suggested by Kim van Wyk actually really great for practicing regex rules Michael #4: Chrome not proceeding with Web Integrity API deemed by many to be DRM Google’s premise for the internet: The Internet should be constructed so that users can be identified, tracked, retargeted (and hence resold). — Google And privacy is important. So how do we make both of these work. FLOCs? Privacy Sandboxes? Web Integrity? No, just no. How about you sell us ads the same way you surface search results (by what is on the page, not who is visiting it) Good riddance to this idea you corrupted organization. What was wrong with Web Integrity? Some comments Issue #134 calls the idea "absolutely unethical and against the open web." Issue #113 say they "can't believe this is even proposed." Issue #127 adds: "Have you ever stopped to consider that you're the bad guys?” Extras Brian: Mock chapter of pytest: working with projects, the 2nd course in The Complete pytest Course series, is recorded and hopefully releasing today. At the very least some time this week. PyCharm has sent me a bunch of coupon codes for students of The Complete pytest Course. Sign up for the course and ask me for the code, and I’ll send it to you. Nov 21 webinar with yours truly: Do You Do Enough Testing? pytest to the Rescue! Michael: We Just Gave $500,000 to Open Source Maintainers - Sentry (thank you) ruff format + pycharm follow up JetBrains AI is getting very good a commit messages Add exception handling in background_service.py: Introduced try-except blocks to handle potential exceptions in the 'pending_jobs', 'start_job_processing', and 'run_pending_job' methods in background_service.py. This change enhances error handling and makes the service more robust by preventing crashes if a job or episode cannot be fetched or if an unknown job action is encountered. Add assemblyai to requirements and update ruff version: This commit includes the addition of assemblyai package as part of the requirements.txt file, required to introduce new speech-to-text feature in our application. Ruff version is also updated from 0.1.3 to 0.1.4 due to bug fixes and stability improvements in the new version. Assemblyai also includes dependencies like pydantic and websockets. GPT4All follow up Got some nice feedback on my statement on PyCon 2024’s health and safety policy More I think about it, the more out of touch it seems Comparisons, no mask requirements for any of: GitHub Universe - N,NNN? attendees CES - 180,000 attendees SXSW - 152,000 attendees KubeCon - 12,000 attendees Adobe Summit - 10,000 attendees Mobile World Conference - 109,500 attendees DeveloperWeek - 2,000 attendees Microsoft Ignite - 4,000 attendees WWDC - unkown Joke: The plural of regex is regrets.

#359 gil--;

November 02, 2023 00:43:04 41.47 MB Downloads: 0

Topics covered in this episode: PyCon 2024 is up? Ruff formatter is production ready gil--; Why is the Django Admin “Ugly”? 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: PyCon 2024 is up? May 15 - May 23, 2024 - Pittsburgh, Pennsylvania Conference breakdown: Tutorials: May 15 - 16, 2024 Main Conference and Online: May 17 - 19, 2024 Job Fair: May 19, 2024 Sprints: May 20 - May 23, 2024 Tickets aren’t on sale yet Unfortunately, I’m not going (see health and safety guidelines) Attendance numbers over time on Wikipedia Brian #2: Ruff formatter is production ready We reported the alpha release in September It’s fast, 30x faster than Black Provides >99.9% compatibility with Black, with a list of known deviations More configurable Bundled with ruff, ruff format Still in Beta, but considered production-ready Integration extensions for VSCode and PyCharm Michael #3: gil--; The Python Steering Council has now formally accepted PEP 703 ("Making the Global Interpreter Lock Optional in CPython") The global interpreter lock will remain the default for CPython builds and python.org downloads. A new build configuration flag, --disable-gil will be added to the configure script that will build CPython with support for running without the global interpreter lock. "In short, the SC accepts PEP 703, but with clear provisio: that the rollout be gradual and break as little as possible, that we can roll back any changes that turn out to be too disruptive – which includes potentially rolling back all of PEP 703 entirely if necessary (however unlikely or undesirable we expect that to be)." Removing the global interpreter lock requires substantial changes to CPython internals, but relatively few changes to the public Python and C APIs. The implementation changes can be grouped into the following four categories: Reference counting Memory management Container thread-safety Locking and atomic APIs Brian #4: Why is the Django Admin “Ugly”? Vince Salvino Some great quotes from the article: "The Django admin is not ugly, rather, no effort was made to make it a beautiful end-user tool.” - Ken Whitesell “The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.” - Django docs “The Django admin was built for Phil.” - Jacob Kaplan-Moss “Even in the 0.9x days we used to have a image that said “Admin: it’s not your app”.” - Curtis Maloney As Curtis put it, “encouraging people to build their own management interface, and treat admin as a DB admin tool, has saved a lot of people pain... the effort to customise it grows far faster than the payoffs.” Extras Brian: Local Conferences: Big Potential Michael: Data Science Jumpstart with 10 Projects course is out! PSF is X-ed out (or are they?) GPT4All is pretty excellent Fosstodon invites from us (expires Nov 7 2023) Joke: Searching YouTube for bug fixes

#358 Collecting Shells

October 24, 2023 00:35:28 34.28 MB Downloads: 0

Topics covered in this episode: Django 5.0 beta 1 released git bash, terminals, and Windows Mastering Integration Testing with FastAPI Reuven Learner has been banned for trading in rare animals (Pythons and Pandas) 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: Django 5.0 beta 1 released Django 5.0 release notes supports Python 3.10, 3.11, 3.12 Facet filters in the admin Simplified templates for form field rendering Database-computed default values Database generated model field More options for declaring field choices More Django news Djangonaut Space now accepting applications for our next contributor mentorship cohort Take the Django Developers Survey 2023 Michael #2: git bash, terminals, and Windows See the screenshot Requires Windows 10 Install the Windows Terminal from the Microsoft Store Brian #3: Mastering Integration Testing with FastAPI Alex Jacobs Some great integration testing techniques Focused on FastAPI, but relevant to many frameworks. Mocking authentication Mocking external APIs Fun use of parametrize and indirect fixtures for mocking responses. Mocking MongoDB Mocking AWS S3 Michael #4: Reuven Learner has been banned for trading in rare animals (Pythons and Pandas) via Pat Decker Reuven, like us, teaches Python and Data Sci Tried to advertise his courses (Python and Pandas courses) on Meta Got permanently (life-time) banned for selling rare and endangered animals. Sometimes I really hate these big tech companies My recent beefs have been with app store reviewers and surveillance-based capitalism Extras Brian: Where did everyone go? - Ned Batchelder I do feel like we’re more fragmented than before, but I am feeling like we have a community on Mastodon. reminder that Mastodon has text search now On Sunday, I released Ch9, Coverage, as part of The Complete pytest course, specifically part of pytest Working with Projects. It was super fun. I’ve used coverage a lot since writing the book, for example, I demonstrate branch coverage. It’s so much more effective to teach in video than in printed screenshots. Michael: Autin shell enhancer by Ellie Huxtable recommended by recommended by Nik JupyterCon 2023 videos are out More shells follow up from Teemu Hukkanen for “editor like” features Zsh and Bash ruff format and strings, aka format.quote-style = "single" Glyph’s programming your computer talk is up. Joke: this is what the experts do

#357 Python 3.7 EOLed, We Hadn't Noticed

October 17, 2023 00:29:06 28.19 MB Downloads: 0

Topics covered in this episode: QuickMacHotKey Things I’ve learned about building CLI tools in Python Warp Terminal (referral code) Python 3.7 EOLed, but I hadn’t noticed 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. Michael #1: QuickMacHotKey This is a set of minimal Python bindings for the undocumented macOS framework APIs that even the most modern, sandboxing-friendly shortcut-binding frameworks use under the hood for actually binding global hotkeys. Thinking of updating my urlify menubar app. Brian #2: Things I’ve learned about building CLI tools in Python Simon Willison A cool Cookiecutter starter project, if you like Click. Conventions and consistency in commands, arguments, options, and flags. The importance of versioning. Your CLI is an API. Include examples in --help Include --help in documentation. Aside, Typer is also cool, and is built on Click. Michael #3: Warp Terminal (referral code) Really nice reimagining of the terminal Currently macOS only but will be Linux, then Windows New command section & output section mode Blocks can be navigated and searched as a single thing (even if it’s 1,000 lines of output) CTRL+R gives a nice history like McFly I’ve discussed before Completions into popular CLIs (i.e. git) Edit like an editor (even you VIM people 🙂 ) Has AI built in too Free for individuals If you’re going to give it a try, use my referral I guess? Brian #4: Python 3.7 EOLed, but I hadn’t noticed EOL was June 27 I’m still supporting 3.7, as are most projects I work with. But I’m not sure when that will change. VS Code is deprecating 3.7 support Why I’m ok with supporting 3.7 for some projects dataclasses came in with 3.7 from __ future__ import annotations allows the use of union types with X|Y. example I’ll probably drop 3.7 as my dependent projects drop it. Extras Brian: pytest-param-scope is an in progress hack to workaround this missing scope. Runs setup before any param test cases, and teardown after the last one. Stop defining people by what they’re not: on “non-code contributors” - Josh Simmons Michael: OpenAI has unveiled the Beta version of its Python SDK (via Mark Little) StackOverflow lays off 28% of its staff Weird follow up of their “what to do if you’re laid off” post from 6 months ago? Is AI eating into their traffic? ArsTechnica has thoughts too Joke: Define hot New Zoo exhibit

#356 Ripping from PyPY

October 10, 2023 00:24:13 23.38 MB Downloads: 0

Topics covered in this episode: Psycopg 3 dacite RIP: Fast, barebones pip implementation in Rust Flaky Tests follow up 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: Psycopg 3 Psycopg folks recommend starting with 3 for new projects 2 is still actively maintained, but no new features are planned recommend staying with 2 for legacy projects Psycopg 3 project 2 vs 3 feature comparison A few Psycopg 3 highlights native asyncio support native support for more Python types (such as Enums) and PostgreSQL types (such as multirange) Default server-side parameters binding Allows binary parameters and query results (and text, of course) Pipeline/batch mode support Static typing support Michael #2: dacite via Raymond Peck Simple creation of data classes from dictionaries Dacite supports following features: nested structures (basic) types checking optional fields (i.e. typing.Optional) unions forward references collections custom type hooks It's important to mention that dacite is not a data validation library. Type hooks are interesting too. Brian #3: RIP: Fast, barebones pip implementation in Rust list of current and planned features of RIP, the biggest are listed below: Downloading and aggressive caching of PyPI metadata. (done) Resolving of PyPI packages using Resolvo. (done) Installation of wheel files (planned) Support sdist files (planned) new project, just a couple weeks old. … “We would love to have you contribute!” Michael #4: Flaky Tests follow up by Marwan Sarieddine I was inspired by the Talk Python podcast on "Taming flaky tests" with Gregory Kapfhammer and Owain Parry so I wrote up an article on my blog titled "How not to footgun yourself when writing tests - a showcase of flaky tests” Extras Brian: Just wrapping up some personal projects, which means… Python People episodes soon Python Test episodes soon (but later) More course chapters coming Michael: PyBay 2023 was fun Switched to Spark Mail, recommended Dust (what science fiction story telling should be), try: FTL Oceanus Joke: There are more hydrogen atoms in a single molecule of water than there are stars in the entire Solar System. - mas.to/@SmudgeTheInsultCat/111174610011921264 The Big Rewrite

#355 Python 3.12 is Out!

October 03, 2023 00:35:15 33.98 MB Downloads: 0

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!

September 26, 2023 00:21:26 21.01 MB Downloads: 0

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

September 19, 2023 00:29:27 28.4 MB Downloads: 0

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

September 12, 2023 00:22:20 21.63 MB Downloads: 0

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