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

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

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

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

#385 RESTing on Postgres

May 27, 2024 00:24:04 20.35 MB Downloads: 0

Topics covered in this episode: PostgresREST How Python Asyncio Works: Recreating it from Scratch Bend The Smartest Way to Learn Python Regular Expressions Extras Joke Watch on YouTube About the show Sponsored by Mailtrap: pythonbytes.fm/mailtrap 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 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: PostgresREST PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant, faster API than you are likely to write from scratch. Speedy First the server is written in Haskell using the Warp HTTP server (aka a compiled language with lightweight threads). Next it delegates as much calculation as possible to the database. Finally it uses the database efficiently with the Hasql library PostgREST handles authentication (via JSON Web Tokens) and delegates authorization to the role information defined in the database. This ensures there is a single declarative source of truth for security. Brian #2: How Python Asyncio Works: Recreating it from Scratch Jacob Padilla Cool tutorial walking through how async works, including Generators Review The Event Loop Sleeping Yield to Await Await with AsyncIO Another great async resource is: Build your Own Async David Beasley talk from 2019 Michael #3: Bend A massively parallel, high-level programming language. With Bend you can write parallel code for multi-core CPUs/GPUs without being a C/CUDA expert with 10 years of experience. It feels just like Python! No need to deal with the complexity of concurrent programming: locks, mutexes, atomics... any work that can be done in parallel will be done in parallel. Brian #4: The Smartest Way to Learn Python Regular Expressions Christian Mayer, Zohaib Riaz, and Lukas Rieger Self published ebook on Python Regex that utilizes book form readings, links to video course sections puzzle challenges to complete online It’s a paid resource, but the min is free. Extras Brian: Replay - A graphic memoir by Prince of Persia creator Jordan Mechner, recounting his own family story of war, exile and new beginnings. Michael: PyCon 2026 Joke: Shells Scripts

#384 Force push lightly

May 21, 2024 00:25:50 21.85 MB Downloads: 0

Topics covered in this episode: Git: Force push safely with --force-with-lease and --force-if-includes Thoughts from PyCon 2024 Being friendly: Strategies for friendly fork management tach Extras Joke Watch on YouTube About the show Sponsored by Mailtrap: pythonbytes.fm/mailtrap 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 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: Git: Force push safely with --force-with-lease and --force-if-includes Adam Johnson Using gentle force Avoid stomping on remote changes with a couple extra flags. Michael #2: Thoughts from PyCon 2024 PyCon is special - the connections you make are always more than you expect Great to see many old friends Did a ”live” Talk Python episode that’ll be out in a few weeks. The talks look great, we’ll let you know when they land on YouTube. Masks were a mistake - universally heard complaints from fellow attendees. This is my two cents towards a more reasonable next PyCon. Brian #3: Being friendly: Strategies for friendly fork management That’s part 2. Part 1 is Being friendly: Friendly forks 101 Lessley Dennington on GitHub Blog Examples of long running friendly forks git-for-windows/git, microsift/git, github/git two public, one private Fork management strategies - when pulling changes downstream merging rebase git-for-windows/git uses this proactively and regularly fake merge + rebase new branch microsoft/git uses this new branch from upstream major versions merge previous changes to new branch traditional merge github/git uses this, conservatively, after a few point bug fix versions Michael #4: tach A Python tool to enforce a modular, decoupled package architecture. tach allows you to define boundaries and control dependencies between your Python packages. Each package can define its public interface. If a package tries to import from another package that is not listed as a dependency, tach will report an error. If a package tries to import from another package and does not use its public interface, with strict: true set, tach will report an error. Zero runtime impact. Extras Brian: Logfire - new observability platform from the pydantic team - free for now Michael: 10% off the new spaCy course throughout May Joke: Evolution of smart products

#383 Why aren’t devs shipping faster?

May 14, 2024 00:31:00 22.45 MB Downloads: 0

Topics covered in this episode: I asked 100 devs why they aren’t shipping faster. Here’s what I learned Python 3.13.0 beta 1 released A theme editor for JupyterLab rich-argparse Extras Joke Watch on YouTube About the show Sponsored by Mailtrap: pythonbytes.fm/mailtrap 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 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: I asked 100 devs why they aren’t shipping faster. Here’s what I learned by Daksh Gupta (via PyCoders) What’s stopping you from shipping faster? Dependency bugs Complicated codebase >There is so much undocumented in our service, including poor records of new features, nonexistent or outdated info on our dependencies, or even essential things like best practices for testing, a lot of time is wasted in syncs trying to find the right information QA Loops Waiting for spec > At Amazon? Meetings, approval, talking to 10 different stakeholders because changing the color of a button affects 15 micro services Writing tests Deployment/build speed Scope creep > ソ The human tendency to stuff last-minute items into the crevices of their luggage minutes before leaving for the airport manifests itself at software companies as scope creep. Unclear requirements Excessive meetings Motivation >honest answer is i was on ads >and that’s a very old / complicated / large stack (edited) >and i didn’t understand it >my friends on younger teams seemed happier, i was miserable DORA metrics Brian #2: Python 3.13.0 beta 1 released "Python 3.13 is still in development. This release, 3.13.0b1, is the first of four beta release previews of 3.13.” New REPL, featuring multi-line editing, color support, colorized exception tracebacks Cool GIL, JIT, and GC features Typing changes, including typing.TypeIs . See last weeks episode and TypeIs does what I thought TypeGuard would do in Python Some nice dead battery removals and more But seriously, the REPL is cool. Just ask Trey The new REPL in Python 3.13 - Trey Hunner Michael #3: A theme editor for JupyterLab by Florence Haudin A new tool for authoring JupyterLab themes To lower the bar for customizing JupyterLab we created a new tool providing a simple interface for tuning the JupyterLab appearance interactively. See jupyterlab-theme-editor on github Brian #4: rich-argparse “Format argparse and optparse help using rich.” “rich-argparse improves the look and readability of argparse's help while requiring minimal changes to the code.” They’re not kidding. 2 line code change. from rich_argparse import RichHelpFormatter parser = argparse.ArgumentParser(..., formatter_class=RichHelpFormatter) Extras Brian: pytest course is now switched to the new platform. I sent out an email including how to save their spot on the old site and mark that spot complete on the new site. There’s now comments on the course now. Trying that out. If you’ve got a question, just ask in that section. Michael: A new Talk Python course: Getting Started with NLP and spaCy Joke: Testing holiday

#382 A Simple Game

May 07, 2024 00:28:10 20.46 MB Downloads: 0

Topics covered in this episode: act: Run your GitHub Actions locally! portr Annotating args and kwargs in Python github badges Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: act: Run your GitHub Actions locally! Why? “Fast Feedback - Rather than having to commit/push every time you want to test out the changes you are making to your .github/workflows/ files (or for any changes to embedded GitHub actions), you can use act to run the actions locally. The environment variables and filesystem are all configured to match what GitHub provides.” “Local Task Runner - I love make. However, I also hate repeating myself. With act, you can use the GitHub Actions defined in your .github/workflows/ to replace your Makefile!” Docs: nektosact.com Uses Docker to run containers for each action. Michael #2: portr Open source ngrok alternative designed for teams Expose local http, tcp or websocket connections to the public internet Warning: Portr is currently in beta. Expect bugs and anticipate breaking changes. Server setup (docker basically). Brian #3: Annotating args and kwargs in Python Redowan Delowar I don’t think I’ve ever tried, but this is a fun rabbit hole. Leveraging bits of PEP-5891, PEP-6462, PEP-6553, and PEP-6924. Punchline: from typing import TypedDict, Unpack *# Python 3.12+* *# from typing_extensions import TypedDict, Unpack # < Python 3.12* class Kw(TypedDict): key1: int key2: bool def foo(*args: Unpack[tuple[int, str]], **kwargs: Unpack[Kw]) -> None: ... A recent pic from Redowan’s blog: TypeIs does what I thought TypeGuard would do in Python Michael #4: github badges A curated list of GitHub badges for your next project Extras Brian: Fake job interviews target developers with new Python backdoor Later this week, course.pythontest.com will shift from Teachable to Podia Same great content. Just a different backend. To celebrate, get 25% off at pythontest.podia.com now through this Sunday using coupon code PYTEST Getting the most out of PyCon, including juggling - Rob Ludwick Latest PythonTest episode, also cross posted to pythonpeople.fm 3D visualization of dom Michael: Djangonauts Space Session 2 Applications Open! More background at Djangonauts, Ready for Blast-Off on Talk Python. Self-Hosted Open Source - Michael Kennedy on Django Chat Joke: silly games Closing song: Permission Granted

#381 Python Packages in the Oven

April 30, 2024 00:28:55 24.43 MB Downloads: 0

Topics covered in this episode: Announcing py2wasm: A Python to Wasm compiler Exploring Python packages with Oven and PyPI Browser PyCharm Local LLM Google shedding Python devs (at least in the US). Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: Announcing py2wasm: A Python to Wasm compiler py2wasm converts your Python programs to WebAssembly, running them at 3x faster speeds thanks to Nuitka Brian #2: Exploring Python packages with Oven and PyPI Browser pypi.org is great, but there are some handy alternatives Oven Shows how to install stuff with pip, pdm, rye, and poetry Similar meta and description as PyPI Includes README.md view (no tables yet, though) Nice listing of versions Ability to look at what files are in wheels and tarballs (very cool) Can deploy yourself. Node/Remix app. Really slick. PyPI Browser View versions View wheel and tarball contents. Metadata and contents. No README view Is a Starlette app that you can deploy on your on with a private registry. So that’s cool. Michael #3: PyCharm Local LLM Pretty awesome full line completer based on a local LLM for PyCharm Requires PyCharm Professional An example, given this partial function in Flask: @blueprint.get('/listing') def listing(): videos = video_service.all_videos() Typing ret → That is, typing ret autocompletes to: return flask.render_template('home/listing.html', videos=videos) Which is pretty miraculous, and correct. Brian #4: Google shedding Python devs (at least in the US). Google lays off staff from Flutter, Dart and Python teams weeks before its developer conference - techcrunch Python, Flutter teams latest on the Google chopping block - The Register “Despite Alphabet last week reporting a 57 percent year-on-year jump in net profit to $23.66 billion for calendar Q1, more roles are being expunged as the mega-corp cracks down on costs.” “As for the Python team, the current positions have reportedly been "reduced" in favor of a new team based in Munich.” MK: Related and timely: How one power-hungry leader destroyed Google search Extras Brian: Python Gotcha: strip, lstrip, rstrip can remove more than expected Reminder: You probably want .removesuffix() and .removeprefix() Michael: Using Llama3 in LMStudio Joke: Broken System

#380 Debugging with your eyes

April 23, 2024 00:24:07 17.5 MB Downloads: 0

Topics covered in this episode: NumFOCUS concerns leaping pytest debugger llm Extra, Extra, Extra, PyPI has completed its first security audit 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. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: NumFOCUS concerns Suggested by Pamphile Roy Write up of the current challenges faced by NumFOCUS, by Paul Ivanov (one of the OG of Scientific Python: Jupyter, Matplotlib, etc.) Struggling to meet the needs of sponsored and affiliated projects. In February, NumFOCUS announced it is moving in a new direction. NumFOCUS initiated an effort to run an election for open board seats and proposed changing its governance structure. Some projects are considering and actively pursuing alternative venues for fiscal sponsorship. Quite a bit more detail and discussion in the article. NumFOCUS covers a lot of projects NumPy, Matplotlib, pandas, Jupyter, SciPy, Astropy, Bokeh, Dask, Conda, and so many more. Michael #2: leaping pytest debugger llm You can ask Leaping questions like: Why am I not hitting function x? Why was variable y set to this value? What was the value of variable x at this point? What changes can I make to this code to make this test pass? Brian #3: Extra, Extra, Extra, 2024 Developer Summit Also suggested by Pamphile, related to Scientific Python The Second Scientific Python Developer Summit , June 3-5, Seattle, WA Lots of great work came out of the First Summit in 2023 pytest-regex - Use regexs to specify tests to run Came out of the ’23 summit I’m not sure if I’m super happy about this or a little afraid that I probably could use this. Still, cool that it’s here. Cool short example of using __init__ and __call__ to hand-roll a decorator. ruff got faster Michael #4: PyPI has completed its first security audit Trail of Bits spent a total of 10 engineer-weeks of effort identifying issues, presenting those findings to the PyPI team, and assisting us as we remediated the findings. Scope: The audit was focused on "Warehouse", the open-source codebase that powers pypi.org As a result of the audit, Trail of Bits detailed 29 different advisories discovered across both codebases. When evaluating severity level of each advisory, 14 were categorized as "informational", 6 as "low", 8 as "medium" and zero as "high". Extras Brian: pytest course community to try out Podia Communities. Anyone have a podia community running strong now? If so, let me know through Mastodon: @brianokken@fosstodon.org Want to join the community when it’s up and running? Same. Or join our our friends of the show list, and read our newsletter. I’ll be sure to drop a note in there when it’s ready. Michael: VS Code AMA @ Talk Python [video] Gunicorn CVE Talk submissions are now open for both remote and in-person talks at the 2024 PyConZA? The conference will be held on 3 and 4 October 2024 in Cape Town, South Africa. Details are on za.pycon.org. FlaskCon 2024 will be happening Friday, May 17 inside PyCon US 2024. Call for proposals are now live! Joke: Debugging with your eyes

#379 Constable on the debugging case

April 16, 2024 00:20:13 14.68 MB Downloads: 0

Topics covered in this episode: How to Set Up Pre-Commit Hooks A step-by-step guide to installing and configuring pre-commit hooks on your project. difftastic Quarto constable 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. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: How to Set Up Pre-Commit Hooks A step-by-step guide to installing and configuring pre-commit hooks on your project. by Stefanie Molin Pre-commit hooks are code checks that run as part of the “pre-commit” stage of the git commit process. If any of these checks fail, git aborts the commit Sometimes, we need to bypass the hooks temporarily. For these instances, we can pass the --no-verify option when we run git commit Brian #2: difftastic Found this a couple years ago, but really using it a lot now. Excellent structurally diff tool that compares code based on syntax, not line by line. Michael #3: Quarto via Mathias Johansson An open-source scientific and technical publishing system Transforming a notebook into a pdf / HTML / MS Word / ePub with minimal effort, or even all formats at once. Author using Jupyter notebooks or with plain text markdown in your favorite editor. Write using Pandoc markdown, including equations, citations, crossrefs, figure panels, callouts, advanced layout, and more. Brian #4: constable “inserts print statements directly into the AST at runtime “ “If you find yourself aimlessly adding print statements while debugging your code, this is for you. !” Add decorators like @constable.trace('a', 'b') to functions and you’ll get nice output showing when and how a and b changed. see also icecream for another fun debugging with print project. Extras Brian: pointers being added to the standard library A couple weeks old, but still worth covering Guido’s take on adding this, "Why the hell not?" Michael: Python 3.12.3 is out Joke: Hugo SciFi Award

#378 Python is on the edge

April 09, 2024 00:31:24 22.73 MB Downloads: 0

Topics covered in this episode: pacemaker - For controlling time per iteration loop in Python. PyPI suspends new user registration to block malware campaign Python Project-Local Virtualenv Management Redux Python Edge Workers at Cloudflare 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. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: pacemaker - For controlling time per iteration loop in Python. Brandon Rohrer Good example of a small bit of code made into a small package. With speedups to dependencies, like with uv, for example, I think we’ll see more small projects. Cool stuff Great README, including quirks that need to be understood by users. “If the pacemaker experiences a delay, it will allow faster iterations to try to catch up. Heads up: because of this, any individual iteration might end up being much shorter than suggested by the pacemaker's target rate.” Nice use of time.monotonic() deltas are guaranteed to never go back in time regardless of what adjustments are made to the system clock. Watch out for pip install pacemaker-lite NOT pacemaker pacemaker is taken by a package named PaceMaker with a repo named pace-maker, that hasn’t been updated in 3 years. Not sure if it’s alive. No tests (yet). I’m sure they’re coming. ;) Seriously though, Brandon says this is “a glorified snippet”. And I love the use of packaging to encapsulate shared code. Realistically, small snippet like packages have functionality that’s probably going to be tested by end user code. And even if there are tests, users should test the functionality they are depending on. Michael #2: PyPI suspends new user registration to block malware campaign Incident Report for Python Infrastructure PyPi Is Under Attack: Project Creation and User Registration Suspended — Here’s the details I hate medium, but it’s the best details I’ve found so far Brian #3: Python Project-Local Virtualenv Management Redux Hynek Concise writeup of how Hynek uses various tools for dealing with environments Covers (paren notes are from Brian) In project .venv directories direnv for handling .envrc files per project (time for me to try this again) uv for pip and pip-compile functionality Installing Python via python.org Using a .python-version-default file (I’ll need to play with this a bit) Works with GH Action setup-python. (ok. that’s cool) Some fish shell scripting Bonus tip on using requires-python in .pyproject.toml and extracting it in GH actions to be able to get the python exe name, and then be able to pass it to Docker and reference it in a Dockerfile. (very cool) Michael #4: Python Edge Workers at Cloudflare What are edge workers? Based on workers using Pyodide and WebAssembly This new support for Python is different from how Workers have historically supported languages beyond JavaScript — in this case, we have directly integrated a Python implementation into workerd, the open-source Workers runtime. Python Workers can import a subset of popular Python packages including FastAPI, Langchain, numpy Check out the examples repo. Extras Michael: LPython follow up from Brian Skinn Featured on Python Bytes badge A little downtime, thanks for the understanding We were rocking a 99.98% uptime until then. :) Joke: C++ is not safe for people under 18 Baseball joke

#377 A Dramatic Episode

April 02, 2024 00:32:55 23.83 MB Downloads: 0

Topics covered in this episode: justpath xz back door LPython dramatic Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: justpath Inspect and refine PATH environment variable on both Windows and Linux. Raw, count, duplicates, invalids, corrections, excellent stuff. Check out the video Brian #2: xz back door In case you kinda heard about this, but not really. Very short version: A Microsoft engineer noticed a performance problem with ssh and tracked it to a particular version update of xz. Further investigations found a multi-year installation of a fairly complex back door into the xz by a new-ish contributor. But still contributing over several years. First commit in early 2022. The problem is caught. But if it had succeeded, it would have been bad. Part of the issue of how this happened is due to having one primary maintainer on a very widely used tool included in tons-o-Linux distributions. Some useful articles Everything I Know About the XZ Backdoor - Evan Boehs - recommended read Don’t think your affected? Think again if you use homebrew, for example: Update and upgrade Homebrew and xz versions Notes Open source maintenance burnout is real Lots of open source projects are maintained by unpaid individuals for long periods of time. Multi-year sneakiness and social bullying is pretty hard to defend against. Handing off projects to another primary maintainer has to be doable. But now I think we need better tools to vet contributors. Maybe? Or would that just suppress contributions? One option to help with burnout: JGMM, Just Give Maintainers Money: Software Needs To Be More Expensive - Glyph Michael #3: LPython LPython aggressively optimizes type-annotated Python code. It has several backends, including LLVM, C, C++, and WASM. LPython’s primary tenet is speed. Play with the wasm version here: dev.lpython.org Still in alpha, so keep that in mind. Brian #4: dramatic Trey Hunner More drama in the software world. This time in the Python. Actually, this is just a fun utility to make your Python output more dramatic. More fun output with terminaltexteffects suggested by Allan Extras Brian: Textual how has a new inline feature in the new release. Michael: My keynote talk is out: The State of Python in 2024 Have you browsed your github feed lately? 3.10, 3.9, 3.8 security updates Joke: Definition of terms

#376 Every dunder method in a Python Lockbox

March 26, 2024 00:32:04 27.26 MB Downloads: 0

Topics covered in this episode: 🤖 On Robots.txt niquests Every dunder method in Python Lockbox Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: 🤖 On Robots.txt Jeff Triplett “In theory, this file helps control what search engines and AI scrapers are allowed to visit, but I need more confidence in its effectiveness in the post-AI apocalyptic world.” Resources to get started Block the Bots that Feed “AI” Models by Scraping Your Website Go ahead and block AI web crawlers Dark Visitors Django Add robots.txt to a Django website How to add a robots.txt to your Django site Hugo Hugo robots.txt Podcast questions: Should content creators block AI from our work? Should’t we set up a standard way to do this? I still haven’t found a way to block GitHub repositories. Is there a way? Licensing is one thing (not easy), but I don’t think any bots respect any protocol for repos. Michael #2: niquests Requests but with HTTP/3, HTTP/2, Multiplexed Connections, System CAs, Certificate Revocation, DNS over HTTPS / TLS / QUIC or UDP, Async, DNSSEC, and (much) pain removed! Niquests is a simple, yet elegant, HTTP library. It is a drop-in replacement for Requests, which is under feature freeze. See why you should switch: Read about 10 reasons why Brian #3: Every dunder method in Python Trey Hunner Sure, there’s __repr__(), __str__(), and __init__(), but how about dunder methods for: Equality and hashability Orderability Type conversions and formatting Context managers Containers and collections Callability Arithmetic operators … and so much more … even a cheat sheet. Michael #4: Lockbox Lockbox is a forward proxy for making third party API calls. Why? Automation or workflow platforms like Zapier and IFTTT allow "webhook" actions for interacting with third party APIs. They require you to provide your third party API keys so they can act on your behalf. You are trusting them to keep your API keys safe, and that they do not misuse them. How Lockbox helps: When a workflow platform needs to make a third party API call on your behalf, it makes a Lockbox API call instead. Lockbox makes the call to the third party API, and returns the result to the workflow platform. Extras Brian: Django: Join the community on Mastodon - Adam Johnson No maintenance intended - Sent in from Kim van Wyk Michael: US sues Apple Good video on pluses and minuses The hot water just the day before [and this one] https://9to5mac.com/2024/03/25/app-store-proposals-rejected/ PyPI Support Specialist job VS Code AMA, please submit your question here PyData Eindhoven 2024 has a date and open CFP Joke: Windows Certified

#375 Pointing at Countries

March 19, 2024 00:24:56 21.13 MB Downloads: 0

Topics covered in this episode: pycountry Does Python have pointers? ingestr Make your terminal nice Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: pycountry A Python library to access ISO country, subdivision, language, currency and script definitions and their translations. pycountry provides the ISO databases for the standards: 639-3 Languages 3166 Codes for representation of names of countries and their subdivisions 3166-1 Countries 3166-3 Deleted countries 3166-2 Subdivisions of countries 4217 Currencies 15924 Scripts Brian #2: Does Python have pointers? Ned Batchelder Turns out, this is really the description of “what’s a variable in Python?” that helps to make sense of the “variables as names” model in Python, especially for people coming from languages that use pointers a lot. You can use id() to find out what a variable points to You just can’t do the reverse of access it given an id. There’s no “dereference” operator. See also Python Names and Values, also by Ned Should be required reading/viewing for all Python curriculum. Michael #3: ingestr ingestr is a command-line application that allows ingesting or copying data from any source into any destination database. Works on both MongoDB and Postgres and many more. incremental loading: append, merge or delete+insert Brian #4: Make your terminal nice David Lord David’s switched to Fish and Starship I tried switching to Fish several times, and I guess I’m good with zsh. Although I admire the brave comic sans motto: “Finally, a command line shell for the 90s” But I’m finally ready for Starship, and it takes almost no time to set up Plus it’s fast. (Has it always been Rust?) Extras Brian: Doing some groundwork for a SaaS project, using SaaS Pegasus I just talked with Cory from Pegasus for an upcoming PythonTest episode I haven’t decided whether to save up SaaS episodes for one big series, or spread them out. But mostly I’m excited to get my project started. Michael: Excellent video about “cloud exit” uv - The Next Evolution in Python Packages? Python 3.13 a5 Target’s Open Source Fund via Pat Decker Joke: Anti-social engineer

#374 Climbing the Python Web Mountain

March 11, 2024 00:32:50 23.82 MB Downloads: 0

Topics covered in this episode: 6 ways to improve the architecture of your Python project (using import-linter) Mountaineer Why Python's Integer Division Floors Hatchet Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: 6 ways to improve the architecture of your Python project (using import-linter) Piglei Using import-linter to define architectural layers check to make sure imports don’t violate (import from upper layers) can also check for more contracts, such as forbidden - disallow a specific from/to import independence - list of modules that shouldn’t import from each other Fixing violations a process introduced to set exceptions for each violation in a config file then fix violations 1 at a time (nice approach) use the whole team if you can Common methods for fixing dependency issues Merging and splitting modules Dependency Injection, including using protocols to keep type hints without the need to import just for types Use simpler dependency types Delaying function implementations module global methods set by caller, or adding a simple plugin/callback system Configuration driven Setting import statements in a config file and using import_string() at runtime Replace function calls with event-driven approaches Michael #2: Mountaineer Mountaineer is a batteries-included web framework for Python and React. Mountaineer focuses on developer productivity above all else, with production speed a close second. 📝 Typehints up and down the stack: frontend, backend, and database 🎙️ Trivially easy client[HTML_REMOVED]server communication, data binding, and function calling 🌎 Optimized server rendering for better accessibility and SEO 🏹 Static analysis of web pages for strong validation: link validity, data access, etc. 🤩 Skip the API or Node.js server just to serve frontend clients Brian #3: Why Python's Integer Division Floors Guido van Rossum Integer division always floors (toward negative infinity) instead of truncating. (C truncates) 5//2 → 2 -5//2 → -3 5//-2 → -3 Reason, For nice mathematical relationships with // and % (modulo). a//b = quotient (q), a%b = remainder (r) such that b*q + r = a, and 0 <= r < b This works for both positive and negative a values For negative b, the second rule has to change to 0 >= r > b If you truncate (like C does), you have to use abs(r) for the first rule to work. Theory of why C doesn’t do it this way: Probably a hardware limitation at the time when C was designed, due to “sign + magnitude” integers instead of modern two’s compliment integers. Michael #4: Hatchet Hatchet is a distributed, fault-tolerant task queue which replaces traditional message brokers and pub/sub systems. It’s built to solve problems like concurrency, fairness, and durability Concurrency, Fairness, and Rate limiting: Enable FIFO, LIFO, Round Robin, and Priority Queues with built-in strategies to avoid common pitfalls. Architected for Resiliency: Customizable retry policies and built-in error handling to recover from transient failures. Extras Brian: Charlie Marsh on uv in PythonTest episode 216 Michael: Build An Audio AI App Course [free!] Rock Solid Python with Python Typing Course Coolio Joke: Breaking Prod

#373 Changing Directories

March 05, 2024 00:26:33 19.29 MB Downloads: 0

Topics covered in this episode: zoxide Smart CLIs with Typer Python recommended officially by the US Government Textual tutorials at Mouse vs Python Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: zoxide zoxide is a smarter cd command, inspired by z and autojump. It remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes. zoxide works on all major shells and platforms. Brian #2: Smart CLIs with Typer Rahul Pai Lots of TILs here, even though I’ve been using Typer for years. Examples of Auto-detection of arguments and types based on type hints Help text is a smidge clunkier Prompting for missing arguments Defaulting to an enviromental variable for missing args Print help if no args given Explicit app and subcommands with a comparison to argparse Reusable commands with result_callback Several topics covered in comparison with argparse See also Testing argparse Applications Michael #3: Python recommended officially by the US Government The US government explicitly recommends memory safe languages. Python is one of them The comparison to big tech by Samuel is interesting Brian #4: Textual tutorials at Mouse vs Python Mike Driscoll Most recently Creating a Modal Dialog For Your TUIs in Textual Textualize already has some pretty great documentation at textual.textualize.io But it’s cool to see some different tutorials on it. Extras Brian: Is UV the FUTURE of Python PACKAGING? 🐍📦 - Hynek Nice context on how uv fits into all of the existing packaging challenges and some hope for the future. venmo feed is public by default Michael: ngrok Python SDK Djangonauts on Talk Python Maybe just a new case and battery for your phone? Joke: Ship it!

#372 uv - an impressive pip alternative

February 20, 2024 00:34:23 29.02 MB Downloads: 0

Topics covered in this episode: uv: Python packaging in Rust jpterm Everything You Can Do with Python's textwrap Module HTML First Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. First, we are likely skipping next week folks. I’ll be at PyCon Philippines. Brian #1: uv: Python packaging in Rust Suggested by Collin Sullivan “uv is designed as a drop-in replacement for pip and pip-tools” Intended to support the pip and pip-tools APIs, just use uv pip instead. Oh yeah, also replaces venv and virtualenv. And it’s super zippy, as you would expect. I’m still getting used to it uv pip venv didn’t have --prompt at first. But that’s fixed. should get released soon. first thing I tried uv pip install ./ and uv pip install pytest second. worked awesome uv pip list third thing I tried not there either, but uv pip freeze is similar. Issue already filed Seriously, I’m excited about this. It’s just that it seems I wasn’t the target workflow for this. See also tox-uv - speed up tox with uv [rye](https://lucumr.pocoo.org/2024/2/15/rye-grows-with-uv/) from Armin Ronacher, will be supported by Astral - MK: Switched to this for dev. It’s excellent. For some reason, doesn’t work on Docker? From Henry Michael #2: jpterm via David Brochart jpterm is a JupyterLab-like environment running in the terminal. What sets jpterm apart is that it builds on the shoulders of giants, one of which is Textual. It is designed similarly to JupyterLab, where everything is a plugin. Brian #3: Everything You Can Do with Python's textwrap Module Martin Heinz Nice quick demo of one of my favorite builtin modules. Features shorten text and insert placeholders wrap can split lines to the same length but can also just split a string into equal chunks for batch processing TextWrapper class does all sorts of fancy stuff. dedent is my fave. Awesome for including a multiline string in a test function as an expected outcome. Michael #4: HTML First HTML First is a set of guidelines for making it easier, faster and more maintainable to build web software Principles Leveraging the default capabilities of modern web browsers. Leveraging the extreme simplicity of HTML's attribute syntax. Leveraging the web's ViewSource affordance. Practices Prefer Vanilla approaches Use HTML attributes for styling and behaviour Use libraries that leverage HTML attributes Avoid Build Steps Prefer Naked HTML Be View-Source Friendly Extras Brian: pytest 8.0.1 released. Fixes the parametrization order reversal I mentioned a couple episodes ago, plus some other fixes. Learn about dependency injection from Hynek If you want to jump into some Rust to help speed up Python tools, maybe check out yarr.fyi I just interviewed Nicole, the creator, for Python Test, and this looks pretty cool Her episode should come out in a couple of weeks. Ramping up more interviews for Python People. So please let me know if you’d like to be on the show or if you have suggestions for people you’d like me to interview. Also, I know this is weird, some people are still on X, and not like “didn’t close their account when they left”, but actually still using it. This is ironically a reverse of X-Files. “I don’t want to believe”. However, I’ve left my account open for those folks. I check it like twice a month. But eventually I’ll see it if you DM me. But really, there are easier ways to reach me. Michael: PyData Pittsburg CFP Wyden: Data Broker Used Abortion Clinic Visitor Location Data To Help Send Targeted Misinformation To Vulnerable Women SciPy 2024 - Call for Proposals Joke: Yeti tumbler

#371 Python in a Crate

February 13, 2024 00:36:04 26.09 MB Downloads: 0

Topics covered in this episode: AppleCrate One way to package Python code right now Flask8 but why? Extra, Extra, Extra Extras Joke Watch on YouTube About the show Sponsored by ScoutAPM: pythonbytes.fm/scout Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: AppleCrate By Rhet Turnbull (from Building macOS Apps episode) AppleCrate is a tool for creating native macOS installers for your command line tools. It's useful for creating installers for command line tools written in any language. Tools written in interpreted languages like Python will need to be first processed with a tool like pyinstaller to create a standalone executable. AppleCrate uses Jinja2 templates to generate the files required for the installer. This allows you to use template variables in your files or command line parameters to customize the installer. Brian #2: One way to package Python code right now Ned Batchelder An example repo with all the parts for package A lot of discussion and what to think about in the README (unfortunately rst and not md, but we can’t have everything) Includes pyproject.toml dev-requirements.txt README.rst Makefile LICENSE.txt .bitignore .editorconfig see https://editorconfig.org Shout out to to Packaging Python Projects on python.org, which is pretty good Michael #3: Flask8 but why? Ihor Kalnytskyi: Something I really like about #ruff, a new tool for both linting and formatting in the #python ecosystem. You can literally pick any lint rule it supports and see both reasoning and examples. Ruff supports over 700 lint rules, many of which are inspired by popular tools like Flake8, isort, pyupgrade, and others. Brian #4: Extra, Extra, Extra Flat.app kinda like trello, etc. but a very simple interface that makes it pretty easy to use tosdr.org Terms of Service; Didn’t Read Kind of a wikipeda way to summarize the terms of service of different web services, and give them ratings/grades Why I write I talked about blogging more last episode. Here’s a cool write-up by Sheena O'Connell reasons to remember to refine my thinking to impact to get through hard times to connect Three pytest Features You Will Love Helen Scott at JetBrains/PyCharm Fixtures, Markers, Parametrize Plus shoutouts to my course and book Extras Brian: Wikipedia List of common misconceptions - just for fun Ear Trumpet Labs (a Potland Company) Edwina mic - just something on my wish list Michael Mozilla Monitor Python 3.12.2 Upgraded all the Python apps (11 of them) in about 2 minutes and one command Got a Vision Pro? Try the Talk Python Courses app Great video event: Data Doodling with Martina Pugliese Joke: Free Tier