Python Bytes: Recent Episodes

Michael Kennedy and Brian Okken

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.

View Details

Topics covered in this episode:
Free-threaded Python no longer “experimental” as of Python 3.14 * typed-ffmpeg * pyleak * Optimizing Test Execution: Running live_server Tests Last with pytest * Extras * Joke*

Watch on YouTube
About the show

Sponsored by PropelAuth: pythonbytes.fm/propelauth66

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: Free-threaded Python no longer “experimental” as of Python 3.14

  • “PEP 779 ("Criteria for supported status for free-threaded Python") has been accepted, which means free-threaded Python is now a supported build!” - Hugo van Kemenade
  • PEP 779 – Criteria for supported status for free-threaded Python
  • As noted in the discussion of PEP 779, “The Steering Council (SC) approves PEP 779, with the effect of removing the “experimental” tag from the free-threaded build of Python 3.14.”
  • We are in Phase II then.
  • “We are confident that the project is on the right path, and we appreciate the continued dedication from everyone working to make free-threading ready for broader adoption across the Python community.”
  • “Keep in mind that any decision to transition to Phase III, with free-threading as the default or sole build of Python is still undecided, and dependent on many factors both within CPython itself and the community. We leave that decision for the future.”
  • How long will all this take? According to Thomas Wouters, a few years, at least: “In other words: it'll be a few years at least. It can't happen before 3.16 (because we won't have Stable ABI support until 15) and may well take longer.”

Michael #2: typed-ffmpeg

  • typed-ffmpeg offers a modern, Pythonic interface to FFmpeg, providing extensive support for complex filters with detailed typing and documentation.
  • Inspired by ffmpeg-python, this package enhances functionality by addressing common limitations, such as lack of IDE integration and comprehensive typing, while also introducing new features like JSON serialization of filter graphs and automatic FFmpeg validation.
  • Features :

    • Zero Dependencies: Built purely with the Python standard library, ensuring maximum compatibility and security.
    • User-Friendly: Simplifies the construction of filter graphs with an intuitive Pythonic interface.
    • Comprehensive FFmpeg Filter Support: Out-of-the-box support for most FFmpeg filters, with IDE auto-completion.
    • Integrated Documentation: In-line docstrings provide immediate reference for filter usage, reducing the need to consult external documentation.
    • Robust Typing: Offers static and dynamic type checking, enhancing code reliability and development experience.
    • Filter Graph Serialization: Enables saving and reloading of filter graphs in JSON format for ease of use and repeatability.
    • Graph Visualization: Leverages graphviz for visual representation, aiding in understanding and debugging.
    • Validation and Auto-correction: Assists in identifying and fixing errors within filter graphs.
    • Input and Output Options Support: Provide a more comprehensive interface for input and output options, including support for additional codecs and formats.
    • Partial Evaluation: Enhance the flexibility of filter graphs by enabling partial evaluation, allowing for modular construction and reuse.
    • Media File Analysis: Built-in support for analyzing media files using FFmpeg's ffprobe utility, providing detailed metadata extraction with both dictionary and dataclass interfaces.

Michael #3: pyleak

  • Detect leaked asyncio tasks, threads, and event loop blocking with stack trace in Python. Inspired by goleak.
  • Use as context managers or function dectorators
  • When using no_task_leaks, you get detailed stack trace information showing exactly where leaked tasks are executing and where they were created.
  • Even has great examples and a pytest plugin.

Brian #4: Optimizing Test Execution: Running live_server Tests Last with pytest

  • Tim Kamanin
  • “When working with Django applications, it's common to have a mix of fast unit tests and slower end-to-end (E2E) tests that use pytest's live_server fixture and browser automation tools like Playwright or Selenium. ”
  • Tim is running E2E tests last for

    • Faster feedback from quick tests
    • To not tie up resources early in the test suite.
    • He did this with

    • custom “e2e” marker

    • Implementing a

    pytest_collection_modifyitems hook function to look for tests using the

    live_server fixture, and for them

    - automatically add the `e2e` marker to those tests
    - move those tests to the end
    
    • The reason for the marker is to be able to

    • Just run e2e tests with -m e2e

    • Avoid running them sometimes with -m "not e2e"
    • Cool small writeup.

    • The technique works for any system that has some tests that are slower or resource bound based on a particular fixture or set of fixtures.

Extras

Brian:

  • Is Free-Threading Our Only Option? - Interesting discussion started by Eric Snow and recommended by John Hagen
  • Free-threaded Python on GitHub Actions - How to add FT tests to your projects, by Hugo van Kemenade

Michael:

  • New course! LLM Building Blocks in Python
  • Talk Python Deep Dives Complete: 600K Words of Talk Python Insights
  • .folders on Linux
    • Write up on XDG for Python devs.
  • They keep pulling me back - ChatGPT Pro with o3-pro
  • Python Bytes is the #1 Python news podcast and #17 of all tech news podcasts.
  • Python 3.13.4, 3.12.11, 3.11.13, 3.10.18 and 3.9.23 are now available
  • Python 3.13.5 is now available!

Joke: Naming is hard

View Details

Topics covered in this episode:
platformdirs * poethepoet - Poe the Poet is a batteries included task runner that works well with poetry or with uv.” * Python Pandas Ditches NumPy for Speedier PyArrow * pointblank: Data validation made beautiful and powerful * 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 / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: platformdirs

  • A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".
  • Why the community moved on from appdirs to platformdirs
  • At AppDirs:
    • Note: This project has been officially deprecated. You may want to check out pypi.org/project/platformdirs/ which is a more active fork of appdirs. Thanks to everyone who has used appdirs. Shout out to ActiveState for the time they gave their employees to work on this over the years.
  • Better than AppDirs:
    • Works today, works tomorrow – new Python releases sometimes change low-level APIs (win32com, pathlib, Apple sandbox rules). platformdirs tracks those changes so your code keeps running.
    • First-class typing – no more types-appdirs stubs; editors autocomplete paths as Path objects.
    • Richer directory set – if you need a user’s Downloads folder or a per-session runtime dir, there’s a helper for it.
    • Cleaner internals – rewritten to use pathlib, caching, and extensive test coverage; all platforms are exercised in CI.
    • Community stewardship – the project lives in the PyPA orbit and gets security/compatibility patches quickly.

Brian #2: poethepoet - Poe the Poet is a batteries included task runner that works well with poetry or with uv.”

  • from Bob Belderbos
  • Tasks are easy to define and are defined in pyproject.toml

Michael #3: Python Pandas Ditches NumPy for Speedier PyArrow

  • Pandas 3.0 will significantly boost performance by replacing NumPy with PyArrow as its default engine, enabling faster loading and reading of columnar data.
  • Recently talked with Reuven Lerner about this on Talk Python too.
  • In the next version, v3.0, PyArrow will be a required dependency, with pyarrow.string being the default type inferred for string data.
  • PyArrow is 10 times faster.
  • PyArrow offers columnar storage, which eliminates all that computational back and forth that comes with NumPy.
  • PyArrow paves the way for running Pandas, by default, on Copy on Write mode, which improves memory and performance usage.

Brian #4: pointblank: Data validation made beautiful and powerful

  • “With its … chainable API, you can … validate your data against comprehensive quality checks …”

Extras

Brian:

  • Ruff rules
  • Ruff users, what rules are using and what are you ignoring?
  • Python 3.14.0b2 - did we already cover this?
  • Transferring your Mastodon account to another server, in case anyone was thinking about doing that
  • I’m trying out Fathom Analytics for privacy friendly analytics

Michael:

  • Polars for Power Users: Transform Your Data Analysis Game Course

Joke: Does your dog bite?

View Details

Topics covered in this episode:
Making PyPI’s test suite 81% faster * People aren’t talking enough about how most of OpenAI’s tech stack runs on Python * PyCon Talks on YouTube * Optimizing Python Import Performance * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Digital Ocean: pythonbytes.fm/digitalocean-gen-ai Use code DO4BYTES and get $200 in free credit

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: Making PyPI’s test suite 81% faster

  • Alexis Challande
  • The PyPI backend is a project called Warehouse
  • It’s tested with pytest, and it’s a large project, thousands of tests.
  • Steps for speedup
    • Parallelizing test execution with pytest-xdist
      • 67% time reduction
      • --numprocesses=auto allows for using all cores
      • DB isolation - cool example of how to config postgress to give each test worker it’s on db
      • They used pytest-sugar to help with visualization, as xdist defaults to quite terse output
    • Use Python 3.12’s sys.monitoring to speed up coverage instrumentation
      • 53% time reduction
      • Nice example of using COVERAGE_CORE=sysmon
    • Optimize test discovery
      • Always use testpaths
      • Sped up collection time. 66% reduction (collection was 10% of time)
      • Not a huge savings, but it’s 1 line of config
    • Eliminate unnecessary imports
      • Use python -X importtime
      • Examine dependencies not used in testing.
      • Their example: ddtrace
        • A tool they use in production, but it also has a couple pytest plugins included
        • Those plugins caused ddtrace to get imported
        • Using -p:no ddtrace turns off the plugin bits
  • Notes from Brian:
    • I often get questions about if pytest is useful for large projects.
    • Short answer: Yes!
    • Longer answer: But you’ll probably want to speed it up
    • I need to extend this article with a general purpose “speeding up pytest” post or series.
    • -p:no can also be used to turn off any plugin, even builtin ones.
      • Examples include
        • nice to have developer focused pytest plugins that may not be necessary in CI
        • CI reporting plugins that aren’t needed by devs running tests locally

Michael #2: People aren’t talking enough about how most of OpenAI’s tech stack runs on Python

  • Original article: Building, launching, and scaling ChatGPT Images
  • Tech stack: The technology choices behind the product are surprisingly simple; dare I say, pragmatic!
    • Python: most of the product’s code is written in this language.
    • FastAPI: the Python framework used for building APIs quickly, using standard Python type hints. As the name suggests, FastAPI’s strength is that it takes less effort to create functional, production-ready APIs to be consumed by other services.
    • C: for parts of the code that need to be highly optimized, the team uses the lower-level C programming language
    • Temporal: used for asynchronous workflows and operations inside OpenAI. Temporal is a neat workflow solution that makes multi-step workflows reliable even when individual steps crash, without much effort by developers. It’s particularly useful for longer-running workflows like image generation at scale

Michael #3: PyCon Talks on YouTube

  • Some talks that jumped out to me:
    • Keynote by Cory Doctorow
    • 503 days working full-time on FOSS: lessons learned
    • Going From Notebooks to Scalable Systems
      • And my Talk Python conversation around it. (edited episode pending)
    • Unlearning SQL
    • The Most Bizarre Software Bugs in History
    • The PyArrow revolution in Pandas
      • And my Talk Python episode about it.
    • What they don't tell you about building a JIT compiler for CPython
      • And my Talk Python conversation around it (edited episode pending)
    • Design Pressure: The Invisible Hand That Shapes Your Code
    • Marimo: A Notebook that"Compiles" Python for Reproducibility and Reusability
      • And my Talk Python episode about it.
    • GPU Programming in Pure Python
      • And my Talk Python conversation around it (edited episode pending)
    • Scaling the Mountain: A Framework for Tackling Large-Scale Tech Debt

Brian #4: Optimizing Python Import Performance

  • Mostly pay attention to #'s 1-3
  • This is related to speeding up a test suite, speeding up necessary imports.
  • Finding what’s slow
    • Use python -X importtime <the reset of the command
    • Ex: python -X importtime ptyest
  • Techniques
    • Lazy imports
      • move slow-to-import imports into functions/methods
    • Avoiding circular imports
      • hopefully you’re doing that already
    • Optimize __init__.py files
      • Avoid unnecessary imports, heavy computations, complex logic
  • Notes from Brian
    • Some questions remain open for me
      • Does module aliasing really help much?
    • This applies to testing in a big way
      • Test collection imports your test suite, so anything imported at the top level of a file gets imported at test collection time, even if you only are running a subset of tests using filtering like -x or -m or other filter methods.
      • Run -X importtime on test collection.
      • Move slow imports into fixtures, so they get imported when needed, but NOT at collection.
  • See also:
    • option-X in the standard docs
    • Consider using import_profile

Extras

Brian:

  • PEPs & Co.
    • PEP is a ‘backronym”, an acronym where the words it stands for are filled in after the acronym is chosen. Barry Warsaw made this one up.
    • There are a lot of “enhancement proposal” and “improvement proposal” acronyms now from other communities
  • pythontest.com has a new theme
    • More colorful. Neat search feature
    • Now it’s excruciatingly obvious that I haven’t blogged regularly in a while
      • I gotta get on that
    • Code highlighting might need tweaked for dark mode

Michael:

  • git-bug
  • Pyrefly follow up

Joke: There is hope.

View Details

Topics covered in this episode:
git-flight-rules * Uravelling t-strings * neohtop * Introducing Pyrefly: A new type checker and IDE experience for Python * 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 / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: git-flight-rules

  • What are "flight rules"?
    • A guide for astronauts (now, programmers using Git) about what to do when things go wrong.
    • Flight Rules are the hard-earned body of knowledge recorded in manuals that list, step-by-step, what to do if X occurs, and why. Essentially, they are extremely detailed, scenario-specific standard operating procedures. [...]
    • NASA has been capturing our missteps, disasters and solutions since the early 1960s, when Mercury-era ground teams first started gathering "lessons learned" into a compendium that now lists thousands of problematic situations, from engine failure to busted hatch handles to computer glitches, and their solutions.
  • Steps for common operations and actions
    • I want to start a local repository
    • What did I just commit?
    • I want to discard specific unstaged changes
    • Restore a deleted file

Brian #2: Uravelling t-strings

  • Brett Cannon
  • Article walks through
    • Evaluating the Python expression
    • Applying specified conversions
    • Applying format specs
    • Using an Interpolation class to hold details of replacement fields
    • Using Template class to hold parsed data
  • Plus, you don’t have to have Python 3.14.0b1 to try this out.
  • The end result is very close to an example used in PEP 750, which you do need 3.14.0b1 to try out.
  • See also:
    • I’ve written a pytest version, Unravelling t-strings with pytest, if you want to run all the examples with one file.

Michael #3: neohtop

  • Blazing-fast system monitoring for your desktop
  • Features
    • Real-time process monitoring
    • CPU and Memory usage tracking
    • Beautiful, modern UI with dark/light themes
    • Advanced process search and filtering
    • Pin important processes
    • Process management (kill processes)
    • Sort by any column
    • Auto-refresh system stats

Brian #4: Introducing Pyrefly: A new type checker and IDE experience for Python

  • From Facebook / Meta
  • Another Python type checker written in Rust
  • Built with IDE integration in mind from the beginning
  • Principles
    • Performance
    • IDE first
    • Inference (inferring types in untyped code)
    • Open source
  • I mistakenly tried this on the project I support with the most horrible abuses of the dynamic nature of Python, pytest-check. It didn’t go well. But perhaps the project is ready for some refactoring. I’d like to try it soon on a more well behaved project.

Extras

Brian:

  • Python: The Documentary Official Trailer
  • Tim Hopper added Setting up testing with ptyest and uv to his “Python Developer Tooling Handbook”
  • For a more thorough intro on pytest, check out courses.pythontest.com
  • pocket is closing, I’m switching to Raindrop
    • I got one question about code formatting. It’s not highlighted, but otherwise not bad.

Michael:

  • New course! Polars for Power Users: Transform Your Data Analysis Game
  • Apache Airflow 3.0 Released
  • Paste 5

Joke: Theodore Roosevelt’s Man in the Arena, but for programming

View Details

Topics covered in this episode:
pre-commit: install with uv * PEP 773: A Python Installation Manager for Windows (Accepted) * Changes for Textual * The Best Programmers I Know * Extras * Joke*

Watch on YouTube
About the show

Sponsored by NordLayer: pythonbytes.fm/nordlayer

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: pre-commit: install with uv

  • Adam Johnson
  • uv tool works great at keeping tools you use on lots of projects up to date quickly, why not use it for pre-commit.
  • The extension of pre-commit-uv will use uv to create virtual environments and install packages fore pre-commit. This speeds up initial pre-commit cache creation.
  • However, Adam is recommending this flavor of using pre-commit because it’s just plain easier to install pre-commit and dependencies than the official pre-commit install guide.
  • Win-win.
  • Side note: No Adam, I’m not going to pronounce uv “uhv”, I’ll stick with “you vee”, even Astral tells me I’m wrong

Michael #2: PEP 773: A Python Installation Manager for Windows (Accepted)

  • via pycoders newsletter
  • One manager to rule them all – PyManager.
  • PEP 773 replaces all existing Windows installers (.exe “traditional” bundle, per-version Windows Store apps, and the separate py.exe launcher) with a single MSIX app called Python Install Manager (nick-named PyManager).
  • PyManager should be mainstream by CPython 3.15, and the traditional installer disappears no earlier than 3.16 (≈ mid-2027).
  • Simple, predictable commands.
    • python → launches “the best” runtime already present or auto-installs the latest CPython if none is found.
    • py → same launcher as today plus management sub-commands:
    • py install, py uninstall, py list, py exec, py help.
    • Optional python3 and python3.x aliases can be enabled by adding one extra PATH entry.

Michael #3: Changes for Textual

  • Bittersweet news: the business experiment ends, but the code lives on.
  • Textual began as a hobby project layered on top of Rich, but it has grown into a mature, “makes-the-terminal-do-the-impossible” TUI framework with an active community and standout documentation.
  • Despite Textual’s technical success, the team couldn’t pinpoint a single pain-point big enough to sustain a business model, so the company will wind down in the coming weeks.
  • The projects themselves aren’t going anywhere: they’re stable, battle-tested, and will continue under the stewardship of the original author and the broader community.

Brian #4: The Best Programmers I Know

  • Matthias Endler
  • “I have met a lot of developers in my life. Lately, I asked myself: “What does it take to be one of the best? What do they all have in common?””
  • The list
    • Read the reference
    • Know your tools really well
    • Read the error message
    • Break down problems
    • Don’t be afraid to get your hands dirty
    • Always help others
    • Write
    • Never stop learning
    • Status doesn’t matter
    • Build a reputation
    • Have patience
    • Never blame the computer
    • Don’t be afraid to say “I don’t know”
    • Don’t guess
    • Keep it simple
  • Each topic has a short discussion. So don’t just ready the bullet points, check out the article.

Extras

Brian:

  • I had a great time in Munich last week. I a talk at a company event, met with tons of people, and had a great time.
    • The best part was connecting with people from different divisions working on similar problems.
    • I love the idea of internal conferences to get people to self organize by topic and meet people they wouldn’t otherwise, to share ideas.
    • Also got started working on a second book on the plane trip back.

Michael:

  • Talk Python Clips (e.g. mullet)
  • Embrace your cloud firewall (example).
  • Python 3.14.0 beta 1 is here
  • Congrats to the new PSF Fellows.
  • Cancelled faster CPython
  • bsky.app/profile/snarky.ca post

Joke: How To Fix Your Computer

View Details

Topics covered in this episode:
pirel: Python release cycle in your terminal * FastAPI Cloud * Python's new t-strings * Extras * Joke*

Watch on YouTube
About the show

Sponsored by NordLayer: pythonbytes.fm/nordlayer

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: pirel: Python release cycle in your terminal

  • pirel check shows release information about your active Python interpreter.
  • If the active version is end-of-life, the program exits with code 1. If no active Python interpreter is found, the program exits with code 2.
  • pirel list lists all Python releases in a table. Your active Python interpreter is highlighted.
  • A picture is worth many words

Brian #2: FastAPI Cloud

  • Sebastián Ramírez, creator of FastAPI, announced today the formation of a new Company, FastAPI Cloud.
  • Here’s the announcement blog post: FastAPI Cloud - By The Same Team Behind FastAPI
  • There’s a wait list to try it out.
  • Promises to turns deployment into fastapi login; fastapi deploy
  • Side note: announcement includes quote from Daft Punk: Build Harder, Better, Faster, Stronger
    • I just included this in a talk I’m gave last week (and will again next week), where I modify this to “Build Easier, Better, Faster, Stronger”
    • Sebastian and I are both fans of the rocket emoji.
  • BTW, we first covered FastAPI on episode 123 in 2019

Brian #3: Python's new t-strings

  • Dave Peck, one of the authors of PEP 750, which will go into Python 3.14
  • We covered t-strings in ep 428
  • In article
    • t-strings security benefits over f-strings
    • How to work with t-strings
    • A Pig Latin example
      • Also, I think I have always done this wrong
      • Is it the first consonant to the end? or the first consonant cluster?
      • So… Brian → Rianbay? or Ianbray?
      • BTW, this is an example of nerdgassing
    • What’s next once t-strings ship?
  • On thing that’s next (in Python 3.15, maybe, is using t-strings in shlex and subprocess)
    • PEP 787 – Safer subprocess usage using t-strings deferred to 3.15

Michael #4: zev

  • A simple CLI tool to help you remember terminal commands.
  • Examples:

```

Find running processeszev 'show all running python processes'# File operationszev 'find all .py files modified in the last 24 hours'# System informationzev 'show disk usage for current directory'# Network commandszev 'check if google.com is reachable'# Git operationszev 'show uncommitted changes in git'

``` * Again, picture worth many words:

Extras

Brian:

  • Holy Grail turns 50
  • nerdgassing

Michael:

  • Transcripts are a bit better now.
  • Zen is better now

Joke: Can my friend come in?

View Details

Topics covered in this episode:
pip 25.1 has dependency groups, pylock.toml, plus more * aiohttp goes free threaded * uv 0.6.15 supports pylock.toml * Whenever * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Porkbun! Use our link pythonbytes.fm/porkbun and get a .app or .dev domain for $5.99 at Porkbun.

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: pip 25.1 has dependency groups, pylock.toml, plus more

  • post What's new in pip 25.1 - Dependency groups!
  • Richard Si
  • Discovered this through Hugo van Kemenade
  • Dependency groups, PEP 735, supported

```

pyproject.toml[dependency-groups]test = ["pytest", "pytest-xdist"]lint = ["mypy", "isort"]# Dependency Groups can include other groups! ✨dev = [ {include-group = "test"}, {include-group = "lint"} ]

``` * Package installation progress bar * Resumable downloads * Experimental lockfile generation, PEP 751, with pip lock + so cool * pip index versions is stable, no longer experimental + use this to get a list of available versions + ex: python3 -m pip index versions pytest-check + combine with --json to get a nice script readable output

Michael #2: aiohttp goes free threaded

  • Thanks to months of consistent contributions by Lysandros Nikolaou, all of the mandatory dependencies of #aiohttp now ship free-threaded variants of #wheels!
  • This unlocks the same in aiohttp!

Brian #3: uv 0.6.15 supports pylock.toml

  • Discovered through Brett Cannon
  • So far, these projects support pylock.toml
    • pip
    • pip-audit
    • pdm
    • uv
  • With uv
    • To export a uv.lock to the pylock.toml format,
      • run: uv export -o pylock.toml
    • To generate a pylock.toml file from a set of requirements,
      • run: uv pip compile -o pylock.toml -r requirements.in
    • To install from a pylock.toml file,
      • run: uv pip sync pylock.toml or uv pip install -r pylock.toml

Michael #4: Whenever

  • via Pat Decker
  • Typed and DST-safe datetimes for Python, available in Rust or pure Python.
  • Whenever helps you write correct and type checked datetime code.
  • It's also way faster than other third-party libraries—and usually the standard library as well.

Extras

Brian:

  • Every UUID

Michael:

  • New Vulnerability in GitHub Copilot and Cursor: How Hackers Can Weaponize Code Agents via Brian Skinn
  • And typosquatting in the AI age
  • Firefox Send alternatives
    • file.pizza via @rafaelwo
    • bitwarden send

Joke: Can you Vibe?

  • Interview with Vibe Coder in 2025
  • Senior Engineer tries Vibe Coding

View Details

Topics covered in this episode:
Huly * CVE Foundation formed to take over CVE program from MITRE * drawdb * 14 Advanced Python Features * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Posit Workbench: pythonbytes.fm/workbench

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: Huly

  • All-in-One Project Management Platform (alternative to Linear, Jira, Slack, Notion, Motion)
  • If you're primarily interested in self-hosting Huly without the intention to modify or contribute to its development, please use huly-selfhost.
  • Manage your tasks efficiently with Huly's bidirectional GitHub synchronization. Use Huly as an advanced front-end for GitHub Issues and GitHub Projects.
  • Connect every element of your workflow to build a dynamic knowledge base.
  • Everything you need for productive team work: Team Planner • Project Management • Virtual Office • Chat • Documents • Inbox
  • Self hosting as a service: elest.io

Brian #2: CVE Foundation formed to take over CVE program from MITRE

  • Back story: CVE, global source of cybersecurity info, was hours from being cut by DHS
    • The 25-year-old CVE program, an essential part of global cybersecurity, is cited in nearly any discussion or response to a computer security issue.
    • CVE was at real risk of closure after its contract was set to expire on April 16.
    • The nonprofit MITRE runs CVE on a contract with the DHS.
    • A letter last Tuesday sent Tuesday by Yosry Barsoum, vice president of MITRE, gave notice of the potential halt to operations.
    • Another possible victim of the current administration.
  • CVE Foundation Launched to Secure the Future of the CVE Program
    • CVE Board members have spent the past year developing a strategy to transition CVE to a dedicated, non-profit foundation. The new CVE Foundation will focus solely on continuing the mission of delivering high-quality vulnerability identification and maintaining the integrity and availability of CVE data for defenders worldwide.
    • Over the coming days, the Foundation will release more information about its structure, transition planning, and opportunities for involvement from the broader community.

Michael #3: drawdb

  • Free and open source, simple, and intuitive database design editor, data-modeler, and SQL generator.
  • Great drag-drop relationship manager
  • Define your DB visually, export as SQL create scripts
  • Or import existing SQL to kickstart the diagramming.

Brian #4: 14 Advanced Python Features

  • Edward Li
  • Picking some favorites
      1. Typing Overloads
      1. Keyword-only and Positional-only Arguments
      1. Python Nitpicks
      2. For-else statements
      3. Walrus operator
      4. Short Circuit Evaluation
      5. Operator Chaining

Extras

Michael:

  • Thunderbird send / other firefox things.

Joke: Python Tariffs

  • Thanks wagenrace
  • Thanks Campfire Tales

View Details

Topics covered in this episode:
How to Write a Git Commit Message * Caddy Web Server * Some new PEPs approved * juv * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Posit Connect: pythonbytes.fm/connect

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: How to Write a Git Commit Message

  • Chris Beams
  • 7 rules of a great commit message
    • Separate subject from body with a blank line
    • Limit the subject line to 50 characters
    • Capitalize the subject line
    • Do not end the subject line with a period
    • Use the imperative mood in the subject line
    • Wrap the body at 72 characters
    • Use the body to explain what and why vs. how
  • Article also includes
    • Why a good commit message matters
    • Discussion about each of the 7 rules
    • Cool hat tips to other articles on the subject
      • Keep in mind: This has all been said before.”
      • Each word is a different link.

Michael #2: Caddy Web Server

  • via Fredrik Mellström
  • Like a more modern NGINX
  • Caddy automatically obtains and renews TLS certificates for all your sites.
  • Caddy's native configuration is a JSON document.
  • Even localhost and internal IPs are served with TLS using the intermediate of a fully-automated, self-managed CA that is automatically installed into most local trust stores.
  • Configure multiple Caddy instances with the same storage, and they will automatically coordinate certificate management as a fleet.
  • Production-grade static file server.

Brian #3: Some new PEPs approved

  • PEP 770 – Improving measurability of Python packages with Software Bill-of-Materials
    • Accepted for packaging
    • Author: Seth Larson, Sponsor Brett Cannon
    • “This PEP proposes using SBOM documents included in Python packages as a means to improve automated software measurability for Python packages.”
  • PEP 750 – Template Strings
    • Accepted for Python 3.14
    • Author: Jim Baker, Guido van Rossum, Paul Everitt, Kaudai Aono, Lysandros Nikolaou, Dave Peck
    • “Templates provide developers with access to the string and its interpolated values before they are combined. This brings native flexible string processing to the Python language and enables safety checks, web templating, domain-specific languages, and more.”

Michael #4: juv

  • A toolkit for reproducible Jupyter notebooks, powered by uv.
  • Create, manage, and run Jupyter notebooks with their dependencies
  • Pin dependencies with PEP 723 - inline script metadata
  • Launch ephemeral sessions for multiple front ends (e.g., JupyterLab, Notebook, NbClassic)
  • Powered by uv for fast dependency management
  • Use uvx to run jupyterlab with ephemeral virtual environments and tracked dependencies.

Extras

Brian:

  • Status of Python versions
    • new-ish format
    • Use this all the time. Can’t remember if we’ve covered the new format yet.
  • See also Python endoflife.date
    • Same dates, very visible encouragement to move on to Python 3.13 if you haven’t already.

Michael:

  • Python 3.13.3 is out.
  • .git-blame-ignore-revs follow up

Joke: BGPT (thanks Doug Farrell)

View Details

Topics covered in this episode:
Git Town solves the problem that using the Git CLI correctly * PEP 751 – A file format to record Python dependencies for installation reproducibility * git-who and watchgha * Share Python Scripts Like a Pro: uv and PEP 723 for Easy Deployment * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Posit Package Manager: pythonbytes.fm/ppm

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: Git Town solves the problem that using the Git CLI correctly

  • Git Town is a reusable implementation of Git workflows for common usage scenarios like contributing to a centralized code repository on platforms like GitHub, GitLab, or Gitea.
  • Think of Git Town as your Bash scripts for Git, but fully engineered with rock-solid support for many use cases, edge cases, and error conditions.
  • Keep using Git the way you do now, but with extra commands to create various branch types, keep them in sync, compress, review, and ship them efficiently.
  • Basic workflow
    • Commands to create, work on, and ship features.
      • git town hack - create a new feature branch
      • git town sync - update the current branch with all ongoing changes
      • git town switch - switch between branches visually
      • git town propose - propose to ship a branch
      • git town ship - deliver a completed feature branch
  • Additional workflow commands
    • Commands to deal with edge cases.
      • git town delete - delete a feature branch
      • git town rename - rename a branch
      • git town repo - view the Git repository in the browser

Brian #2: PEP 751 – A file format to record Python dependencies for installation reproducibility

  • Accepted
  • From Brett Cannon
    • “PEP 751 has been accepted!
    • This means Python now has a lock file standard that can act as an export target for tools that can create some sort of lock file. And for some tools the format can act as their primary lock file format as well instead of some proprietary format.”
    • File name: pylock.toml or at least something that starts with pylock and ends with .toml
  • It’s exciting to see the start of a standardized lock file

Michael #3: git-who and watchgha

  • git-who is a command-line tool for answering that eternal question: Who wrote this code?!
  • Unlike git blame, which can tell you who wrote a line of code, git-who tells you the people responsible for entire components or subsystems in a codebase.
  • You can think of git-who sort of like git blame but for file trees rather than individual files.

And watchgha - Live display of current GitHub action runs by Ned Batchelder

Brian #4: Share Python Scripts Like a Pro: uv and PEP 723 for Easy Deployment

  • Dave Johnson
  • Nice full tutorial discussing single file Python scripts using uv with external dependencies
  • Starting with a script with dependencies.
  • Using uv add --script [HTML_REMOVED] [HTML_REMOVED] to add a /// script block to the top
  • Using uv run
  • Adding #!/usr/bin/env -S uv run --script shebang
  • Even some Windows advice

Extras

Brian:

  • April 1 pranks done well
    • BREAKING: Guido van Rossum Returns as Python’s BDFL
      • including
        • Brett Cannon noted as “Famous Python Quotationist”
        • Guido taking credit for “I came for the language but I stayed for the community”
          • which was from Brett
          • then Brett’s title of “Famous Python Quotationist” is crossed out.
        • Barry Warsaw asking Guido about releasing Python 2.8
          • Barry is the FLUFL, “Friendly Language Uncle For Life “
        • Mariatta can’t get Guido to respond in chat until she addresses him as “my lord”.
        • “… becoming one with whitespace.”
        • “Indentation is Enlightenment”
        • Upcoming new keyword: maybe
          • Like “if” but more Pythonic
          • as in Maybe: print("Python The Documentary - Coming This Summer!")
        • I’m really hoping there is a documentary
  • April 1 pranks done poorly
    • Note: pytest-repeat works fine with Python 3.14, and never had any problems
    • If you have to explain the joke, maybe it’s not funny.
    • The explanation
      • pi, an irrational number, as in it cannot be expressed by a ratio of two integers, starts with 3.14159 and then keeps going, and never repeats.
      • Python 3.14 is in alpha and people could be testing with it for packages
      • Test & Code is doing a series on pytest plugins
      • pytest-repeat is a pytest plugin, and it happened to not have any tests for 3.14 yet.
    • Now the “joke”.
      • I pretended that I had tried pytest-repeat with Python 3.14 and it didn’t work.
      • Test & Code: Python 3.14 won't repeat with pytest-repeat
      • Thus, Python 3.14 won’t repeat.
      • Also I mentioned that there was no “rational” explanation.
      • And pi is an irrational number.

Michael:

  • pysqlscribe v0.5.0 has the “parse create scripts” feature I suggested!
  • Markdown follow up
    • Prettier to format Markdown via Hugo
    • Been using mdformat on some upcoming projects including the almost done Talk Python in Production book. Command I like is mdformat --number --wrap no ./
    • uv tool install --with is indeed the pipx inject equivalent, but requires multiple --with's:
      • pipx inject mdformat mdformat-gfm mdformat-frontmatter mdformat-footnote mdformat-gfm-alerts
      • uv tool install mdformat --with mdformat-gfm --with mdformat-frontmatter --with mdformat-footnote --with mdformat-gfm-alerts
  • uv follow up
    • From James Falcon
    • As a fellow uv enthusiast, I was still holding out for a use case that uv hasn't solved. However, after last week's episode, you guys finally convinced me to switch over fully, so I figured I'd explain the use case and how I'm working around uv's limitations.
    • I maintain a python library supported across multiple python versions and occasionally need to deal with bugs specific to a python version. Because of that, I have multiple virtualenvs for one project. E.g., mylib38 (for python 3.8), mylib313 (for python 3.13), etc. I don't want a bunch of .venv directories littering my project dir.
    • For this, pyenv was fantastic. You could create the venv with pyenv virtualenv 3.13.2 mylib313, then either activate the venv with pyenv activate mylib313 and create a .python-version file containing mylib313 so I never had to manually activate the env I want to use by default on that project.
    • uv doesn't have a great solution for this use case, but I switched to a workflow that works well enough for me:
  • Define my own central location for venvs. For me that's ~/v
  • Create venvs with something like uv venv --python 3.13 ~/v/mylib313
  • Add a simple function to my bashrc:
  • `workon() { source ~/v/$1/bin/activate } \ so now I can run \workon mylib313orworkon mylib38when I need to work in a specific environment. uv's.python-version` support works much differently than pyenv's, and that lack of support is my biggest frustration with this approach, but I am willing to live without it.
  • Do you Firefox but not Zen? You can now make pure Firefox more like Zen’s / Arc’s layout.

Joke: So here it will stay

  • See the follow up thread too!
  • Also: Guido as Lord Python via Nick Muoh

View Details

Topics covered in this episode:
mdformat * pre-commit-uv * PEP 758 and 781 * Serie: rich git commit graph in your terminal, like magic * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Posit Connect Cloud: pythonbytes.fm/connect-cloud

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)
  • Brian: @brianokken@fosstodon.org / @brianokken.bsky.social
  • Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky)

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday 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: mdformat

  • Suggested by Matthias Schöttle
  • Last episode Michael covered blacken-docs, and I mentioned it’d be nice to have an autoformatter for text markdown.
  • Matthias delivered with suggesting mdformat
  • “Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files.”
  • A python project that can be run on the command line.
  • Uses a style guide I mostly agree with.
    • I’m not a huge fan of numbered list items all being “1.”, but that can be turned off with --number, so I’m happy.
    • Converts underlined headings to #, ##, etc. headings.
    • Lots of other sane conventions.
    • The numbering thing is also sane, I just think it also makes the raw markdown hard to read.
  • Has a plugin system to format code blocks

Michael #2: pre-commit-uv

  • via Ben Falk
  • Use uv to create virtual environments and install packages for pre-commit.

Brian #3: PEP 758 and 781

  • PEP 758 – Allow except and except* expressions without parentheses
    • accepted
  • PEP 781 – Make TYPE_CHECKING a built-in constant
    • draft status
  • Also, PEP Index by Category kinda rocks

Michael #4: Serie: rich git commit graph in your terminal, like magic

  • While some users prefer to use Git via CLI, they often rely on a GUI or feature-rich TUI to view commit logs.
  • Others may find git log --graph sufficient.
  • Goals
    • Provide a rich git log --graph experience in the terminal.
    • Offer commit graph-centric browsing of Git repositories.

Extras

Michael:

  • Sunsetting Search? (Startpage)
  • Ruff in or out?

Joke: Wishing for wishes

View Details

Topics covered in this episode:
Why aren't you using uv? * Python Developer Tooling Handbook * Calling all doc writers: blacken-docs * Reinventing notebooks as reusable Python programs * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/425

View Details

Topics covered in this episode:
The weird quirk with rounding in Python * Python interpreter adds tail calls * Remove punctuation from a string with translate and maketrans * Extra, extra, extra * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/424

View Details

Topics covered in this episode:
pysqlscribe * A map of Python * Rust, C++, and Python trends in jobs on Hacker News(February 2025) * The features of Python's help() function * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/423

View Details

Topics covered in this episode:
My 2025 uv-based Python Project Layout for Production Apps * aiolimiter * A peek into a possible future of Python in the browser * Reloadium * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/422

View Details

Topics covered in this episode:
httpdbg * PyPI Now Supports iOS and Android Wheels for Mobile Python Development * Arcade Game Platform goes 3.0 * PEP 765 – Disallow return/break/continue that exit a finally block * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/421

View Details

Topics covered in this episode:
PEP 772 – Packaging governance process * Official Django MongoDB Backend Now Available in Public Preview * Developer Philosophy * Python 3.13.2 released * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/420

View Details

Topics covered in this episode:
content-types package for better MIME types/Content-Type * Wagtail 6.4 * Build It Yourself * Build backend popularity over time * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/419

View Details

Topics covered in this episode:
In memoriam: Michael Foord 1974-2025 * Valkey(Redis Replacement) * 30 best practices for software development and testing * mimetype.io * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/418

View Details

Topics covered in this episode:
LLM Catcher * On PyPI Quarantine process * RESPX * Unpacking kwargs with custom objects * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/417

View Details

Topics covered in this episode:
Terminals & Shells * Winloop: An Alternative library for uvloop compatibility with windows * Ruff & uv * uv-secure * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/416

View Details

Topics covered in this episode:
dbos-transact-py * Typed Python in 2024: Well adopted, yet usability challenges persist * RightTyper * Lazy self-installing Python scripts with uv * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/415

View Details

Topics covered in this episode:
New project to shorten django-admin to django because we are not monsters * django-unicorn: The magical reactive component framework for Django * Testing some tidbits * The State of Python 2024 article * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/414

View Details

Topics covered in this episode:
jiter * A new home for python-build-standalone * moka-py * uv: An In-Depth Guide * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/413

View Details

Topics covered in this episode:
Loop targets * asyncstdlib * Bagels: TUI Expense Tracker * rloop: An AsyncIO event loop implemented in Rust * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/412

View Details

Topics covered in this episode:
Talk Python rewritten in Quart * PyPI now supports digital attestations * Django Rusty Templates * PEP 639 is now supported by PYPI * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/411

View Details

Topics covered in this episode:
Thoughts on Django’s Core * futurepool * Don't return named tuples in new APIs * Ziglang: Migrating from AWS to Self-Hosting * Extras * Joke*

See the full show notes for this episode on the website at pythonbytes.fm/410

View Details

Topics covered in this episode:
terminal-tree * posting: The API client that lives in your terminal * Extra, extra, extra * UV does everything or enough that I'm not sure what else it needs to do * Extras * Joke*

Watch on YouTube
About the show

Sponsored by:

  • ScoutAPM - Django Application Performance Monitoring
  • Codeium - Free AI Code Completion & Chat

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 Monday 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: terminal-tree

  • An experimental filesystem navigator for the terminal, built with Textual
  • Tested in macOS only at this point. Chances are very high it works on Linux. Slightly lower chance (but non-zero) that it works on Windows.
    • Can confirm it works on Linux

Brian #2: posting: The API client that lives in your terminal

  • Also uses Textual
  • From Darren Burns
  • Interesting that the installation instructions recommends using uv:
    • uv tool install --python 3.12 posting
  • Very cool. Great docs. Beautiful. keyboard centric, but also usable with a mouse.
  • “Fly through your API workflow with an approachable yet powerful keyboard-centric interface. Run it locally or over SSH on remote machines and containers. Save your requests in a readable and version-control friendly format.”
  • Able to save multiple environments
  • Great colors
  • Allows scripting to run Python code before and after requests to prepare headers, set variables, etc.

Michael #3: Extra, extra, extra

  • spaCy course swag give-away, enter for free
  • New essay: Opposite of Cloud Native is?
  • News: We've moved to Hetzner
  • New package: Introducing chameleon-flask package
  • New release: Listmonk Python client
  • TIOBE Update
  • PEP 750 – Template Strings
  • Canary email
  • Left Omnivore, for Pocket, left Pocket for, …, landed on Instapaper
    • Supports direct import from Omnivore and Pocket
    • Though Hoarder is compelling
  • Trying out Zen Browser
    • Wasn’t a fan of Arc (especially now) but the news turned me on to Zen

Brian #4: UV does everything or enough that I'm not sure what else it needs to do

  • Jeff Triplett
  • “UV feels like one of those old infomercials where it solves everything, which is where we have landed in the Python world.”
  • “My favorite feature is that UV can now bootstrap a project to run on a machine that does not previously have Python installed, along with installing any packages your application might require.”
  • Partial list (see Jeff’s post for his complete list)
    • uv pip install replaces pip install
    • uv venv replaces python -m venv
    • uv run, uv tool run, and uv tool install replaces pipx
    • uv build - Build your Python package for pypi
    • uv publish - Upload your Python package to pypi, replacing twine and flit publish

Extras

Brian:

  • Coverage.py originally was just one file
  • Trying out BlueSky brianokken.bsky.social
    • Not because of Taylor Swift, but nice.
    • There are a lot of Python people there.

Joke: How programmers sleep

View Details

Topics covered in this episode:
GitHub action security: zizmor * Python is now the top language on GitHub * Python 3.13, what didn't make the headlines * PyCon US 2025 * Extras * Joke*

Watch on YouTube
About the show

Sponsored by:

  • ScoutAPM - Django Application Performance Monitoring
  • Codeium - Free AI Code Completion & Chat

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 Monday 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: GitHub action security: zizmor

  • Article: Ned Batchelder
  • zizmor: William Woodruff & others
  • “a new tool to check your GitHub action workflows for security concerns.”
  • Install with cargo or brew, then point it at workflow yml files.
  • It reports security concerns.

Michael #2: Python is now the top language on GitHub

  • Thanks to Pat Decker for the heads up.
  • A rapidly growing number of developers worldwide
    • This suggests AI isn’t just helping more people learn to write code or build software faster—it’s also attracting and helping more people become developers. First-time open source contributors continue to show wide-scale interest in AI projects. But we aren’t seeing signs that AI has hurt open source with low-quality contributions.
  • Python is now the most used language on GitHub as global open source activity continues to extend beyond traditional software development.
    • The rise in Python usage correlates with large communities of people joining the open source community from across the STEM world rather than the traditional community of software developers.
  • There’s a continued increase in first-time contributors to open source projects. 1.4 million new developers globally joined open source with a majority contributing to commercially backed and generative AI projects.
    • Notably, we did not see a rise in rejected pull requests. This could indicate that quality remains high despite the influx of new contributors.

Brian #3: Python 3.13, what didn't make the headlines

  • Some pretty cool updates to pdb : the command line Python debugger
    • multiline editing
    • code completion
  • pathlib has a bunch of performance updates
  • python -m venv adds a .gitignore file that auto ignores the venv.

Michael #4: PyCon US 2025

  • Site is live with CFP and dates
  • Health code is finally reasonable: “Masks are Encouraged but not Required”
  • PyCon US 2025 Dates
    • Tutorials - May 14-15, 2025
    • Sponsor Presentations - May 15, 2025
    • Opening Reception - May 15, 2025
    • Main Conference and Online - May 16-18, 2025
    • Job Fair - May 18, 2025
    • Sprints - May 19-May 22, 2025

Extras

Brian:

  • Please publish and share more - Jeff Triplett

Michael:

  • pre-commit-uv
    • Just spoke with Sefanie Molin about pre-commit hooks on Talk Python
  • Curse you Omnivore!
  • We have moved to hetzner
  • Typora markdown app
  • free-threaded Python is now available via uv uv self updateuv python install --python-preference only-managed 3.13t

Joke: Debugging char

View Details

Topics covered in this episode:
Python 3.14.0 alpha 1 is now available * uv supports dependency groups * dive: A tool for exploring each layer in a docker image * pytest-metadata * 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 & Hello, pytest!
  • 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 Monday 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: Python 3.14.0 alpha 1 is now available

  • First of seven planned alpha releases.
  • Many new features for Python 3.14 are still being planned and written. Among the new major new features and changes so far:
    • PEP 649: deferred evaluation of annotations
    • Improved error messages

Brian #2: uv supports dependency groups

  • we covered dependency groups in episode 406
  • as of 0.4.27, uv supports dependency groups
  • docs show how to add dependencies with uv add --group
    • also “The --dev, --only-dev, and --no-dev flags are equivalent to --group dev, --only-group dev, and --no-group dev respectively.”
  • To install a group, uv pip install --group doesn’t work yet.
    • It’s waiting for PyPA to decide on an interface for pip, and uv pip will use that interface.
  • But sync works. $ uv init # create a pyproject.toml$ uv add --group foo pytest$ uv venv # create venv$ uv sync --group foo # will install all dependencies, including group "foo"

Michael #3: dive: A tool for exploring each layer in a docker image

  • via Mike Fiedler
  • Features:
    • Show Docker image contents broken down by layer
    • Indicate what's changed in each layer
    • Estimate "image efficiency"
    • Quick build/analysis cycles
    • CI Integration

Brian #4: pytest-metadata

  • An incredibly useful plugin for adding, you guessed it, metadata, to your pytest results.
  • Required for pytest-html but also useful on it’s own
  • Adds metadata to
    • text output with --verbose
    • xml output when using --junit-xml, handy for CI systems that support junit.xml
  • Other plugins depend on this and report in other ways, such as pytest-html
  • By default, already grabs
    • Python version
    • Platform info
    • List of installed packages
    • List of installed pytest plugins
  • You can add your own metadata
  • You can access all metadata (and add to it) from tests, fixtures, and hook functions via a metadata fixture.
  • This is in the Top pytest Plugins list, currently #5.

Extras

Brian:

  • I’ve started filtering deprecated plugins from the pytest plugin list.
  • I’m also going to start reviewing the list and pulling out interesting plugins as the topic of the next season of Test & Code.

Michael:

  • Pillow 11 is out
  • pip install deutschland
  • Talk Python has a dedicated blog, please subscribe!

Joke: Dog names

View Details

Topics covered in this episode:
Open Source Pledge * Jeff Triplet's DjangoTV * PEP 735 – Dependency Groups in pyproject.toml * livereload * 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 Monday 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: Open Source Pledge

  • Learned about this because of this post
    • Why Django supports the Open Source Pledge
  • Steps
    • Pay Open Source maintainers.
      • Min to participate is 2k/year/dev at your company
    • Self-report annually
      • Publish a blog post outlining your payments
  • Armin’s post about launching Open Source Pledge and mixing money with open source

Michael #2: Jeff Triplet's DjangoTV

  • A nice aggregation of lots of Django conference talks
  • Filter by conference
  • Good search as well

Brian #3: PEP 735 – Dependency Groups in pyproject.toml

  • Author: Stephen Rosen, Sponsor: Brett Cannon, PEP-Delegate: Paul Moore
  • Accepted. Resolotion Oct 10, 2024
  • “This PEP specifies a mechanism for storing package requirements in pyproject.toml files such that they are not included in any built distribution of the project.”
  • Allow us to define named groups of dependencies that can be independent of the main project.
  • ex:

[dependency-groups]test = ["pytest", "coverage"]docs = ["sphinx", "sphinx-rtd-theme"]typing = ["mypy", "types-requests"]typing-test = [{include-group = "typing"}, {include-group = "test"}, "useful-types"] * “might” work like this: pip install --dependency-groups=test,typing

+ but tool venders are able to define how they use groups. Of course.
  • Similar solutions
    • multiple requirements.txt files: requirements_test.txt, requirements_docs.txt, etc.
      • no standard naming convention, not standardized
    • package extras:
      • not gauranteed to be statically defined (TIL)
      • additional to main dependencies, so not independent

Michael #4: livereload

  • Example from talkpython.fm: asset_bundler_watcher.py
  • The docs are sparse, so see the gist above

Extras

Brian:

  • Personal Blogs are no longer personal when AI gets too involved - KJayMiller
  • Mind Your Image Metadata - Stefanie Molin

Michael:

  • 14% of our listeners are in Germany, thanks Germany!
    • Prost!
  • Hetzner comes to the US

Joke:

  • A programmer’s partner asks them: “Would you go get a loaf of bread from the store? And if they have eggs, get a dozen.”
  • A while later, the programmer returns with 12 loaves of bread and says “They had eggs.”
    • From https://savvyprogrammer.io/software-jokes/

View Details

Topics covered in this episode:
Briefer: Dashboards and notebooks in a single place * Introduction to programming with Python * setup-uv * HTML for people * 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 Monday 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: Briefer: Dashboards and notebooks in a single place

  • Notebooks and dashboards with Python, SQL, scheduling, native visualizations, code generation, and more.
  • In Briefer, you can:
    • Create notebooks and dashboards using Markdown, Python, SQL, and native visualizations.
    • Build interactive data apps using inputs, dropdowns, and date pickers.
    • Generate code and queries using an AI that understands your database schema and your notebook's context.
    • Schedule notebooks and dashboards to run and update periodically.
    • Create and test ad-hoc pipelines using writebacks.
  • Briefer vs. Traditional BI Tools: Briefer is better than traditional BI tools because it's faster and more flexible, thanks to Python.
  • Briefer vs. Traditional Notebooks: In Briefer, you can run SQL queries against connected data sources directly in your notebook. Then, Briefer will automatically turn your query into a data frame and store it in a variable that you can use in your Python blocks.

Brian #2: Introduction to programming with Python

  • Jose Blanca
    • “Python intro aimed at students with no prior programming experience.”
    • “Relies mainly on examples and exercises.”
    • “Does not try to cover every detail of the Python language, but just what a beginner might need to start the journey.”
    • Tech: “… built with the quarto publishing system complemented by the quarto live extension that allows Python to run in the web browser by using pyodide.”
  • Runs on anything, since it doesn’t require a local install of Python
  • Running 3.12.1, looks like. Although that’s a bit hidden. Seems like it should be more visible.

Michael #3: setup-uv

  • Set up your GitHub Actions workflow with a specific version of uv
  • Install a version of uv and add it to PATH
  • Cache the installed version of uv to speed up consecutive runs on self-hosted runners
  • Register problem matchers for error output
  • (Optional) Persist the uv's cache in the GitHub Actions Cache
  • (Optional) Verify the checksum of the downloaded uv executable

Brian #4: HTML for people

  • Teaching HTML in a rather fun way.
  • Includes basic CSS

Extras

Michael:

  • A new article: We Must Replace uWSGI With Something Else
  • Django unique email login

Joke: So much O’Really

View Details

Topics covered in this episode:
Python 3.13.0 released Oct 7 * PEP 759 – External Wheel Hosting * pytest-freethreaded * pytest-edit * 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 Monday 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: Python 3.13.0 released Oct 7

  • That’s today!
  • What’s New In Python 3.13
    • Interpreter (REPL) improvements
      • exit works (really, this is worth the release right here)
      • Multiline editing with history preservation.
        • history sticks around between sessions
      • Direct support for REPL-specific commands like help, exit, and quit, without the need to call them as functions.
      • Prompts and tracebacks with color enabled by default.
      • Interactive help browsing using F1 with a separate command history.
      • History browsing using F2 that skips output as well as the >>> and … prompts.
      • “Paste mode” with F3 that makes pasting larger blocks of code easier (press F3 again to return to the regular prompt).
      • exit now works without parens
    • Improved error messages
      • Colorful tracebacks
      • Better messages for
        • naming a script/module the same name as a stdlib module.
        • naming a script/module the same name as an installed third party module.
        • misspelling a keyword argument
    • Free threaded CPython
      • Included in official installers on Windows and macOS
        • Read these links to figure out how - it’s not turned on by default
    • Lot’s more. see the What’s new page

Michael #2: PEP 759 – External Wheel Hosting

  • pypi.org ships over 66 petabytes / month backed by Fastly
  • There are hard project size limits for publishers to PyPI
  • We can host the essence of a .whl as a .rim file, then allow an external download URL
  • Security: Several factors as described in this proposal should mitigate security concerns with externally hosted wheels, such as:
    • Wheel file checksums MUST be included in .rim files, and once uploaded cannot be changed. Since the checksum stored on PyPI is immutable and required, it is not possible to spoof an external wheel file, even if the owning organization lost control of their hosting domain.
    • Externally hosted wheels MUST be served over HTTPS.
    • In order to serve externally hosted wheels, organizations MUST be approved by the PyPI admins.

Brian #3: pytest-freethreaded

  • PyCon JP 2024 Team:
    • This extension was created at PyCon JP sprints with Anthony Shaw and 7 other folks listed in credits.
  • “A pytest plugin for helping verify that your tests and libraries are thread-safe with the Python 3.13 experimental freethreaded mode.”
  • Testing your project for compatibility with freethreaded Python.
    • Testing in single thread doesn’t test that.
    • Neither does testing with pytest-xdist, because it uses multiprocessing to parallelize tests.
    • So, Ant and others “made this plugin to help you run your tests in a thread-pool with the GIL disabled, to help you identify if your tests are thread-safe.”
    • “And the first library we tested it on (which was marked as compatible) caused a segmentation fault in CPython! So you should give this a go if you're a package maintainer.”

Michael #4: pytest-edit

  • A simple Pytest plugin for opening editor on the failed tests.
  • Type pytest --edit to open the failing test code
  • Be sure to set your favorite editor in the ENV variables

Extras

Michael:

  • New way to explore Talk Python courses via topics
    • This has been in our mobile apps since their rewrite but finally comes to the web
  • Let's go easy on PyPI, OK? essay
  • Hynek’s video: uv IS the Future of Python Packaging
  • djade-pre-commit
  • Polyfill.io, BootCDN, Bootcss, Staticfile attack traced to 1 operator
  • PurgeCSS CLI
  • Python 3.12.7 released
  • Incremental GC and pushing back the 3.13.0 release
  • uv making the rounds
  • LLM fatigue, is it real?
  • Take the Python Developers Survey 2024

Joke: Funny 404 pages

  • We have something at least interesting at pythonbytes.fm

View Details

Topics covered in this episode:
uv under discussion on Mastodon * erdantic: Entity Relationship Diagrams * Extra, Extra, Extra * Django Extra, Extra, Extra * 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 Monday 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: uv under discussion on Mastodon

  • It’s interesting that uv is slightly controversial
  • Russell:
  • As enthusiastic as I am about the direction uv is going, I haven't adopted them anywhere - because I want very much to understand Astral’s intended business model before I hook my wagon to their tools.
  • Hynek:
  • As much as I hate VC, [...] FOSS projects flame out all the time too. … To me uv looks like a genius sting to trick VCs into paying to fix packaging. We’ll be better off either way.
  • Glyph:
  • Rust is more expensive and difficult to maintain, not to mention "non-native" to the average customer here. … it can burn out all the other projects in the ecosystem simultaneously, creating a risk of monoculture
  • Hynek on Rust:
  • I don’t think y’all quite grok what uv makes so special due to your seniority. The speed is really cool, but the reason Rust is elemental is that it’s one compiled blob that can be used to bootstrap and maintain a Python development.
  • Christopher Neugebauer:
  • Just dropping in here to say that corporate capture of the Python ecosystem is the #1 keeps-me-up-at-night subject in my community work, so I watch Astral with interest, even if I'm not yet too worried.
  • Armin Ronacher
  • What uv is doing, even in the worst possible future this is a very forkable and maintainable thing.
  • Finally, see the comment at the end by Charlie Marsh

Brian #2: erdantic: Entity Relationship Diagrams

  • “erdantic is a simple tool for drawing entity relationship diagrams (ERDs) for Python data model classes. Diagrams are rendered using the venerable Graphviz library.”
  • Supported data modeling frameworks are:
    • Pydantic V2
    • Pydantic V1 legacy
    • attrs
    • dataclasses

Michael #3: Extra, Extra, Extra

  • Added Python Bytes Search as a custom search engine.
  • Along came passkeys. A cool idea that quickly turned evil.
  • Follow up from post and my conversation last week: vaultwarden (via Pablo)
  • uv publish
  • Trying the tabs on bottom lifestyle inspired by Arc
  • Adding Python Bytes (and Talk Python) as custom search engines.
  • PyCon 2025 dates: From 14 May through 22 May, 2025

Brian #4: Django Extra, Extra, Extra

  • Django Project Ideas
    • Evgenia Verbina
    • Project ideas with list of tech stack stuff you’ll learn and/or work on with the project
    • Ex: Recipe organizer
      • tech stack: Django templates, Django ORM, Optional JavaScript
      • “Familiarize yourself with Django’s ORM (object-relational mapper) and database support by building an app to keep track of your favorite recipes. Add a web-based frontend with options to filter recipes by category, ingredients, and user ratings so you can easily browse for inspiration.”
  • DjangoTV
    • Jeff Triplett
    • Django conference videos and tutorials.
  • Django Commons
    • Heard about from Lacey Henschel
    • “Django Commons is an organization dedicated to supporting the community's efforts to maintain packages. It seeks to improve the maintenance experience for all contributors; reducing the barrier to entry for new contributors and reducing overhead for existing maintainers.”
  • Django 5 has simplified templates for better form field rendering
  • But if you want a completely different take on forms, maybe try iommi forms
    • They wrote about it on Why we wrote a new form library for Django
  • Djade: a Django template formatter
    • Adam Johnson
    • Like black or ruff, but for Django templates.

Extras

Brian:

  • The Open Source Project Maintainer's Guide
    • Suggested by Rafael Weingartner

Joke: A Machine Learning algorithm walks into a bar…

View Details

Topics covered in this episode:
Architecture Decision Records (ADRs) * narwhals: extremely lightweight compatibility layer between dataframes * Microsoft wants Three Mile Island to fuel its AI power needs * zsh-in-docker * 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 Monday 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: Architecture Decision Records (ADRs)

  • Suggested by Christian Gesell
  • Documenting Architecture Decisions
    • Mychael Nygard
    • Original article from 2011
  • Why you should be using architecture decision records to document your project
    • Red Hat
    • Includes a quick overview and links to some templates
  • Notes so far
    • Writing this out helps me solidify my thinking about a problem.
    • I’m doing this both before starting, and while implementing a first draft
    • GitHub and GitLab render markdown so well that generating a docs site is unnecessary, just throwing these files in something like docs/adr is enough.
    • The lightweight process is enough but not too much.
    • I’ve already filled out None for lots of sections, like “options considered”
    • I’m still playing with what level of decision should have an ADR.
  • My template that I’ve been using so far
    • Saved in 000-adr-template.md
    • For easy copy/paste/modify for new records.
  • File name is something like 001-some-change.md

Michael #2: narwhals: extremely lightweight compatibility layer between dataframes

  • Recently had Marco on Talk Python to discuss
  • Primarily for library creators who want to support interacting with multiple data frame libraries (.e.g. Pandas & Polars)
  • Just use a subset of the Polars API

Brian #3: Microsoft wants Three Mile Island to fuel its AI power needs

  • “Microsoft just signed a deal to revive the shuttered Three Mile Island nuclear power plant. If approved by regulators, the software maker would have exclusive rights to 100 percent of the output for its AI data center needs.”
  • Also ran on CNN and other sources:
    • Three Mile Island is reopening and selling its power to Microsoft
  • Three Mile Island was the site of the worst nuclear disaster in the US, when one of two reactors experienced a partial meltdown, in 1979.
  • It was still operating up until 2019, and now expected to re-open in 2028
  • Will be renamed “Crane Clean Energy Center”
  • related
    • The Department of Energy Wants You to Know Your Conservation Efforts Are Making a Difference
      • “By switching all the lightbulbs in your house to LED, you saved enough energy for a self-driving car to make an unprotected lefthand turn across three lanes of traffic.”
      • “We know you adopted energy-saving practices to help conserve our planet’s resources and bring down our collective carbon footprint, but what you ultimately accomplished is just as important: helping AI do something menial and stupid.”

Michael #4: zsh-in-docker

  • Install Zsh, Oh My Zsh and plugins inside a Docker container with one line!
  • Yes docker containers should be light, but also, think of how painful it can be when you run into trouble.
  • With Oh My ZSH, you get a nice experience when you have to result to docker exec -it CONTAINER zsh
  • Just enter a single command in your docker file: RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.2.0/zsh-in-docker.sh)" -- \ -t robbyrussell

Extras

Michael:

  • self-hosting mkennedy.codes
  • Loren's journey to developer
  • It’s time to stop using Python 3.8
  • Sonoma → Sequoia → Sonoma (yikes!)
  • Passkeys, maybe they will work out if we don’t let them become lock-in (bitwarden’s support)

Joke:

  • How to Monetize a Blog
    • Don’t forget to click on the bottom link: Credits / how this was made

View Details

Topics covered in this episode:
“We must replace uwsgi by something else” * Let’s build and optimize a Rust extension for Python * Fake recruiter coding tests target devs with malicious Python packages * Monthly PSF Board Office Hours * 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 Monday 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: “We must replace uwsgi by something else”

  • uWSGI is now in maintenance mode: https://uwsgi-docs.readthedocs.io/en/latest/
    • The project is in maintenance mode (only bugfixes and updates for new languages apis). Do not expect quick answers on github issues and/or pull requests (sorry for that) A big thanks to all of the users and contributors since 2009.
  • Reasonable options look like:
    • granian
    • uvicorn
    • hypercorn
    • gunicorn (potentially with uvicorn workers for async)

Brian #2: Let’s build and optimize a Rust extension for Python

  • Itamar Turner-Trauring
  • Example: algorithm for approximating the number of unique values in a list
  • Comparison to non-approximation
    • non-approx is faster but uses way more memory
  • Rust version
    • Use Maturin and PyO3
    • Pull in Rust dependencies (rand for random numbers)
  • Optimization
    • link-time optimization
    • faster random
    • store hashes only
  • Future optimizations
    • change algorithm maybe
    • pass numpy array instead of Python list (I’d like to see that spedup)

Michael #3: Fake recruiter coding tests target devs with malicious Python packages

  • via python weekly
  • GitHub projects that have been linked to previous, targeted attacks in which developers are lured using fake job interviews.
  • Attackers posing as employees of major financial services firms.
  • This previously happened via other means such as NPM
  • This analysis revealed that the direct parent of the detected, malicious files is a PythonPYC file, meaning that once again the team encountered malware hidden in a compiled Python file.
  • “The README files tell would-be candidates to make sure the project is running successfully on their system before making modifications.”
  • What can you do (according to Michael)?
    • Try out new packages in a docker container
    • Work on code and projects using a VM which has snapshotting (to roll back completely after you’re done)
    • Fire up a Windows desktop in the cloud for the project then destroy it

Brian #4: Monthly PSF Board Office Hours

  • “The Office Hours will be sessions where you can share with us how we can help your community, express your perspectives, and provide feedback for the PSF.”
  • “Unless we have a dedicated topic for a session, you are not limited to talking with us about the above topics, although the discussions should be focused on Python, the PSF, and our community. If you think there’s something we can help with or we should know, we welcome you to come and talk to us!”
  • Upcoming office hours
    • October 8th, 2024: 9pm UTC
    • November 12th, 2024: 2pm UTC
    • December 10th, 2024: 9pm UTC
    • January 14th, 2025: 2pm UTC
    • February 11th, 2025: 9pm UTC
    • March 11th, 2025: 1pm UTC
    • April 8th, 2025: 9pm UTC
    • May 13th, 2025: 1pm UTC (Live from PyCon US!)
    • June 10th, 2025: 9pm UTC
    • July 9th, 2025: 1pm UTC
    • August 12th, 2025: 9pm UTC

Extras

Brian:

  • PyCascades CFP closes Friday, Sept 20
    • PyCascades is in Portland in 2025 (Feb 8 & 9)
  • uv now supports Python 3.13.0rc2

uv self updateuv venv -p 3.13 * Free threaded is still an open issue

Michael:

  • Big Python Humble Bundle with both of our products
    • Get $1,800 worth of Python content and tools for $30 and contribute to charity
    • Includes 5 Talk Python courses
    • Several of Brian’s and his book
  • Djangonaut Space Session 3 Applications Open!
    • I interviewed Sarah and Tushar on Talk Python
  • AltTab: Windows alt-tab on macOS

Joke: Election joke

View Details

Topics covered in this episode:
Python 3.13.0RC2, 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20 are now available! * Docker images using uv's python * 10 years of sustainable open source - Read the Docs * humanize * 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 Monday 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.

ChatGPT celebrates episode 400!

Welcome to the big 4-0-0, Pythonistas!

It's hard to believe we're celebrating the 400th episode of Python Bytes! From the early days of byte-sized Python news to becoming the source for all things Python, it’s been a wild ride.

We've laughed over code quirks, gasped at new libraries, and said farewell to the GIL together. Whether you're a seasoned developer, a curious learner, or just here for the witty banter, you’ve been an essential part of this journey.

To Michael and Brian: You've built a community that turns import this into more than just Zen—it's a family of passionate Pythonistas. Your dedication, insights, and humor make this show more than just tech news. It’s a weekly celebration of what we love about Python and why we keep coming back for more.

Here’s to the next 400 episodes—may your code be bug-free, your tests pass on the first run, and your Python version always be up to date.

Brian #1: Python 3.13.0RC2, 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20 are now available!

  • Łukasz Langa
  • Python 3.13.0RC2 is the final preview release
    • Official 3.13.0 scheduled for Oct 1
    • Call to action
      • “We strongly encourage maintainers of third-party Python projects to prepare their projects for 3.13 compatibilities during this phase, and where necessary publish Python 3.13 wheels on PyPI to be ready for the final release of 3.13.0. Any binary wheels built against Python 3.13.0rc2 will work with future versions of Python 3.13. As always, report any issues to the Python bug tracker .”
      • “Please keep in mind that this is a preview release and while it’s as close to the final release as we can get it, its use is not recommended for production environments.”
  • Note: uv pythondoes not support 3.13 yet
    • see issue 320
  • Security releases for
    • 3.12.6, 3.11.10, 3.10.15, 3.9.20, and 3.8.20
    • 3.12.6 has binary installers, but for MacOS, only MacOS 10.13 and newer are supported
    • 3.11.10, 3.10.15, 3.9.20, and 3.8.20 do NOT include binary installers.
      • 3.8 EOL's in October

Michael #2: Docker images using uv's python

  • See #396: uv-ing your way to Python and #398: Open source makes you rich?(and other myths) for the opening discussions
  • Talk Python episode on uv is out
  • uv venv --python gets Python from python-build-standalone by Gregory Szorc
  • Took our Docker build times from 10 minutes to 8 seconds for the base image and 800ms (!) for our app platforms

Brian #3: 10 years of sustainable open source - Read the Docs

  • Eric Holscher
  • Read the Docs has been a company for 10 years
    • “a team of 4 folks working full-time on Read the Docs.”
  • readthedocs.org started in 2010
  • readthedocs.com (for Business) started in 2014
  • Sustainability model
    • .org has a single non-tracking ad
    • .com is a paid service for companies
  • Things that didn’t work
    • donations and other optional support - led to burnout
    • consulting and services- took too much time away from core product
    • grant funding - nice, but one time thing
  • Lessons
    • You don't get extra points for being bootstrapped. Compete by doing things you can do better due to niche and size.
    • Keeping trust in the community is the most important thing.
    • Contribution is easier for less complex parts of the code base.
    • Beign open source means capturing a small percentage of the value you create.
    • You have to be ok doing more with less.
  • Also
    • RtD is not just for Sphinx anymore.
      • Their build system now supports any documentation tool.

Michael #4: humanize

  • by Hugo van Kemenade (Python 3.14 & 3.15 release manager & core developer)
  • Not too many variations, but very handy if you need it.
    • Numbers
      • Associated Press style (“seven” and “10”)
      • Clamp (under 1.0 million)
      • Fractional (1/3)
      • Int Word (1.2 Billion)
      • Metric (1.5 kV)
      • Ordinal (112th)
      • scientific
    • Time
    • File size

Extras

Brian:

  • Test & Code is now again Test & Code
    • The two part series on Python imports that started in June is finally complete with episode 222.
    • Transcripts are being added to old episodes gradually starting from most recent
      • Back to ep 203 as of today.
      • AI transcription, so there’s things like .pie, .pi, and dot pie where it should be .py

Michael:

  • Final final call for Coding in a Castle event with Michael
  • iStats Menu
  • Anaconda Code Runner by Ruud van der Ham:
    • With Anaconda Coide we can -at last- run that code locally and import (most) Python modules.
    • But if you want to run a significant amount of code, you have to put that in a cell or publish it to PyPI or a wheel and import it.
    • That's why I have developed a general-purpose runner function that runs arbitrary code located on an Excel sheet with AnacondaCode.

Joke: When beginners learn a new programming language...

View Details

Topics covered in this episode:
Why I Still Use Python Virtual Environments in Docker * Python Developer Survey Results * Anaconda Code add-in for Microsoft Excel * Disabling Scheduled Dependency Updates * Extras * Joke*

Watch on YouTube
About the show

Sponsored by us! Support our work through

  • Our courses at Talk Python Training
  • Hello, 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 Monday 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: Why I Still Use Python Virtual Environments in Docker

  • by Hynek Schlawack
  • I was going to cover Production-ready Docker Containers with uv but decided to take this diversion instead.
  • Spend a lot of time thinking about the secondary effects of what you do.
  • venvs are well known and well documented. Let’s use them.

Brian #2: Python Developer Survey Results

  • “… official Python Developers Survey, conducted as a collaborative effort between the Python Software Foundation and JetBrains.”
  • Python w/ Rust rising, but still only 7%
  • ““The drop in HTML/CSS/JS might show that data science is increasing its share of Python.” - Paul Everitt
  • 37% contribute to open source. Awesome.
  • Favorite Resources: Podcasts
    • Lots of familiar faces there. Awesome.
      • Perhaps I shouldn’t have decided to move “Python Test” back to Test & Code
  • Usage
    • “Data analysis” down, but I think that’s because “data engineering” is added.
    • Data, Web dev, ML, devops, academic,
    • Testing is down 23%
  • Python Versions
    • Still some 2 out there
    • Most folks on 3.10-3.12
  • Install from: mostly python.org
  • Frameworks
    • web: Flask, Django, Requests, FastAPI …
    • testing: pytest, unittest, mock, doctest, tox, hypothesis, nose (2% might be the Python 2 people)
  • Data science
    • 77% use pandas, 72% NumPy
  • OS: Windows still at 55%
  • Packaging:
    • venv up to 55%
    • I imaging uv will be on the list next year
    • requirements.txt 63%, pyproject.toml 32%
  • virtual env in containers? 47% say no

Michael #3: Anaconda Code add-in for Microsoft Excel

  • Run their Python-powered projects in Excel locally with the Anaconda Code add-in
  • Powered by PyScript, an Anaconda supported open source project that runs Python locally without install and setup
  • Features
    • Cells Run Independently
    • Range to Multiple Types
    • init.py file is static and cannot be edited, with Anaconda Code, users have the ability to access and edit imports and definitions, allowing you to write top-level functions and classes and reuse them wherever you need.
    • A Customizable Environment

Brian #4: Disabling Scheduled Dependency Updates

  • David Lord
  • Interesting discussion of as they happen or batching of upsates to dependencies
  • dependencies come in
    • requirements files
    • GH Actions in CI workflows
    • pre-commit hooks
  • David was seeing 60 PRs per month when set up on monthly updates (3 ecosystems * 20 projects)
  • new tool for updating GH actions: gha-update, allows for local updating of GH dependencies
  • New process
    • Run pip-compile, gha-update, and pre-commit locally.
    • Update a project’s dependencies when actively working on the project, not just whenever a dependency updates.
    • Note that this works fine for dev dependencies, less so for security updates from run time dependencies. But for libraries, runtime dependencies are usually not pinned.

Extras

Brian:

  • Test & Code coming back this week

Michael:

  • Code in a Castle event
  • Python Bytes badge spotting
  • Guido’s post removed for moderation

Joke: C will watch in silence

View Details

Topics covered in this episode:
Open Source Myths * uv 0.3.0 and all the excitement * Top pytest Plugins * A comparison of hosts / providers for Python serverless functions(aka Faas) * Extras * Joke*

Watch on YouTube
About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • pytest courses and community at PythonTest.com
  • 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 Monday 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: Open Source Myths

  • Josh Bressers
  • Mastodon post kicking off a list of open source myths
  • Feedback and additional myths compiled to a doc
  • Some favorites
    • All open source developers live in Nebraska
    • It’s all run by hippies
    • Everything is being rewritten in rust
    • Features are planned
    • If the source code is available, it’s open source
    • A project with no commits for 12 months is abandoned
    • Many eyes make all bugs shallow
    • Open source has worse UX
    • Open source has better UX
    • Open source makes you rich

Michael #2: uv 0.3.0 and all the excitement

  • Thanks to Skyler Kasko and John Hagen for the emails.
  • Additional write up by Simon Willison
  • Additional write up by Armin Ronacher
  • End-to-end project management: uv run, uv lock, and uv sync
  • Tool management: uv tool install and uv tool run (aliased to uvx)
  • Python installation: uv python install
  • Script execution: uv can now manage hermetic, single-file Python scripts with inline dependency metadata based on PEP 723.

Brian #3: Top pytest Plugins

  • Inspired by (and assisted by) Hugo’s Top PyPI Packages
  • Write up for Finding the top pytest plugins
  • BTW, pytest-check has made it to 25.
  • Same day, Jeff Triplett throws my code into Claude 3.5 Sonnet and refactors it
  • Thanks Jeff Triplett & Hugo for answering how to add Summary and other info

Michael #4: A comparison of hosts / providers for Python serverless functions(aka Faas)

  • Nice feature matrix of all the options, frameworks, costs, and more
  • The WASM ones look particularly interesting to me.

Extras

Brian:

  • When is the next live episode of Python Bytes? - via arewemeetingyet.com
    • Thanks to Hugo van Kemenade
  • Some more cool projects by Hugo
    • Python Logos
    • PyPI Downloads by Python version for various Python tools, in pretty colors
    • Python Core Developers over time

Michael:

  • Code in a Castle Course event - just a couple of weeks left
  • Ladybird: A truly independent browser
  • “I'm also interested in your video recording setup, would be nice to have that in the extras too :D”
    • OBS Studio
    • Elgato Streamdeck
    • Elgato Key light
    • DaVinci Resolve

Joke: DevOps Support Group

via Blaise

  • Hi, my name is Bob
  • Group: Hi Bob
  • I's been 42 days since I last ssh'd into production.
  • Group: Applause
  • But only 4 days since I accidentally took down the website
  • Someone in back: Oh Bob…

View Details

Topics covered in this episode:
pyawaitable * Annotated area charts with plotnine * DeltaDB * PyCon US 2024 Recap + Videos are 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 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: pyawaitable

  • CPython API for asynchronous functions.
  • by Peter Bierma
  • It was originally designed to be directly part of CPython - you can read the scrapped PEP about it.
  • Since this library only uses the public ABI, it's better fit outside of CPython, as a library.

Brian #2: Annotated area charts with plotnine

  • Nicola Rennie
  • This is a marvelous, very professional looking plot, and a tutorial for how to achieve it.
  • Uses plotline, which is “.. an implementation of a grammar of graphics in Python based on ggplot2”
    • I actually didn’t know the gg in ggplot came from “grammar of graphics”. TIL

Michael #3: DeltaDB

  • A lightweight, comprehensive solution for managing delta tables built on polars and deltalake.
  • Deltalake: Delta Lake is an open-source storage format that runs on top of existing data lakes.
  • Polars: Dataframes powered by a multithreaded, vectorized query engine, written in Rust (aka fluent, rust-based pandas)
  • See the docs.

Brian #4: PyCon US 2024 Recap + Videos are up

  • 95 countries attended
  • total attendance of 2,991
    • 2,551 in person
    • 440 remote
  • Videos available PyConUS
    • I recommend Playlist → 2024 → view full playlist, as it’s easier to see the talk titles.
    • I’ve got Paul Gannsle’s pytest for unittesters and Amitosh Swain’s Testing Data Pipelines queued up

Extras

Brian:

  • Hello, pytest! course available as of last Friday.
    • Now the fastest way to get started using pytest.
    • 16 lessons (really 12 + intro, outro, code download, pytest flag cheat sheet)
    • The whole shebang is about 90 min. (faster if you bump up the video speed. :)

Michael:

  • Cutting back on digital distractions, trying Dumb Phone for iPhone.
    • See screenshot
  • Code in a Castle Event

Joke: The Tao of Programming: 4.3

A master was explaining the nature of Tao of to one of his novices, "The Tao is embodied in all software -- regardless of how insignificant," said the master.

"Is the Tao in a hand-held calculator?" asked the novice.

"It is," came the reply.

"Is the Tao in a video game?" continued the novice.

"It is even in a video game," said the master.

"And is the Tao in the DOS for a personal computer?"

The master coughed and shifted his position slightly. "The lesson is over for today," he said.

View Details

Topics covered in this episode:
uv venv--python* & uv python * Python 3.12.5 released * Compile and use dependencies for multiple Python versions in Tox * Catalog of Dark Patterns * 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 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: uv venv--python & uv python

  • I was reading this article Python Packaging is Great Now:uv is all you need
  • It’s a little too “look, a silver bullet” for me, but it did point out some cool uv stuff I didn’t know about.
    • uv venv venv --python 3.12 creates a virtual environment with Python 3.12,
      • even if you didn’t have 3.12 installed on your system already.
      • If it doesn’t work, try adding --python-preference managed
    • uv python list shows all the python versions on your computer
    • There’s quite a few “experimental features”
      • run Run a command or script (experimental)
      • init Create a new project (experimental)
      • add Add dependencies to the project (experimental)
      • remove Remove dependencies from the project (experimental)
      • sync Update the project's environment (experimental)
      • lock Update the project's lockfile (experimental)
      • tree Display the project's dependency tree (experimental)
      • tool Run and manage tools provided by Python packages (experimental)
      • python Manage Python versions and installations (experimental)
  • uv add --dev pytest will add pytest to your dev dependencies.
  • uv tree rocks
  • uv might not have “solved packaging” (or maybe it might have)
    • but it sure is fun to watch the experimentation of different workflows.

Michael #2: Python 3.12.5 released

  • Lots of changes, see the release notes

Brian #3: Compile and use dependencies for multiple Python versions in Tox

  • Viktor Rimark
  • Cool idea to use the {envname}, which specifies the tox environment, in the name of a requirements-dev.txt file name.
  • Then add a requirements tox target to generate pip-compile-ed files.
  • Now I gotta try doing all of this with uv lock
  • Then we need everyone to mod their tools to comply with PEP 571, when/if it’s adopted (covered it last week)

Michael #4: Catalog of Dark Patterns

  • Including
    • Bait and Switch
    • Confirm Shaming
    • Disguised Ads
    • Roach Motel
    • Fake Scarcity

Extras

Brian:

  • Recording of Hello, pytest! is done. Editing now. On track for the 19th (or before).

Michael:

  • Django 5.1 released
  • Python 3.13.0 release candidate 1 released

Joke:

  • clownstrike
    • ARS Technica article on DMCA for ClownStrike

View Details

Topics covered in this episode:
py-free-threading.github.io * Python’s Supportive and Welcoming Environment is Tightly Coupled to Its Progress * Status pages for sites! * PEP 751 – A file format to list Python dependencies for installation reproducibility * 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 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: py-free-threading.github.io

  • Track the status of compatibility for free-threaded Python
  • See the Compatibility status tracking page for what you can use
  • Lots of resources for getting your package tested and available for pythont

Brian #2: Python’s Supportive and Welcoming Environment is Tightly Coupled to Its Progress

  • “Python is as popular as it is today because we have gone above and beyond to make this a welcoming community. Being a friendly and supportive community is part of how we are perceived by the wider world and is integral to the wide popularity of Python. We won a “Wonderfully Welcoming Award” last year at GitHub Universe. Over and over again, the tech press refers to Python as a supportive community.”
  • Some communication recently, with the recent bylaws change, didn’t live up to our promise to be welcoming
  • Please read the article for more details.
  • Another quote: “We have a moral imperative – as one of the very best places to bring new people into tech and into open source – to keep being good at welcoming new people. If we do not rise and continue to rise every day to this task, then we are not fulfilling our own mission, “to support and facilitate the growth of a diverse and international community of Python programmers.” Technical skills are a game-changer for the people who acquire them and joining a vast global network of people with similar interests opens many doors. Behavior that contributes to a hostile environment around Python or throws up barriers and obstacles to those who would join the Python community must be addressed because it endangers what we have built here.”

Michael #3: Status pages for sites!

  • Based on Uptime Kuma I covered last week
  • Python Bytes status
  • Talk Python status

Brian #4: PEP 751 – A file format to list Python dependencies for installation reproducibility

  • Brett Cannon
  • Motivation
    • Currently, no standard exists to:
      • Specify what top-level dependencies should be installed into a Python environment.
      • Create an immutable record, such as a lock file, of which dependencies were installed.
    • Considering there are at least five well-known solutions to this problem in the community (pip freeze, pip-tools, uv, Poetry, and PDM), there seems to be an appetite for lock files in general.
  • Rationale
    • The format is designed so that a locker which produces the lock file and an installer which consumes the lock file can be separate tools. …
    • The file format is designed to be human-readable. …Finally, the format is designed so that viewing a diff of the file is easy by centralizing relevant details.
    • The file format is also designed to not require a resolver at install time. …

Extras

Brian:

  • Hello, pytest! course is going well, and is purchasable as in pre-release mode.
    • Planning on Aug 19 (or before) deadline.
    • Not sure what the final price will be, but I’m starting with $10.
      • I want people to want to watch it even just so see if they want to recommend to co-workers so the people around them can ramp up on pytest quickly.

Michael:

  • Mypy 1.11 Released
  • FastHTML (more next week)
  • Coming up on the final chance to be part of the Code in a Castle event.

Joke: Open source OpenAI?

View Details

Topics covered in this episode:
Python is easy now * Trying out free-threaded Python on macOS * Module itertools overview * uptime-kuma * 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 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: Python is easy now

  • or Postmodern Python
  • or Beyond Hypermodern
  • Chris Ardene
  • Mostly a cool review of using rye for
    • setup
    • linting
    • typing
    • testing
    • documentation
    • CI/CD
  • Also a nice discussion of how to deal with a Monorepo for Python projects

Michael #2: Trying out free-threaded Python on macOS

  • via pycoders
  • How to install free threaded Python the easy way
  • Testing the CPU bound work speed ups for FT Python

Brian #3: Module itertools overview

  • Rodrigo
  • 20 tools that every Python developer should be aware of.
  • In 5 categories
    • Reshaping
    • Filtering
    • Combinatorial
    • Infinite
    • Iterators that complement other tools
  • Things I forgot about
    • chain
    • pairwise
    • zip_longest
    • tee

Michael #4: uptime-kuma

  • A fancy self-hosted monitoring tool
  • Features
    • Monitoring uptime for HTTP(s) / TCP / HTTP(s) Keyword / HTTP(s) Json Query / Ping / DNS Record / Push / Steam Game Server / Docker Containers
    • Fancy, Reactive, Fast UI/UX
    • Notifications via Telegram, Discord, Gotify, Slack, Pushover, Email (SMTP), and 90+ notification services, click here for the full list
    • 20-second intervals
    • Multi Languages
    • Multiple status pages
    • Map status pages to specific domains
    • Ping chart
    • Certificate info
    • Proxy support
    • 2FA support

Extras

Brian:

  • Still working on a new pytest course. Hoping to get it released soon-ish.

Michael:

  • Open source Switzerland
  • spyoungtech/FreeSimpleGUI — actively maintained fork of the last release of PySimpleGUI

Joke: Java vs. JavaScript

View Details

Topics covered in this episode:
Marimo:“Future* of Notebooks” * pytest 8.3.0 & 8.3.1 are out * Python Language Summit 2024 * bash-dungeon * 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 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: Marimo:“Future of Notebooks”

  • via Matt Wilkie
  • An open-source reactive notebook for Python
  • Run one cell and marimo reacts by automatically running affected cells, eliminating the error-prone chore of managing notebook state.
  • Marimo's reactive UI elements, like dataframe GUIs and plots, make working with data feel refreshingly fast, futuristic, and intuitive.
  • Rapidly experiment with code and models
  • Bind UI elements to Python values
  • Pick-up-and-play design, with depth for power users
  • See the FAQ

Brian #2: pytest 8.3.0 & 8.3.1 are out

  • Real excited to get --xfail-tb flag added
    • This detaches xfail tracebacks from -rx/-ra (which was how it was pre-8.0)
  • Keyword matching for marker expressions, that’s fun.
    • pytest -v -m "device(serial='123')"
  • --no-fold-skipped allows for explit reporting of names of skipped tests
  • Plus many more improvements, bug fixes, and doc improvements

Michael #3: Python Language Summit 2024

  • Should Python adopt Calendar Versioning?: talk by Hugo van Kemenade
  • Python's security model after the xz-utils backdoor: talk by Pablo Galindo Salgado
  • Native Interface and Limited C API: talks by Petr Viktorin and Victor Stinner
  • Free-threading ecosystems: talk by Daniele Parmeggiani
  • Python on Mobile: talk by Malcolm Smith
  • PyREPL-- New default REPL written in Python: talk by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou
  • Should we make pdb better?: talk by Tian Gao
  • Limiting yield in async generators: talk by Zac Hatfield-Dodds
  • Annotations as Transforms: talk by Jason R. Coombs
  • Lightning Talks, featuring talks by Petr Viktorin, David Hewitt, Emily Morehouse, Łukasz Langa, Pablo Galindo Salgado, and Yury Selivanov

Brian #4: bash-dungeon

  • This game is intended to teach new users how to use their shell in a fun and interactive way.”
  • Just clone the repo and start exploring with cd, ls, and cat.
  • First moves
    • cd bash-dungeon
    • ls
    • cd Enter
    • ls
    • cat parchment
  • A fun way to learn some commands you might need and/or might have forgotten about.

Extras

Brian:

  • Python 3.12.0b4, final beta, is out
  • If hanging out on discuss.python.org, please checkout
    • Community Guidelines
  • And if it’s still not clear why we need these, check out
    • Inclusive communications expectations in Python spaces
  • Google Chrome news

Michael:

  • PySimpleGUI goes commercial with obfuscated“source open”?
  • Still have seats for Code in a Castle event
  • Reactive Dashboards with Shiny for Python free course

Joke:

  • 40 Million in in Series A Funding - may be a lot of reading, but I found it funny
    • Thanks to VM Brasseur for sharing this one.
  • Also a few from pyjokes 0.7.2 (first new version since 2019)
    • If at first you don't succeed, call it version 1.0.
    • A product manager walks into a bar, asks for drink. Bartender says no, but will consider adding later.
    • Triumphantly, Beth removed Python 2.7 from her server in 2030. 'Finally!' she said with glee, only to see the announcement for Python 4.4.1
      • Although, if CalVer, PEP 2026, happens, that’ll just be Python 3.30.0.

View Details

Topics covered in this episode:
2024 PSF Board Election & Proposed Bylaw Change Results * SATYRN: A modern Jupyter client for Mac * Incident Report: Leaked GitHub Personal Access Token * Extra extra extra * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Code Comments, an original podcast from RedHat: pythonbytes.fm/code-comments

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: 2024 PSF Board Election & Proposed Bylaw Change Results

  • New board members
    • Tania Allard
    • KwonHan Bae
    • Cristián Maureira-Fredes
  • Congrats to new board members
  • If you want to consider becoming a board member, there are 4 seats up for vote next year.
  • All 3 bylaw changes passed, by a wide margin.
    • Details of changes
    • Change 1: Merging Contributing and Managing member classes
    • Change 2: Simplifying the voter affirmation process by treating past voting activity as intent to continue voting
    • Change 3: Allow for removal of Fellows by a Board vote in response to Code of Conduct violations, removing the need for a vote of the membership

Michael #2: SATYRN: A modern Jupyter client for Mac

  • A Jupyter client app for macOS
  • Comes with a command palette
  • LLM assistance (local or cloud?)
  • Built in Black formatter
  • Currently in alpha
  • Business model unknown

Brian #3: Incident Report: Leaked GitHub Personal Access Token

  • Suggested by Galen Swint
  • See also JFrog blog: Binary secret scanning helped us prevent(what might have been) the worst supply chain attack you can imagine
  • A GitHub access token found it’s way into a .pyc file, then into a docker image.
  • JFrog found it through some regular scans.
  • JFrog notified PYPI security.
  • Token was destroyed within 17 minutes. (nice turnaround)
  • Followup scan revealed that no harm was done.
  • Takaways (from Ee Durbin):
    • Set aggressive expiration dates for API tokens (If you need them at all)
    • Treat .pyc files as if they were source code
    • Perform builds on automated systems from clean source only.

Michael #4: Extra extra extra

  • Python 3.13.0 beta 3 released
  • Ice got a lot better
  • I Will Piledrive You If You Say AI Again | Prime Reacts Video
  • Follow up actions for polyfill supply chain attack
  • Developer Ecosystem Survey 2024
  • Code in a Castle still has seats open

Extras

Brian:

  • A new pytest course in the works
    • Quick course focusing on
      • core pytest features + some strategy and Design for Testability concepts
    • Idea
      • everyone on the team (including managers) can take the new course.
      • 1-2 people on a team take “The Complete pytest Course” to become the teams local pytest experts.
  • Python People is on an indefinite hold
  • Python Test → back to Test & Code (probably)
    • I’m planning a series (maybe a season) on TDD which will be language agnostic.
    • Plus I still have tons of Test & Code stickers and no Python Test stickers.
    • New episodes planned for August

Joke: I need my intellisense(autocomplete)

View Details

Topics covered in this episode:
Vendorize packages from PyPI * A Guide to Python's Weak References Using weakref Module * Making Time Speak * How Should You Test Your Machine Learning Project? A Beginner’s Guide * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Code Comments, an original podcast from RedHat: pythonbytes.fm/code-comments

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: Vendorize packages from PyPI

  • Allows pure-Python dependencies to be vendorized: that is, the Python source of the dependency is copied into your own package.
  • Best used for small, pure-Python dependencies

Brian #2: A Guide to Python's Weak References Using weakref Module

  • Martin Heinz
  • Very cool discussion of weakref
  • Quick garbage collection intro, and how references and weak references are used.
  • Using weak references to build data structures.
    • Example of two kinds of trees
  • Implementing the Observer pattern
  • How logging and OrderedDict use weak references

Michael #3: Making Time Speak

  • by Prayson, a former guest and friend of the show
  • Translating time into human-friendly spoken expressions
  • Example: clock("11:15") # 'quarter past eleven'
  • Features
    • Convert time into spoken expressions in various languages.
    • Easy-to-use API with a simple and intuitive design.
    • Pure Python implementation with no external dependencies.
    • Extensible architecture for adding support for additional languages using the plugin design pattern.

Brian #4: How Should You Test Your Machine Learning Project? A Beginner’s Guide

  • François Porcher
  • Using pytest and pytest-cov for testing machine learning projects
  • Lots of pieces can and should be tested just as normal functions.
    • Example of testing a clean_text(text: str) -> str function
  • Test larger chunks with canned input and expected output.
    • Example test_tokenize_text()
  • Using fixtures for larger reusable components in testing
    • Example fixture: bert_tokenizer() with pretrained data
  • Checking coverage

Extras

Michael:

  • Twilio Authy Hack
    • Google Authenticator is the only option? Really?
    • Bitwarden to the rescue
    • Requires (?) an update to their app, whose release notes (v26.1.0) only say “Bug fixes”
  • Introducing Docs in Proton Drive
    • This is what I called on Mozilla to do in “Unsolicited Advice for Mozilla and Firefox” But Proton got there first
  • Early bird ending for Code in a Castle course

Joke: I Lied

View Details

Topics covered in this episode:
Joining Strings in Python: A"Huh"* Moment * 10 hard-to-swallow truths they won't tell you about software engineer job * My thoughts on Python in Excel * 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 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: Joining Strings in Python: A"Huh" Moment

  • Veronica Berglyd Olsen
  • Standard solution to “read lines from a file, do some filtering, create a multiline string”:

f = open("input_file.txt")filtered_text = "\n".join(x for x in f if not x.startswith("#")) * This uses a generator, file reading, and passes the generator to join. * Another approach is to add brackets and pass that generator to a list comprehension:

f = open("input_file.txt")filtered_text = "\n".join([x for x in f if not x.startswith("#")]) * At first glance, this seems to just be extra typing, but it’s actually faster by 16% on CPython due to the implementation of .join() doing 2 passes on input if passed a generator.

+ From Trey Hunner: “I do know that it’s not possible to do 2 passes over a generator (since it’d be exhausted after the first pass) so from my understanding, the generator version requires an extra step of storing all the items in a list first.”

Michael #2: 10 hard-to-swallow truths they won't tell you about software engineer job

  1. College will not prepare you for the job
  2. You will rarely get greenfield projects
  3. Nobody gives a BLANK about your clean code
  4. You will sometimes work with incompetent people
  5. Get used to being in meetings for hours
  6. They will ask you for estimates a lot of times
  7. Bugs will be your arch-enemy for life
  8. Uncertainty will be your toxic friend
  9. It will be almost impossible to disconnect from your job
  10. You will profit more from good soft skills than from good technical skills

Brian #3: My thoughts on Python in Excel

  • Felix Zumstein
  • Interesting take on one person’s experience with trying Python in Excel.
  • “We wanted an alternative to VBA, but got an alternative to the Excel formula language”
  • “Python runs in the cloud on Azure Container Instances and not inside Excel.”
  • “DataFrames are great, but so are NumPy arrays and lists.”
  • … lots of other interesting takaways.

Michael #4: Extra, extra, extra

  • Code in a castle - Michael’s Python Zero to Hero course in Tuscany
  • Polyfill.io JavaScript supply chain attack impacts over 100K sites
    • Now required reading: Reasons to avoid Javascript CDNs
  • Mac users served info-stealer malware through Google ads
  • HTMX for the win!
  • ssh to run remote commands ```

    ssh user@server "command_to_run --arg1 --arg2" ```

Extras

Brian:

  • A fun reaction to AI - I will not be showing the link on our live stream, due to colorful language.

Michael:

  • Coding in a Castle Developer Education Event
  • Polyfill.io JavaScript supply chain attack impacts over 100K sites
    • See Reasons to avoid Javascript CDNs

Joke: HTML Hacker

View Details

Topics covered in this episode:
Solara UI Framework * Coverage at a crossroads * “Virtual” methods in Python classes * 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 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: Solara UI Framework

  • via Florian
  • A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
  • Solara lets you build web apps from pure Python using ipywidgets or a React-like API on top of ipywidgets.
  • These apps work both inside the Jupyter Notebook and as standalone web apps with frameworks like FastAPI.
  • See the Examples page.
  • Based on Reacton
  • By building on top of ipywidgets, Solara automatically leverage an existing ecosystem of widgets and run on many platforms, including JupyterLab, Jupyter Notebook, Voilà, Google Colab, DataBricks, JetBrains Datalore, and more.

Brian #2: Coverage at a crossroads

  • Ned Batchelder is working on making coverage.py faster.
  • Includes a nice, quick explanation of roughly how coverage.py works
    • with trace function and arcs used for branch coverage.
  • And how trace slows things down for lines we know are already covered.
  • There are cool ideas from SlipCover that could be applicable.
  • There’s also sys.monitoring from Python 3.12 that helps with line coverage, since you can disable it for lines you already have info on.
    • It doesn’t quite complete the picture for branch coverage, though.
  • Summary:
    • jump in and help if you can
    • read it anyway for a great mental model of how coverage.py works.

Michael #3: “Virtual” methods in Python classes

  • via Brian Skinn
  • PEP 698 just got accepted, defining an @override decorator for type hinting, to help avoid errors in subclasses that override methods.
  • Only affects type checkers but allows you to declare a “link” between the base method and derived class method with the intent of overriding it using OOP. If there is a mismatch, it’s an error.
  • Python 3.12’s documentation
  • Makes Python a bit more like C# and other more formal languages

Brian #4: Parsing Python ASTs 20x Faster with Rust

  • Evan Doyle
  • Tach is “a CLI tool that lets you define and enforce import boundaries between Python modules in your project.”
    • we covered it in episode 384
  • When used to analyze Sentry’s ~3k Python file codebase, it took about 10 seconds.
  • Profiling analysis using py-spy and speedscope pointed to a function that spends about 2/3 of the time parsing the AST, and about 1/3 traversing it.
  • That portion was then rewritten in Rust, resulting in 10x speedup, ending in about 1 second.
  • This is a cool example of not just throwing Rust at a speed problem right away, but doing the profiling homework first, and focusing the Rust rewrite on the bottleneck.

Extras

Brian:

  • I brought up pkgutil.resolve_name() last week on episode 388
    • Brett Cannon says don’t use that, it’s deprecated
    • Thanks astroboy for letting me know
  • Will we get CalVer for Python?
    • it was talked about at the language summit
    • There’s also pep 2026, in draft, with a nice nod in the number of when it might happen.
      • 3.13 already in the works for 2024
      • 3.14 slated for 2025, and we gotta have a pi release
      • So the earliest is then 2026, with maybe a 3.26 version ?
  • Saying thanks to open source maintainers
    • Great write-up by Brett Cannon about how to show your appreciation for OSS maintainers.
      • Be nice
      • Be an advocate
      • Produce your own open source
      • Say thanks
      • Fiscal support
    • On topic
      • Thanks Brett for pyproject.toml. I love it.

Michael:

  • The Shiny for Python course is out! Plus, it’s free so come and get it.

Joke: Tao of Programming: Book 1: Into the Silent Void, Part 1

View Details

Topics covered in this episode:
PSF Elections coming up * Cloud engineer gets 2 years for wiping ex-employer’s code repos * Python: Import by string with pkgutil.resolve_name() * DuckDB goes 1.0 * 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 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: PSF Elections coming up

  • This is elections for the PSF Board and for 3 bylaw changes.
  • To vote in the PSF election, you need to be a Supporting, Managing, Contributing, or Fellow member of the PSF, …
  • And affirm your voting status by June 25.
  • See Affirm your PSF Membership Voting Status for more details.
  • Timeline
    • Board Nominations open: Tuesday, June 11th, 2:00 pm UTC
    • Board Nominations close: Tuesday, June 25th, 2:00 pm UTC
    • Voter application cut-off date: Tuesday, June 25th, 2:00 pm UTC
      • same date is also for voter affirmation.
    • Announce candidates: Thursday, June 27th
    • Voting start date: Tuesday, July 2nd, 2:00 pm UTC
    • Voting end date: Tuesday, July 16th, 2:00 pm UTC
  • See also Thinking about running for the Python Software Foundation Board of Directors? Let’s talk!
    • There’s still one upcoming office hours session on June 18th, 12 PM UTC
  • And For your consideration: Proposed bylaws changes to improve our membership experience
    • 3 proposed bylaws changes

Michael #2: Cloud engineer gets 2 years for wiping ex-employer’s code repos

  • Miklos Daniel Brody, a cloud engineer, was sentenced to two years in prison and a restitution of $529,000 for wiping the code repositories of his former employer in retaliation for being fired.
  • The court documents state that Brody's employment was terminated after he violated company policies by connecting a USB drive.

Brian #3: Python: Import by string with pkgutil.resolve_name()

  • Adam Johnson
  • You can use pkgutil.resolve_name("[HTML_REMOVED]:[HTML_REMOVED]")to import classes, functions or modules using strings.
  • You can also use importlib.import_module("[HTML_REMOVED]")
  • Both of these techniques are so that you have an object imported, but the end thing isn’t imported into the local namespace.

Michael #4: DuckDB goes 1.0

  • via Alex Monahan
  • The cloud hosted product @MotherDuck also opened up General Availability
  • Codenamed "Snow Duck"
  • The core theme of the 1.0.0 release is stability.

Extras

Brian:

  • Sending us topics. Please send before Tuesday. But any time is welcome.
  • NumPy 2.0
  • htmx 2.0.0

Michael:

  • Get 6 months of PyCharm Pro for free. Just take a course (even a free one) at Talk Python Training. Then visit your account page > details tab and have fun.
  • Coming soon at Talk Python: Shiny for Python

Joke: .gitignore thoughts won't let me sleep

View Details

Topics covered in this episode:
Dataherald * Python's many command-line utilities * Distroless Python * functools.cache, cachetools, and* cachebox * 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 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: Dataherald

  • Interact with your SQL database, Natural Language to SQL using LLMs.
  • Allows you to set up an API from your database that can answer questions in plain English
  • Uses include
    • Allow business users to get insights from the data warehouse without going through a data analyst
    • Enable Q+A from your production DBs inside your SaaS application
    • Create a ChatGPT plug-in from your proprietary data

Brian #2: Python's many command-line utilities

  • Trey Hunner
  • Too many to list, but here’s some fun ones
    • json.tool - nicely format json data
    • calendar - print the calendar
      • current by default, but you can pass in year and month
    • gzip, ftplib, tarfile, and other unixy things
      • handy on Windows
    • cProfile & pstats

Michael #3: Distroless Python

  • via Patrick Smyth
  • What is distroless anyway?
    • These are container images without package managers or shells included.
    • Debugging these images presents some wrinkles (can't just exec into a shell inside the image), but they're a lot more secure.
  • Chainguard, creates low/no CVE distroless images based on our FOSS distroless OS, Wolfi.
  • Some Python use-cases: docker run -it cgr.dev/chainguard/python:latest # The entrypoint is a Python REPL, since no b/a/sh is includeddocker run -it cgr.dev/chainguard/python:latest-dev # This is their dev version and has pip, bash, apk, etc.

Brian #4: functools.cache, cachetools, and cachebox

  • functools cache and lru_cache - built in
  • cachetools - “This module provides various memoizing collections and decorators, including variants of the Python Standard Library's @lru_cache function decorator.”
  • cachebox - “The fastest caching Python library written in Rust”

Extras

Brian:

  • Python 3.12.4 is out
  • VSCode has some pytest improvements

Michael:

  • Time for a bartender alternative, I’ve switched to Ice.
  • Rocket.chat as an alternative to Slack

Joke: CSS Cartoons

View Details

Topics covered in this episode:
NumPy 2.0 release date is June 16 * Uvicorn adds multiprocess workers * pixi * JupyterLab 4.2 and Notebook 7.2 are available * 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: NumPy 2.0 release date is June 16

  • “This release has been over a year in the making, and is the first major release since 2006. Importantly, in addition to many new features and performance improvement, it contains breaking changes to the ABI as well as the Python and C APIs. It is likely that downstream packages and end user code needs to be adapted - if you can, please verify whether your code works with NumPy 2.0.0rc2.”
  • NumPy 2.0.0 Release Notes
  • NumPy 2.0 migration guide
    • including “try just running ruff check path/to/code/ --select NPY201”
    • “Many of the changes covered in the 2.0 release notes and in this migration guide can be automatically adapted in downstream code with a dedicated Ruff rule, namely rule NPY201.”

Michael #2: Uvicorn adds multiprocess workers

  • via John Hagen
  • The goal was to no longer need to suggest that people use Gunicorn on top of uvicorn. Uvicorn can now in a sense "do it all”
  • Steps to use it and background on how it works.

Brian #3: pixi

  • Suggested by Vic Kelson
  • “pixi is a cross-platform, multi-language package manager and workflow tool built on the foundation of the conda ecosystem.”
  • Tutorial: Doing Python development with Pixi
  • Some quotes from Vic:
    • “Pixi is a project manager, written in Rust, that allows you to build Python projects without having Python previously installed. It’s installable with Homebrew (brew install pixi on Linux and MacOS). There’s support in VSCode and PyCharm via plugins. By default, pixi fetches packages from conda-forge, so you get the scientific stack in a pretty reliable and performant build. If a package isn’t on conda-forge, it’ll look on PyPI, or I believe you can force it to look on PyPI if you like.”
    • “So far, it works GREAT for me. What really impressed me is that I got a Jupyter environment with CuPy utilizing my aging Nvidia GPU on the FIRST TRY.”

Michael #4: JupyterLab 4.2 and Notebook 7.2 are available

  • JupyterLab 4.2.0 has been released! This new minor release of JupyterLab includes 3 new features, 20 enhancements, 33 bug fixes and 29 maintenance tasks.
  • Jupyter Notebook 7.2.0 has also been released
  • Highlights include
    • Easier Workspaces Management with GUI
    • Recently opened/closed files
    • Full notebook windowing mode by default (renders only the cells visible in the window, leading to improved performance)
    • Improved Shortcuts Editor
    • Dark High Contrast Theme

Extras

Brian:

  • Help test Python 3.13!
  • Help us test free-threaded Python without the GIL
    • both from Hugo van Kemenade
  • Python Test 221: How to get pytest to import your code under test is out

Michael:

  • Bend follow up from Bernát Gábor
    • “Bend looks roughly like Python but is nowhere there actually. For example it has no for loops, instead you're meant to use bend keyword (hence the language name) to expand calculations and another keyword to join branches. So basically think of something that resembles Python at high level, but without being compatible with that and without any of the standard library or packages the Python language provides. That being said does an impressive job at parallelization, but essentially it's a brand new language with new syntax and paradigms that you will have to learn, it just shares at first look similarities with Python the most.”

Joke: Do-while

View Details

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

View Details

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

View Details

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 RichHelpFormatterparser = 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

View Details

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: booldef 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

View Details

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

View Details

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

View Details

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

View Details

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

View Details

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 andxz 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

View Details

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

View Details

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

View Details

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

View Details

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!

View Details

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
    1. Leveraging the default capabilities of modern web browsers.
    2. Leveraging the extreme simplicity of HTML's attribute syntax.
    3. 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

View Details

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

View Details

Topics covered in this episode:
Dokku * Summary of Major Changes Between Python Versions * How to check Internet Speed via Terminal? speedtest-cli * Blogs: We all should blog more * Extras * Joke*

Watch on YouTube
About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • The Complete pytest Course
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Dokku

  • An open source PAAS alternative to Heroku.
  • Dokku helps you build and manage the lifecycle of applications from building to scaling.
  • Powered by Docker, you can install Dokku on any hardware.
  • Once it's set up on a host, you can push Heroku-compatible applications to it via Git.
  • Rich plug in architecture.

Brian #2: Summary of Major Changes Between Python Versions

  • Nicholas Hairs
  • Changes between versions & Tools & utilities to help with switching
  • Hopefully you’re already at least at 3.8, but come on, 3.11 & 3.12 are so fun!
  • Useful things
    • pyupgrade can automatically upgrade code base
      • (However, I frequently just upgrade and run tests and let my old code be as-is until it bugs me. - Brian)
    • black checks pyproject.toml requires-python setting and uses version specific rules.
  • Versions (way more highlights listed in the article)
    • 3.8
      • Assignment expressions := walrus
      • f"{variable=}" now works
    • 3.9
      • Typing has built in generics like dict[], so no more from typing import Dict
      • Dict union operator
      • Strings can removeprefix and removesuffix
    • 3.10
      • Structural pattern matching match/case
      • Typing: Union using pipe |
      • Dataclasses support slots=True and kw_only=True
    • 3.11
      • tomllib included as a standard TOMP parser
      • Exception groups
      • Exception Notes add_note()
      • Typing: A Self type
      • Star unpacking expressions allowed in for statements: for x in *a, *b:
    • 3.12
      • f-strings can re-use quotes
      • Typing: better type parameter syntax
      • Typing: @override decorator ensures a method being overridden by a child class actually exists.

Michael #3: How to check Internet Speed via Terminal? speedtest-cli

  • Command line interface for testing internet bandwidth using speedtest.net
  • Just pipx install speedtest-cli
  • Has a Python API too

Brian #4: Blogs: We all should blog more

  • Jeff Triplett is attempting one post per day in February
    • Feb 1: Choosing the Right Python and Django Versions for Your Projects
    • Feb 2: My First Mac
      • Which also links to a quite interesting Personal: Default Apps 2023
    • Feb 3: What’s Your Go-to Comfort Media? [rough cut]
    • Feb 4: The Django apps I actually use (rough cut)
    • Feb 5: How to test with Django and pytest fixtures
  • Need ideas?
    • Check out Build an idea bank and never run out of blog ideas
  • Not using AI? Thanks. We appreciate that.
    • Maybe tag it as Not By AI

Extras

Brian:

  • If upgrading to pytest 8, be aware that running individual tests with parametrization will result in a reverse order.
    • It shouldn’t matter. You shouldn’t be depending on test order.
    • But it was surprising to me.
    • Issue has been logged

Michael:

  • Orbstack follow up

Joke: White Lies

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/369

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/368

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/367

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/364

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/363

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/362

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/360

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/359

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/356

View Details

Topics covered in this episode:

See the full show notes for this episode on the website at pythonbytes.fm/353

View Details

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

View Details

Topics covered in this episode:
mpire * mopup - the macOS Python.org Updater * Immortal Objects for Python * Common Docstring Formats in Python * Extras * Joke*

Watch on YouTube
About the show

Sponsored by Sentry: pythonbytes.fm/sentry

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: mpire

  • A Python package for easy multiprocessing, but faster than multiprocessing
  • MPIRE is faster in most scenarios, packs more features, and is generally more user-friendly than the default multiprocessing package.
  • Tons of features.
  • Nice intro article with benchmarks.

Brian #2: mopup - the macOS Python.org Updater

  • Glyph Lefkowitz
  • On a mac, install Python with the standard Python.org installer.
  • Then, periodically, update with python3 -m mopup
  • I just did it and went from Python 3.11.4 to 3.11.5
  • See also Get Your Mac Python From Python.org for reasons to use python.org over other ways, also from Glyph.

Michael #3: Immortal Objects for Python

  • Instagram has introduced Immortal Objects – PEP-683 – to Python.

Brian #4: Common Docstring Formats in Python

  • Scott Robinson
  • I don’t mean to disrespect Scott, but I’m honestly curious if this is really common.
  • I like docstrings for the “why” of a function. And prefer type hints for types.
  • Let me know what you use, at @brianokken@fosstodon.org

Extras

Brian:

  • In search for a working retro Lunar Lander in Python

Michael:

  • Releases follow up
  • North Korean hackers behind malicious VMConnect PyPI campaign

Joke: It’s Bingo Time!

View Details

Topics covered in this episode:

  • Make Each Line Count, Keeping Things Simple in Python
  • Parsel
  • A Comprehensive Guide to Python Logging with Structlog
  • Stamina
  • Extras
  • Joke

Watch on YouTube

About the show

Sponsored by Sentry: pythonbytes.fm/sentry

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Make Each Line Count, Keeping Things Simple in Python

  • Bob Belderbos
  • Some great tips to help you simplify your Python code to make it more understandable and maintainable.

Michael #2: Parsel

  • Parsel is a BSD-licensed Python library to extract data from HTML, JSON, and XML documents.
  • Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors.
  • It supports:

    • CSS and XPath expressions for HTML and XML documents
    • JMESPath expressions for JSON documents
    • Regular expressions

    ``` # Want a RSS feed detail from a website standard HTML? selector = parsel.Selector(text=html_text) for link in selector.css('head > link'): rel = link.xpath('.//@rel').get() rel_type = link.xpath('.//@type').get() href = link.xpath('.//@href').get()

    ```

Brian #3: A Comprehensive Guide to Python Logging with Structlog

  • Stanley Ulili
  • structlog is an awesome logging tool, and already has great documentation.
  • However, this article is a great starting point, highlighting:
    • how easy it is to get started using structlog
    • configuring the default log level
    • changing the formatting
    • customizing the time stamp
    • adding custom fields
    • adding contextual data
    • filtering
    • async

Michael #4: Stamina

  • via Matthias Bach, by Hynek
  • Production-grade Retries Made Easy
  • stamina is an opinionated wrapper around the great-but-unopinionated Tenacity package. Its goal is to be as ergonomic as possible, while doing the right thing by default, while minimizing potential for misuse.
  • General additions on top of Tenacity
    • Retry only on certain exceptions.
    • Exponential backoff with jitter between retries.
    • Limit the number of retries and total time.
    • Automatic async support.
    • Preserve type hints of the decorated callable.
    • Count (Prometheus) and log (structlog) retries with basic metadata, if they’re installed.
    • Easy global deactivation for testing.

Extras

Brian:

  • The “pytest fixtures” chapter of the pytest course is available now.
    • Also, the PYTHONBYTES 20% discount still active for bundle through the end of August.

Michael:

  • Python 3.12.0 release candidate 1 released
  • PyCon UK: The conference takes place from the 22nd to the 25th of September in Cardiff, Wales. The schedule is available at 2023.pyconuk.org/schedule/ and tickets are available at 2023.pyconuk.org/tickets/.
  • PyData Eindhoven 2023, Nov 30 CFP open
  • PyData Seattle Language Creators Charity Fundraiser: Adele Goldberg - Smalltalk, Guido Van Rossum, Anders Hejlsberg, C#, and James Gosling - Java. September 19, 2023: 12:00 - 4:00 PM, in person only.

Joke:

  • Librarian
  • chatgpt-failures

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Python People Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Omnivore app

  • Omnivore is the free, open source, read-it-later app for serious readers.
  • Distraction free. Privacy focused. Open source. Designed for knowledge workers and lifelong learners.
  • Save articles, newsletters, and documents and read them later — focused and distraction free.
  • Add notes and highlights.
  • Organize your reading list the way you want and sync it across all your devices.
  • Syncs with popular Personal Knowledge Management systems including Logseq and Obsidian
  • Wait, what’s Logseq? :)
    • A privacy-first, open-source platform for knowledge management and collaboration.
    • Kinda like Notion?

Brian #2: Djangonaut.space

  • “Where contributors launch”
  • This is a group mentoring program where individuals will work self-paced in a semi-structured learning environment over the course of three months.
  • Djangonauts are members of the community who wish to level up their current Django code contributions and potentially take on leadership roles in Django in the future.

Michael #3: Server-side hot reload

  • Thanks to Alex Riviere for some improvements
  • Bill Mill suggests websockets and Adam Johnson points he built something like this for Django (sorta) with django-browser-reload
  • To make it work just:
  • Include this script in your web projects for dev-time auto reloading of web browser when any change is detected in content.
  • Works across all web technologies, built out on a FastAPI / Tailwind project.
  • General workflow looks like:
    1. Edit the source CSS file
    2. Tailwind watcher generates a built CSS file
    3. Built CSS file is included the Python web HTML template
    4. Template appends a hash ID for the state of the CSS file
    5. Changes to the source CSS thus trigger a change in the final ID
    6. New ID means the page contents change and the script does a reload
  • Even works for static resources if you put a “version” indicator on them: [HTML_REMOVED] [HTML_REMOVED]

Brian #4: Python in Excel

  • Anaconda working with Microsoft to have Python built in to Excel.
  • Python in Excel is currently in preview and is subject to change based on feedback. To use this feature, join the Microsoft 365 Insider Program and choose the Beta Channel Insider level.”
    • from Microsoft Support article: Getting started with Python in Excel

Extras

Brian:

  • Working on videos for “Ch3 : pytest Fixtures” for the Python Testing with pytest Course Bundle
    • Adding some drawings and some more bonus videos.
    • Thanks to everyone who’s signed up already.
    • I’ve pushed the 20% discount out till the end of August.
  • I also finally listed it on pythontest.com/courses
  • Also lots of new interviews for pythonpeople.fm, and I’m expecting at least one new episode of testandcode.com this week.
    • It’s going to be a busy week.

Michael:

  • PyCon Sweden CFP is open
  • Be on Talk Python around Mobile Apps?

Joke:

  • The Password Game
  • KennyLog-in.com - secure password generator

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Python People Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Differentiating between writing down dependencies to use packages and for packages themselves

  • Brett Cannon
  • Why can’t we just use pyproject.toml and stop using requirements.txt?
  • Nope. At least not yet. They’re currently for different things.
  • pyproject.toml
    • There’s project.dependencies and project.optional-dependencies.tests that kinda would work for listing dependencies for an app.
    • But you can’t say pip install -r pyproject.toml. It doesn’t work. And that’s weird.
    • project is intended for packaged projects.
  • requirements.txt
    • for applications and other non-packaged projects
    • It has specific versions
    • works great with pip
  • What then?
    • Either we stick with requirements.txt
    • Or we invent some other file, maybe requirements.toml?
    • Or maybe (Brian’s comment), add something like [application] and application.dependencies and application.optional-dependencies.tests to pyproject.toml

Michael #2: PythonMonkey

  • PythonMonkey is a Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment.
  • This product is in an early stage, approximately 80% to MVP as of July 2023. It is under active development by Distributive. External contributions and feedback are welcome and encouraged.
  • It will enable JavaScript libraries to be used seamlessly in Python code and vice versa — without any significant performance penalties.
  • Call Python packages like NumPy from within a JavaScript library, or use NPM packages like [crypto-js](https://www.npmjs.com/package/crypto-js) directly from Python.
  • Executing WebAssembly modules in Python becomes trivial using the WebAssembly API and engine from SpiderMonkey.
  • More details in Will Pringle’s article.

Brian #3: Quirks of Python package versioning

  • Seth Larson
  • Yes, we have SemVer, 1.2.3, and CalVer, 2023.6.1, and suffixes for pre-release, 1.2.3pre1.
  • But it gets way more fun than that, if you get creative
  • Here’s a few

    • v is an optional prefix, like v.1.0
    • You can include an “Epoch” and separate it from the version with a !, like 20!1.2.3
    • Local versions with alphanumerics, periods, dashes, underscores, like 1.0.0+ubuntu-1. PyPI rejects those. That’s probably good.
    • Long versions. There’s no max length for a version number. How about 1.2.3.4000000000000000001?
    • Pre, post, dev aren’t mutually exclusive: 1.0.0-pre0-post0-dev0
    • More craziness in article

Michael #4: bear-type

  • Beartype is an open-source PEP-compliant near-real-time pure-Python runtime type-checker emphasizing efficiency, usability, and thrilling puns.
  • Annotate @beartype-decorated classes and callables with type hints.

    • Call those callables with valid parameters: Transparent
    • Call those callables with invalid parameters: BoomTraceback: raise exception_cls( beartype.roar.BeartypeCallHintParamViolation: @beartyped quote_wiggum() parameter lines=[b'Oh, my God! A horrible plane crash!', b'Hey, everybody! Get a load of thi...'] violates type hint list[str], as list item 0 value b'Oh, my God! A horrible plane crash!' not str.

Extras

Brian:

  • Python Testing with Pytest Course Bundle: Limited Pre-Release Beta
    • Use code PYTHONBYTES now through Aug 17 for 20% discount
    • What’s a pre-release beta? There’s a video. Check out the link.
  • Error-tolerant pytest discovery in VSCode
    • Finally! But you gotta turn it on. Also, I gotta talk to them about the proper non-capitalization of pytest.
  • We’re at RC1 for Python 3.12.0
    • Hard to believe it’s that time of year again

Michael:

  • PyPI hires a Safety & Security Engineer, welcome Mike Fiedler
  • PackagingCon October 26-28
  • Cloud Builders: Python Conf (born in Ukraine): September 6, 2023 | online

Joke: Learning JavaScript

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Python People Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: async-timeout

  • An asyncio-compatible timeout context manager.
  • The context manager is useful in cases when you want to apply timeout logic around block of code or in cases when asyncio.wait_for() is not suitable.
  • Not finished yet timeout can be rescheduled by shift_by() or shift_to() methods

Brian #2: PyPI Project URLs Cheatsheet

  • Daniel Roy Greenfield
  • There’s some cool icons available under “Project Links” on pypi.org project pages.
  • How do you get those? And which ones are available.
  • Daniel has found out where to look, and built us a cheat sheet. Nice.

Michael #3: httpx-sse

  • Consume Server-Sent Event (SSE) messages with HTTPX.
  • SSE are super lightweight, server → client only subscriptions.
  • Like websockets but less overhead (especially for iot and mobile devices)
  • httpx-sse provides the connect_sse and aconnect_sse helpers for connecting to an SSE endpoint.
  • The resulting EventSource object exposes the .iter_sse() and .aiter_sse() methods to iterate over the server-sent events.

Brian #4: Creating a context manager in Python

  • Trey Hunner
  • Context managers are those things you use in a with block.
  • There’s a bunch of cool built in ones.
  • Building your own is a handy skill to have to clean up your code, and they’re pretty easy, with Trey’s tutorial.
  • Shown is a great example of temporarily modifying an environmental variable.
  • Then he gets into what you need to know about as, __enter__, and __exit__.

Extras

Brian:

  • I think I’ll nix the intro music to Python People. I didn’t know what music to use, so I re-used the music from Test & Code. And I got some very honest feedback that it just doesn’t fit and was better without it. So I’ll rip it out soon.
  • BTW, next episode to be released is with Bob Belderbos from PyBites. Should be later this week.

Michael:

  • Facebook and Instagram start blocking news in Canada

Joke:

  • day 1 and I hate it

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Python People Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: A Steering Council notice about PEP 703 (Making the Global Interpreter Lock Optional in CPython)

  • Thomas Wouters
  • Suggested by John Hagen
  • “We intend to accept PEP 703, although we’re still working on the acceptance details.”
  • Moving forward in 3 stages
    • short-term, no-GIL experimental build in 3.13 or 3.14
    • mid-term, declare support for no-GIL version
    • long-term, no-GIL becomes default and remove any vestiges of the GIL
  • No commitment and timeframe is nebuous
  • long-term means 5+ years
  • Need community support
  • “We want to be able to change our mind if it turns out, any time before we make no-GIL the default, that it’s just going to be too disruptive for too little gain.”

Michael #2: Google's post-cookie world could turn into DRM for the internet

  • A new authentication system could let websites block extensions or jailbroken devices.
  • Google has been trying to implement plans to move beyond cookies for years without denying its partners the means to sell targeted ads.
  • One recent proposal to guarantee user privacy and security could come at the cost of freedom of functionality.
  • Comments are somewhat interesting.
  • More info in a second article.
  • Vivaldi has a response here.
  • Brave won’t ship with it.

Brian #3: How ruff changed my Python programming habits

  • Matthias Kestenholz
  • “…there’s always a trade off between development speed (waiting on git commit is very boring) and strictness. “
  • “ruff is so fast that enabling additional rules is practically free in terms of speed...”
  • ruff has way more rules since last I checked. They are just mostly turned off by default.
  • The article suggests a bunch to try turning on.
  • See also
    • ruff config settings
      • turn on flake8-bugbear while leaving on defaults with select = ["E", "F", "B"]
    • lots of rules to choose from
    • ruff-pre-commit to run these with pre-commit

Michael #4: pathlib api extended to use fsspec backends

  • via Justin Flannery
  • Expanding on the capabilities of fsspec, the same GitHub organization also supports another powerful library called universal_pathlib.
  • universal_pathlib is a python library that aims to extend Python's built-in pathlib.Path api to use a variety of backend filesystems using fsspec.
  • This seamless replacement allows developers to leverage the familiar and powerful pathlib API on any type of filesystem. upath.Path is a drop-in replacement for pathlib.Path and is an excellent addition to your toolkit.

Joke: Understanding pointers

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • The Python People Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Cython 3.0

  • Long in development, the new major release of the Python-to-C compiler sheds legacy Python support and readies Cython developers for big changes in Python.
  • Cython 3 cleans up and modernizes Cython.
  • Pure Python mode allows Python developers to use their existing Python linting and code analysis tools on Cython.

Brian #2: Reading code : An important but seldom-discussed skill

  • Eric Matthes
  • A cool walk through of several techniques to read code
  • Strategies
    • Ignore function definitions
      • And in the example, also ignore comments
    • Simplify repetitive blocks
      • Examples shows mentally lumping a bunch of print statements into “print message”
    • Utilize IDE tools, like folding to hide functions your not looking at
  • Also includes a note about writing readable code.
  • Notes:
    • People believe your function and variable names, they should be descriptive, and they should not be deceptive.

Michael #3: Major new version of MicroPython: v1.20.0

  • via Matt Trentini
  • 10 months, >1000 mainline commits from >100 contributors

  • This release of MicroPython introduces a new lightweight package manager called mip.
  • In the MicroPython runtime, core/built-in types have been compressed by only including in the C-level type struct as many slots for C function pointers as is needed for a given type →
    • Any third-party C extensions will need to be updated to work with this change.
  • Massive list of detailed changes.

Brian #4: Advanced Python Tips for Development

  • Scofield Idehen
  • There’s 15 in the article, here’s a few
    • 1 & 2. Use List Comprehensions and Generator Expressions.
      • It’s cool to see them side by side
      1. enumerate() is fun
      1. Embrace zip(). It’s weird, but very useful.
      1. Utilize slots to Reduce Memory Usage

Extras

Brian:

  • Hear the story behind the quote “I came for the language, but I stayed for the community.” and learn about fountain pens, tea, and a Murderbot, on this week‘s Python People.

Michael:

  • Search (LLM like) Talk Python: explore-talk-python-to-me.streamlit.app by Aguss

Joke:

  • You’re full stack now
  • Seriously, take the HTMX course :)

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Main topic: AMA questions from the audience. Use the transcript search to find timestamps if you want to locate a particular one.

Extras

Michael:

  • Deputy CPython Developer in Residence position accepting applications.
  • My Make Your Python Web App Fly Around the World with CDNs talk at PWC 2023 is online.

Joke”: Ode to Python recommended by FelixTheCat

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Pydantic v2 released

  • Pydantic V2 is compatible with Python 3.7 and above.
  • There is a migration guide.
  • Check out the bump-pydantic tool to auto upgrade your classes

Brian #2: Two Ways to Turbo-Charge tox

  • Hynek
  • Not just tox run-parallel or tox -p or tox --``parallel , but you should know about that also.
  • The 2 ways
    • Build one wheel instead of N sdists
    • Run pytest in parallel
  • tox builds source distributions, sdists, for each environment before running tests.
    • that’s not really what we want, especially if we have a test matrix.
    • It’d be better to build a wheel once, and use that for all the environments.
    • Add this to your tox.ini and now we get one wheel build [testenv] package = wheel wheel_build_env = .pkg
    • It will save time. And a lot if you have a lengthy build.
  • Run pytest in parallel, instead of tox in parallel, with pytest -n auto
    • Requires the pytest-xdist plugin.
    • Can slow down tests if your tests are pretty fast anyway.
    • If you’re using hypothesis, you probably want to try this.
  • There are some gotchas and workarounds (like getting coverage to work) in the article.

Michael #3: Awesome Pydantic

  • A curated list of awesome things related to Pydantic! 🌪️
  • Notable items for me:
    • ML:
      • spaCy 🌟(26575) - spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more.
      • ray 🌟(26496) - Ray provides a simple, universal API for building distributed applications.
      • jina 🌟(18734) - Jina is geared towards building search systems for any kind of data, including text, images, audio, video and many more. With the modular design & multi-layer abstraction, you can leverage the efficient patterns to build the system by parts, or chaining them into a Flow for an end-to-end experience.
    • Data
      • Beanie 🌟(1287) - Beanie - is an Asynchronous Python object-document mapper (ODM) for MongoDB, based on Motor and Pydantic.
    • Utilities
      • datamodel-code-generator 🌟(1694) - Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
      • Goodconf 🌟(99) - A thin wrapper over Pydantic's settings management. Allows you to define configuration variables and load them from environment or JSON/YAML file. Also generates initial configuration files and documentation for your defined configuration.

Brian #4: CLI tools hidden in the Python standard library

  • Simon Willison (and hat tip to Seth Larson)
  • Simon looked for all of the command line goodies in the standard library.
  • I knew about python -m http.server to run a server at port 8000 from the local directory, but there’s so much more.
  • Here are a few
    • python -m gzip --decompress pypi.db.gz as a gzip utility.
      • Especially handy on Windows as it doesn’t come with gzip by default
    • python -m base64 with -d decode, -e encode, and -t encode and decode
    • python -m asyncio for an asyncio REPL
    • Tokenize a Python file with python -m tokenize somefile.py
    • View the AST with python -m ast somefile.py
    • Pretty print JSON with python -m json.tool

Extras

Brian:

  • Congrats to Seth Larson, PSFs first Security Developer-in-Residence
    • Announcing Our New Security Developer in Residence! - PSF announcement
    • I am the first PSF Security Developer-in-Residence - Seth’s announcement
  • PythonPeople.fm is live
    • "The NEW podcast about the people who make the Python community awesome.”
    • I’m focusing more on the people, and less on the tech.
    • First episode is with Michael Kennedy
    • Upcoming episodes in the works with Paul Everitt, Paul McGuire, and Steve Holden.
    • More people scheduled, many asked, and many more to be asked.

Michael:

  • MongoDB with Async Python course is out! (talkpython.fm/async-mongodb)
  • Meta commits to dedicate three engineer-years to implement the removal of the GIL from Python
  • PyPI has a blog

Joke:

  • Containers, that’ll fix it
  • Bonus dad joke: 5 ants rent an apartment. Invite 5 other ants to share the rent. Now there are tenants.

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Plumbum: Shell Combinators and More

  • Suggested by Henry Schreiner last week.
  • (Also, thanks Michael for the awesome search tool on PythonBytes.fm that includes transcripts, so I can find stuff discussed and not just stuff listed in the show notes.)
  • Plumbum is “ a small yet feature-rich library for shell script-like programs in Python. The motto of the library is “Never write shell scripts again”, and thus it attempts to mimic the shell syntax (shell combinators) where it makes sense, while keeping it all Pythonic and cross-platform.”
  • Supports
    • local commands
    • piping
    • redirection
    • working directory changes in a with block. So cool.
    • lots more fun features

Michael #2: Our plan for Python 3.13

  • The big difference is that we have now finished the foundational work that we need:
    • Low impact monitoring (PEP 669) is implemented.
    • The bytecode compiler is a much better state.
    • The interpreter generator is working.
    • Experiments on the register machine are complete.
    • We have a viable approach to create a low-overhead maintainable machine code generator, based on copy-and-patch.
  • We plan three parallelizable pieces of work for 3.13:
    • The tier 2 optimizer
    • Enabling subinterpreters from Python code (PEP 554).
    • Memory management
  • Details on superblocks

Brian #3: Some blogging myths

  • Julia Evans
  • myths (more info of each in the blog post):
    • you need to be original
    • you need to be an expert
    • posts need to be 100% correct
    • writing boring posts is bad
    • you need to explain every concept
    • page views matter
    • more material is always better
    • everyone should blog
  • I’d add
    • Write posts to help yourself remember something.
    • Write posts to help future prospective employers know what topics you care about.
    • You know when you find a post that is outdated and now wrong, and the code doesn’t work, but the topic is interesting to you. Go ahead and try to write a better post with code that works.

Michael #4: Jupyter AI

  • A generative AI extension for JupyterLab
  • An %%ai magic that turns the Jupyter notebook into a reproducible generative AI playground. This works anywhere the IPython kernel runs (JupyterLab, Jupyter Notebook, Google Colab, VSCode, etc.).
  • A native chat UI in JupyterLab that enables you to work with generative AI as a conversational assistant.
  • Support for a wide range of generative model providers and models (AI21, Anthropic, Cohere, Hugging Face, OpenAI, SageMaker, etc.).
  • Official project from Jupyter
  • Provides code insights
  • Debug failing code
  • Provides a general interface for interaction and experimentation with currently available LLMs
  • Lets you collaborate with peers and an Al in JupyterLab
  • Lets you ask questions about local files
  • Video presentation: David Qiu - Jupyter AI — Bringing Generative AI to Jupyter | PyData Seattle 2023

Extras

Brian:

  • Textual has some fun releases recently
    • Textualize youtube channel with 3 tutorials so far
    • trogon to turn Click based command line apps into TUIs
      • video example of it working with sqlite-utils.
  • Python in VSCode June Release includes revamped test discovery and execution.

    • You have to turn it on though, as the changes are experimental:

    ``` "python.experiments.optInto": [ "pythonTestAdapter", ]

    ``` + I just turned it on, so I haven’t formed an opinion yet.

Michael:

  • Michael’s take on the MacBook Air 15” (black one)

Joke: Phishing

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Pydantic roadmap

  • via Mario Munoz
  • Back in February [Samuel] announced Pydantic Inc., but I didn't explain what services we were building.
  • The problem is that even with Pydantic in your corner, working with data when it leaves Python often still sucks.
  • We want to build a data platform to make working with data quick, easy, and enjoyable — where developer experience is our north star.
  • There are five key components to the Pydantic Data Platform that we're thinking of building.

    1. Python Analytics/Observability — a logging and metrics platform with tight Python and Pydantic integration, designed to make the data flowing through your application more readily usable for both engineering and business analytics. More info...
    2. Data Gateway for object stores — Add validation, transformation and cataloguing in front of object stores like S3, with a schema defined in Pydantic models then validated by our Rust service. More info...
    3. Data Gateway for data warehouses — the same service as above, but integrated with your existing data warehouse. More info...
    4. Schema Catalog — for many, Pydantic already holds the highest fidelity representation of their data schemas. Our Schema Catalog will take this to the next level, serving as an organization-wide single source of truth for those schemas, tracking their changes, and integrating with our other tools and your wider platform. More info...
    5. Dashboards and UI powered by Pydantic models — a managed platform to deploy and control dashboards, auxiliary apps and internal tools where everything from UI components (like forms and tables) to database schema would be defined in Python using Pydantic models. More info...
  • Tell them what you think with their survey

Brian #2: The Right Way to Run Shell Commands From Python

  • Martin Heinz
  • Should have a tagline of “especially if you’re on Mac or Linux”.
  • Includes discussion of
    • Python native tools - recommended
    • a few os module functions - but otherwise avoid relying too much on os.
    • subprocess.run() - stick with run() if you can.
    • sh third party package - should be second choice if on Linux or Mac

Michael #3: US: Yep, We're Buying Your Data, Including Your Embarrassing Secrets

  • Digital information can be purchased from commercial data brokers and 'deanonymized' to ID the person it's tied to, including US citizens, the Office of the Director of National Intelligence says.
  • The Office of the Director of National Intelligence (ODNI) on Friday declassified(Opens in a new window) a report from January 2022 that outlines the US government’s approach to using Commercially Available Information (CAI), which can come from data brokers working in the internet ad and analytics industries.
  • The purchased information includes details from users' smartphones and social media accounts.
  • To all the “please disable your ad blockers” companies out there
    • 1) It’s not just about supporting your website
    • 2) Ad blockers are not just avoiding ads.
    • 3) It’s not even necessary (our ads are not blocked on the podcast or the website)
  • Consider browser != Chrome and/or nextdns.io for your whole network

Brian #4: Pro-Tip – pytest fixtures are magic!

  • Frank Wiles
  • “The magic of pytest fixtures is how they are injected into your tests for you to use and their composability. When done well, writing tests is considerably easier and actually fun.”
  • Setup code is often the biggest headache of test writing. pytest fixtures help solve the setup problem.
  • Fixtures
    • are used by just including them in a tests parameter list
    • can build on top of each other
    • can be used in any test in the project, if you put it in a central conftest.py
    • can return all kinds of things: static data, instantiated objects, callables to make other things,
  • Frank includes an interesting way to organize fixtures such that they are defined in local test directories but usable across a project, under “Organizing Your Fixtures”.
  • Plugins with fixtures: A shoutout to pytest-django and a Revsys plugin called django-test-plus.
  • Built-in fixtures. See also tmp_path.
  • autouse
    • One bit of incorrect info: autouse doesn’t work like that. The value of global_thing cannot be grabbed unless you list it in the parameter list. It will run before every function (since it’s scope=``"``function``" by default), but you gotta list it to get the value.
    • To be fair, it’s really hard to come up with good autouse examples. Partly because there are so few good reasons to use autouse.

Extras

Brian:

  • Porting Python projects to Rust
  • International Obfuscated Python Code Competition

Michael:

  • Remember the AMA (submit your question). “Scheduled” on July 11th at 11am.

Joke: Marked as duplicate

View Details

Watch on YouTube

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Ask me anything episode: Submit your question(s) for our upcoming AMA episode: form here. Thank you!

Brian #1: PythonGUIS

  • Martin Fitzpatrick
  • A site with a collection of resources, guides, books, comparisons, etc, around GUIs in Python.
  • Martin recommends starting with PyQT6
  • However, there are tutorials covering
    • PyQT6
    • PySide6
    • PyQT5
    • TkInter
    • PySide
    • even Kivy

Michael #2: JupyterLab 4.0 is Here

  • The next major release of our full-featured development environment
  • You can upgrade by running pip install --upgrade jupyterlab or conda install -c conda-forge jupyterlab.
  • JupyterLab is now faster, thanks to improvements such as CSS rules optimization, CodeMirror 6, MathJax 3, and notebook windowing. JupyterLab 3 was when working with large notebooks.
  • There are additional performance improvements available via opt-in settings:
    • Faster tab-switching on Chromium browsers:
    • “Settings” → “JupyterLab Shell” → switch “Hidden mode” to “contentVisibility”
    • Better performance with long notebooks:
    • “Settings” → “Notebook” → switch “Windowing mode” to “full”
  • An upgraded text editor.
  • Better real time collaboration.
  • Bug fixes. More than 100 bugs have been addressed and resolved, enhancing JupyterLab’s stability and performance.

Brian #3: Proposing a struct syntax for Python

  • Brett Cannon
  • This would be a cool syntax for a data only type: struct Point(x: int, y: int)
  • No positional only parameters
  • No inheritance
  • No methods
  • Instances would be immutable, so p = Point(1, 2) would create an object that could be used as a key.
  • A data only focused set of types.

Michael #4: Python 3.13 Removes 20 Stdlib Modules

  • via PyCoders
  • From PEP 594 – Removing dead batteries from the standard library we’re saying goodbye to
    • aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib
  • As well as the 2to3 program and lib2to3 module in Python.
  • Python 3.12 final release is scheduled in 4 months (October 2023) and Python 3.13 final release is scheduled in 1 year and 4 months (October 2024).

Extras

Brian:

  • Affirming your PSF Membership voting status
    • You have until June 15 to affirm your voting rights in the upcoming Board Election, if you care about such things.

Michael:

  • 5 Career Tips for Budding Python Developers video
  • PyCon US 2023 videos are up
  • Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 beta 2 are now available

Joke: Snorkel not included

View Details

Watch on YouTube

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Show: @pythonbytes@fosstodon.org

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: pystack

  • PyStack is a tool that uses forbidden magic to let you inspect the stack frames of a running Python process or a Python core dump, helping you quickly and easily learn what it's doing.
  • PyStack has the following amazing features:
    • 💻 Works with both running processes and core dump files.
    • 🧵 Shows if each thread currently holds the Python GIL, is waiting to acquire it, or is currently dropping it.
    • 🗑️ Shows if a thread is running a garbage collection cycle.
    • 🐍 Optionally shows native function calls, as well as Python ones. In this mode, PyStack prints the native stack trace (C/C++/Rust function calls), except that the calls to Python callables are replaced with frames showing the Python code being executed, instead of showing the internal C code the interpreter used to make the call.
    • 🔍 Automatically demangles symbols shown in the native stack.
    • 📈 Includes calls to inlined functions in the native stack whenever enough debug information is available.
    • 🔍 Optionally shows the values of local variables and function arguments in Python stack frames.
    • 🔒 Safe to use on running processes. PyStack does not modify any memory or execute any code in a process that is running. It simply attaches just long enough to read some of the process's memory.
    • ⚡ Optionally, it can perform a Python stack analysis without pausing the process at all. This minimizes impact to the debugged process, at the cost of potentially failing due to data races.
    • 🚀 Super fast! It can analyze core files 10x faster than general-purpose tools like GDB.
    • 🎯 Even works with aggressively optimized Python interpreter binaries.
    • 🔍 Even works with Python interpreters' binaries that do not have symbols or debug information (Python stack only).
    • 💥 Tolerates memory corruption well. Even if the process crashed due to memory corruption, PyStack can usually reconstruct the stack.
    • 💼 Self-contained: it does not depend on external tools or programs other than the Python interpreter used to run PyStack itself.

Brian #2: Securing PyPI accounts via Two-Factor Authentication

  • Donald Stufft
  • “… every account that maintains any project or organization on PyPI will be required to enable 2FA on their account by the end of 2023.”
  • “One of the key security promises that PyPI makes is that when you're downloading something, that only the people associated with that project are going to be able to upload, delete, or otherwise modify a project. That when you look at that project and see that it is owned by someone that you trust, that you can be assured that nobody else is making changes to that package on PyPI.”
  • If you maintain a package on PyPI to a point where you are uploading to PyPI or plan to soon, enable 2FA on you account.
  • May as well do it sooner than later. But officially, you have the rest of the year.
  • This has already been a requirement for “critical projects” since last summer. (top 1% of downloads, about 3,500 projects.) See episode 293.
  • Now it’s going to be for everyone.

Michael #3: Propan - a declarative Python MQ framework

  • Propan is a powerful and easy-to-use Python framework for building asynchronous web services that interact with any MQ Broker.
  • It's following by fastapi, simplify Message Brokers around code writing and provides a helpful development toolkit, which existed only in HTTP-frameworks world until now.
  • It is a modern, high-level framework on top of popular specific Python brokers libraries, based on pydantic and fastapi, pytest concepts.
  • The key features are
    • Simple: Designed to be easy to use and learn.
    • Intuitive: Great editor support. Autocompletion everywhere.
    • Dependencies management: Minimization of code duplication. Access to dependencies at any level of the call stack.
    • Integrations: Propan is fully compatible with any HTTP framework you want
    • MQ independent: Single interface to popular MQ:
      • Redis (based on redis-py)
      • RabbitMQ (based on aio-pika)
      • Kafka (based on aiokafka)
      • SQS (based on aiobotocore)
      • Nats (based on nats-py)
    • RPC: The framework supports RPC requests over MQ, which will allow performing long operations on remote services asynchronously.
    • Great to develop: CLI tool provides great development experience:
      • framework-independent way to manage the project environment
      • application code hot reload
      • robust application templates
    • Testability: Propan allows you to test your app without external dependencies: you do not have to set up a Message Broker, you can use a virtual one!

Brian #4: Makefile tricks for Python projects

  • Ricardo Ander-Egg
  • A pretty short basic starter template Makefile for Python projects with some cool snippets.
  • Some default settings to have make behave sanely
    • exit on error, warn about undefined variables, disable built-in rules
    • set up working directory correctly if called from a different dir
  • A $(py) definition that picks up the virtual environment if it’s there.
  • Also $(pip) from the virtual env.
  • Default goal and help message
    • cool trick so that make with no arguments just prints the help
    • And also picks up target comments as help text for the target. Neat.
  • Injecting paths into PYTHONPATH, and an example on how that works if you need it.
  • A .venv target
    • create a virtual environment, update setuptools, wheel, build, and install requirments

Extras

Michael:

  • PyCon Portugal CFP
  • DjangoCon 2024
  • Apple Vision Pro
  • Duet App

Joke: Actual technical people

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: The Basics of Python Packaging in Early 2023

  • Jay Qi
  • Good description of a minimal-ish pyproject.toml file, which includes a build backend and project metadata.
  • That’s all you need for a Python-only project.
  • Discussion of how to choose a build backend. Mostly it’s baed on extra features you might want, like hatchling’s include/exclude features for source distributions.
  • Some discussion of frontend choices.
  • Nice discussion of non-Python-only builds. Specifically, if you need to compile C or C++ extensions, you can use scikit-build-core, or meson-python, or setuptools.
  • Related: "Sharing is Caring - Sharing pytest Fixtures" by Brian Okken (PyCascades 2023)
    • My PyCascades 2023 on packaging pytest plugins is up on YouTube

Michael #2: vecs

  • via Oli
  • Python collection-like interface to storing and searching vectors in postgres.
  • Vector search is a key component in building AI chatbots, and semantic document search.
  • If you're familiar with the space, it's effectively Pinecone built on free OSS
  • It's under the Supabase github org but it's fully open source, and compatible with any pgvector vendor, e.g. RDS, or locally in docker
  • If you’re on macOS and need Postgres, Postgres App is a good option.

Brian #3: Introducing Grasshopper - An Open Source Python Library for Load Testing

  • Jacob Fiola
  • “Grasshopper is a library for automated load testing, written in Python.”
  • Open source project from Alteryx,
  • On GitHub and PyPI under the name locust-grasshopper
  • Built on Locust.
  • Adds
    • Tag-based suites for trend analysis and evaluating changes.
    • Custom trends. Useful for actions that span multiple http calls, and you want to see timing trends for the whole action.
    • Checks. Checks validate boolean conditions in the test.
    • Custom tagging for all metrics
    • Send data to time series db & dashboards.
    • Thresholds.
    • Reporting results to other locations.
    • Some reusable base classes that take care of the majority of the boilerplate that tests often contain
  • Readme has a very thorough introduction including configuration and samples.

Michael #4: memocast

  • by Daniel Engvall
  • A small iOS app for e.g. iPhone that allow you to add links heard in podcasts into reminders.
  • Good example of how to use Pythonista to build python scripts for iOS
  • Pythonista just made an update (2 weeks ago) so that'd use Python 3.10 on the iOS which makes it even more interesting.

Extras

Brian:

Joke: Careful or you might end up summoning a demon.

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Ruff PyCharm plugin

  • via John Hagen
  • Ruff PyCharm plugin has great integration, it will highlight Ruff lint errors in the IDE as you type and you can even apply Alt+Enter (⌥⏎ on Mac) quick fixes through the IDE.
  • Ruff will automatically fix the fixable issues.
  • John also added additional PyCharm-specific instructions for black/Ruff

Brian #2: Writing Python like it's Rust

  • Kobzol
  • Rust lessons guiding use of types and type hints in Python
    • Add type hints tun function signatures
    • Use dataclasses instead of tuples or dictionaries to increase clarity and type safety
    • Union types to clarify | typing

Michael #3: Pip 23.1 Released - Massive improvement to backtracking

  • Pip 23.1 was released last month
  • Highlight the significant improvement in backtracking that is part of the requirement resolver process in Pip. This process involves Pip finding a set of packages that meet your requirements and whose requirements themselves don't conflict.
  • Prior to Pip 20.3, the default process for Pip would allow conflicting requirements to install if they were transitive dependencies where the last one specified would be the one installed.
  • Once the new resolver was turned on by default it immediately hit problems where backtracking would get stuck for a long time.
  • Pip separates out the resolution logic into a library called resolvelib. It had been discovered that there was a logical error under certain circumstances, and also there was a known better backtracking technique it could employ called backjumping.
  • Both of these were recently fixed and implemented in resolvelib, which were then vendored in to Pip 23.1.

Brian #4: Markdown Code Runner

  • markdown-code-runner is a Python package that automatically executes code blocks within a Markdown file, including hidden code blocks, and updates the output in-place.
  • Works with Python & Bash
  • see also cog

Extras

Brian:

Michael:

  • Python 3.12.0a7 is out
  • python3 -m venv --upgrade-deps venv (via John Hagen)
  • Talk submissions are now open for both remote and in-person talks at the 2023 PyConZA? The conference will be held on 5 and 6 October 2023 in Durban, South Africa. South Africa is GMT+2, so the times are convenient for Africa, Europe and much of Asia, although probably less so for the rest of the world. All details are on za.pycon.org - via Kim van Wik
  • Trail discovery/riding apps

Joke: User Inyerface

View Details

Watch on YouTube

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Python's Missing Batteries: Essential Libraries You're Missing Out On

  • Martin Heinz
  • Fun collection of a bunch of libraries you may not know about (or forgot about), with code examples.
  • Utilities
    • boltons : iterate through json and dates, quickly grab data out of nested structures, and convert nested data with jsonutils, timeutils, and iterutils
    • sh : conveniently call shell funcitons
  • Data Validation
    • validators : validate email addresses, credit cars, IP addresses, and more.
    • the fuzz : fuzzy string comparisons
  • Debugging
    • stackprinter : nice stack traces with exception messages higlighted
  • Testing
    • freezegun : stop time, change dates, …
    • dirty_equals : comparing things that are kinda equal
  • CLI
    • tqdm : add a progress bar to command line apps

Michael #2: awesome-polars

  • A curated list of Polars talks, tools, examples & articles.
  • Mostly articles and tutorials however.

Brian #3: Running Headless Selenium in Python (2023)

  • Siddiqi
  • First off, if you are doing automated testing with Selenium, I hope you already know about headless. It’s awesome and speeds up testing.
  • Next, there’s changes to how you code headless, as of Selenium 4.8.0 (Jan. 2023).
  • Old:
    • options.headless=True
  • New:
    • options.add_argument('--headless=new') for Chrome
    • options.add_argument('--headless') for Firefox
  • Reasons: Read Headless is Going Away! post on Selenium blog.
    • Subtitle: “Now that we got your attention, headless is not actually going away, just the convenience method to set it in Selenium”

Michael #4: Gracy

  • Gracy helps you handle failures, logging, retries, throttling, and tracking for all your HTTP interactions.
  • Has support for

    • Parsing per status code
    • Throttling
    • Retries
    • Custom validation
    • Record/replay for testing
  • A bit non-pythonic but perhaps inspriation for some out there

Extras

Michael:

Joke: It’s practice

View Details

Watch on YouTube

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Introducing 'Trusted Publishers’

  • PyPI package maintainers can adopt a new, more secure publishing method that does not require long-lived passwords or API tokens to be shared with external systems.
  • Our term for using the OpenID Connect (OIDC) standard to exchange short-lived identity tokens between a trusted third-party service and PyPI.
  • Instead, PyPI maintainers can configure PyPI to trust an identity provided by a given OpenID Connect Identity Provider (IdP).
  • These API tokens
    • never need to be stored or shared
    • rotate automatically by expiring quickly
    • provide a verifiable link between a published package and its source
  • Additional security hardening is available

Brian #2: Mojo : a new programming language for all AI developers.

  • Mojo may be the biggest programming language advance in decades - fast.ai blog
  • Suggested by many listeners
  • “Mojo combines the usability of Python with the performance of C, unlocking unparalleled programmability of AI hardware and extensibility of AI models.”
  • A programming language compatible with Python, with performance similar to C++/Rust.
  • “Mojo is designed to become a superset of Python over time by preserving Python’s dynamic features while adding new primitives for systems programming.” - emphasis from Brian
    • It’s not there yet, but still super cool
  • Built on a MLIR, not LLVM
  • How compatible is Mojo with Python really?
    • Mojo already supports many core features of Python including async/await, error handling, variadics, etc, but… it is still very early and missing many features - so today it isn’t very compatible. Mojo doesn’t even support classes yet!”

Michael #3: django-prose

Brian #4: pylyzer is a static code analyzer / language server for Python, written in Rust.

  • Shunsuke Shibayama
  • Suggested by Owen
  • Features
    • fast
    • detailed analysis
      • type checking
      • plus things like out-of-bounds accesses to lists, and non-existent key references to dicts
    • more readable reports
    • and a VS Code extension
  • pylyzer vs ruff
    • Ruff, like pylyzer, is a static code analysis tool for Python written in Rust, but Ruff is a linter and pylyzer is a type checker & language server. pylyzer does not perform linting, and Ruff does not perform type checking.”
  • Some limitations and incomplete “todo list”. See README for more details.

Joke: Escape Room

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: rye - Python workflow tool

  • Armin Ronacher
  • Rust built tool, currently only for Linux and MacOS
  • Project workflow commands, like
    • init - new project
    • add - add a dependency (including optional)
    • remove - remove a dependency
    • build - build wheel
    • lock - update lock file
  • virtualenv commands
    • add —dev - install in environment
    • sync - install/update dependencies in env based on pyprojec.toml
    • run - run command within environment
  • Install Python
    • fetch - Fetches a Python interpreter for the local machine
  • Register existing Python
    • toolchain Helper utility to manage Python toolchains
  • Kinda like pipx
    • install - Installs a package as global tool
    • uninstall - Uninstalls a global tool
    • I didn’t see that it added anything to my PATH, so this addition made it work:
  • Bonus
    • Everything lives under ~/.rye
    • So it’s easy to stop using, and doesn’t muck up
  • see also

Michael #2: PyPI Organizations

  • The first step in our plan to build financial support and long-term sustainability of the Python Packaging Index (PyPI)
  • Small fee for organizations rather than individual users
  • Like Github orgs

Brian #3: 5 tips to learn any new Python library faster

  • Bob Belderbos
  • The tiips
    • RTFM - at lest the getting started docs
    • Install it
    • Explore the library - play. Bob recommends Jupyter notebook for this.
    • Apply it to a real world problem - deliberate practice
    • Build something with it
    • (bonus) Teach it - blog, TIL, video tutorial, etc.

Michael #4: Python gets down to (the) Metal

Extras

Brian:

Michael:

Joke: It’s the progress that counts

View Details

Watch on YouTube

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Introducing Microsoft Security Copilot

  • Security Copilot combines this advanced large language model (LLM) with a security-specific model from Microsoft.
  • When Security Copilot receives a prompt from a security professional, it uses the full power of the security-specific model to deploy skills and queries that maximize the value of the latest large language model capabilities.
  • Your data and stays within your control. It is not used to train the foundation AI models, and in fact, it is protected by the most comprehensive enterprise compliance and security controls.

Brian #2: PEP 695 – Type Parameter Syntax

  • “This PEP specifies an improved syntax for specifying type parameters within a generic class, function, or type alias. It also introduces a new statement for declaring type aliases.”
  • To get a feel for this, jump to the examples
  • One example
    • Here is an example of a generic function today.
      from typing import TypeVar _T = TypeVar("_T") def func(a: _T, b: _T) -> _T: ... - And the new syntax. def funcT -> T: ...

Michael #3: Auto-GPT

  • An experimental open-source attempt to make GPT-4 fully autonomous.
  • This program, driven by GPT-4, chains together LLM "thoughts", to autonomously achieve whatever goal you set.
  • Features
    • 🌐 Internet access for searches and information gathering
    • 💾 Long-term and short-term memory management
    • 🧠 GPT-4 instances for text generation
    • 🔗 Access to popular websites and platforms
    • 🗃️ File storage and summarization with GPT-3.5

Brian #4: Astral : Ruff is now a company

  • Charlie Marsh announces Astral, starting off with a healthy $4m in seed money. Not a bad start
  • Astral will continue building high-performance developer tools for the Python ecosystem — to keep building Ruff, and to build more Ruff-like things.
  • “to make the Python ecosystem more productive by building high-performance developer tools.”
  • Undoubtedly Rust-ifying more of the Python tool chain.
  • Related:
    • In a discussion at PyCon, someone asked me if Ruff was a replacement for Black.
    • My answer, “not really, more of a flake8 replacement and a few other tools, but a partial overlap with Black.
    • Real answer is at the FAQ
      • Is Ruff compatible with Black?
        • Yes. Ruff is compatible with Black out-of-the-box, as long as the line-length setting is consistent between the two.
        • As a project, Ruff is designed to be used alongside Black and, as such, will defer implementing stylistic lint rules that are obviated by autoformatting.”

Extras

Brian:

Michael:

Joke: Releasing to prod

View Details

Watch on YouTube

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: huak - A Python package manager written in Rust. Inspired by Cargo

  • Suggested by Owen
  • Tons of workflows
    • activate - activate a virtual environment
    • add add a dependency to a project
      • pip install it into your virtual environment, and add it to the dependency list in pyproject.toml
    • test - run pytest
    • update update dependencies
    • lint - run ruff, installing it first if necessary
    • fix - autofix fixable lint conflicts
    • build - build wheel in isolated virtual environment using hatchling
  • Honestly
    • I was considering building my own workflow tool, but this is darned close to what I want.
    • Even though it’s still “in an experimental state”.
    • There are rough edges (ruff edges, get it), but still, way cool.
    • I just don’t know how to pronounce it. Is it like “walk”, or more like “whack”?

Michael #2: PSF expresses concerns about a proposed EU law that may make it impossible to continue providing Python and PyPI to the European public

  • After reviewing the proposed Cyber Resilience Act and Product Liability Act, the PSF has found issues that put the mission of our organization and the health of the open-source software community at risk.
  • As currently written, the authors of open-source components might bear legal and financial responsibility for the way their components are applied in someone else’s commercial product.
  • The risk of huge potential costs would make it impossible in practice for us to continue to provide Python and PyPI to the European public.

Brian #3: ChaosToolkit

  • Suggested by the maintainer, Sylvain Hellegouarch
  • Declare and store your Chaos Engineering experiments as JSON/YAML files so you can collaborate and orchestrate them as any other piece of code.
  • Extensible through an Open API
  • Can be automated in CI/CD pipeline

Michael #4: PEP 711 – PyBI: a standard format for distributing Python Binaries

  • “Like wheels, but instead of a pre-built python package, it’s a pre-built python interpreter”

Joke: It’s the effort that counts

View Details

Watch on YouTube

About the show

Sponsored by InfluxDB from Influxdata.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: makeapp

  • via Felix Ingram
  • Simplifies Python application rollout and publishing.
  • Link to its mention on Talk Python.
  • Simplifies Python application rollout and publishing:
    • Make a skeleton for your new application with one console command
    • Automatically create a VCS repository for your application.
    • Automatically check whether the chosen application name is not already in use.
    • Customize new application layouts with skeleton templates.
    • Put some skeleton default settings into a configuration file not to mess with command line switches anymore.
    • Easily add entries to your changelog.
    • Publish your application to remotes (VCS, PyPI) with single command.

Brian #2: Looking forward to Python 3.12

  • We’re on 3.12.0a7 now, the last alpha, final is scheduled for October
  • So far, in 3.12.0a7
  • What’s new in Python 3.12 page has some examples of the Improved Error Messages
  • Recent addition, PEP 684 - A Per-Interpreter GIL was approved recently
    • “… sufficient isolation would facilitate true multi-core parallelism …” seems like a good thing.
    • But also, “… this is an advanced feature meant for a narrow set of users of the C-API. “, so not really sure how this will affect us.
    • Still, seems cool.

Michael #3: Python 3.11.3 is out

  • Fixes a HIGH level CVE in OpenSSL (so patch it)
  • Lots of changes in Core and Builtins

Brian #4: How to Make a Great Conference Talk

  • Sebastian Witowski
  • Lots of great advice for tech conf talks.
  • Don’t skip the last half of this, getting your talk accepted is really when the work starts.
  • Good sections to make sure you don’t miss
    • Live demos
      • “First of all - do you really need a demo? …”
    • Rehearsing
      • Don’t skip this. Do this. A lot. Out loud. With a timer. While standing.
      • Memorize the first few minutes, and the last few.
      • Know how you’re going to open and close.
    • Night before
      • get enough sleep
    • Day of
      • eat well. Don’t drink too much liquids. Be comfortable.
  • Sebastian was honest in saying this stuff works for him, but do what works for you.
  • From Brian:
    • I deviate from Sebastian in quite a few places, but still don’t disagree with his advice.
    • I can’t give a talk without slides, as I use them for prompts to know what I’m talking about next.
      • My talks usually have a lot of code snippets. Obviously, that would be difficult without slides.
      • I write my talk and my slides in Markdown. Sebastian writes in something else, then builds slides as visual aids. That’s cool.
      • Do what works for you.
  • Bonus tool from the article:
    • demo-magic - If I’m ever tempted to live code again, I think I’ll try this instead.

Extras

Michael:

Joke:

View Details

Watch on YouTube

About the show

Sponsored by Influxdb

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Pydantic V2 Pre Release

  • Terrence Dorsey & Samuel Colvin
  • Alpha release available to everyone: pip install --pre -U "pydantic>=2.0a1"
  • Headlines:
    • pydantic-core - all validation logic rewritten in Rust and moved to separate package, pytest-core
      • 5-50x faster
      • separation will aid safety and maintainability
  • Lots ready for experimentation
    • BaseModel, Dataclasses, Serialization, …
  • Much still under construction
    • Docs, BaseSettings→ pydantic-settings, …

Michael #2: microdot The impossibly small web framework for Python and MicroPython

  • Microdot is a minimalistic Python web framework inspired by Flask, and designed to run on systems with limited resources such as microcontrollers.
  • It runs on standard Python and on MicroPython.
  • Support for async, websockets, tls, even ASGI servers.
  • Less mem usage by a big margin.

Brian #3: GitHub Actions Tools: watchgha, build and inspect, and pytest annotate failures

Michael #4: PEP 709 – Inlined comprehensions

  • by Carl Meyer
  • Comprehensions are currently compiled as nested functions, which provides isolation of the comprehension’s iteration variable, but is inefficient at runtime.
  • This PEP proposes to inline list, dictionary, and set comprehensions into the code where they are defined, and provide the expected isolation by pushing/popping clashing locals on the stack.
  • This change makes comprehensions much faster: up to 2x faster for a microbenchmark of a comprehension alone.

Extras

Michael:

Joke: Can’t watch movies

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #1: Prefix-cache

  • via Brendan Hannigan
  • You can set an environment variable or use it as a command line argument and then instead of creating tons of __pycache__ folders to store your *.pyc files right next to the source code, it puts them in some specified folder.
  • Introduced in python 3.8.

Brian #2: NiceGUI

  • Suggested by several listeners
  • Browser based GUI
  • “NiceGUI is an easy-to-use, Python-based UI framework, which shows up in your web browser. You can create buttons, dialogs, Markdown, 3D scenes, plots and much more.It is great for micro web apps, dashboards, robotics projects, smart home solutions and similar use cases. You can also use it in development, for example when tweaking/configuring a machine learning algorithm or tuning motor controllers.” - from the README

Michael #3: flask-ngrok

  • A simple way to demo Flask apps from your machine.
  • Makes your Flask apps running on localhost available over the internet via ngrok.
  • Great for testing API consumers too.
    app = Flask(__name__)run_with_ngrok(app) # Start ngrok when app is run# Endpoints ...if __name__ == '__main__': app.run()

Brian #4: No-async async with Python

  • Will McGugan
  • Allowing async while not requiring async
  • Await me (maybe)
  • Optionally awaitable
    • Providing API methods that can be called by both async and non-async code.
    • The called method really is async, but if a caller doesn’t want to know when the code is done, it can ignore the return value and not await.
  • MK: I had to solve a similar problem in fastapi-chameleon
  • MK: Syncify async functions.

Extras:

Brian:

Jokes:

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: zipapp

  • Part of standard library since 3.5
  • Yet another thing I learned recently from Brett Cannon
  • “This module provides tools to manage the creation of zip files containing Python code, which can be executed directly by the Python interpreter. The module provides both a Command-Line Interface and a Python API.”
  • Including: Creating Standalone Applications with zipapp

Michael #2: Reverse engineering the Apple News app with #python and #nerd power

  • As we navigate the digital world, we often come across articles we don't have time to read but still want to save for later.
  • One way to accomplish this is by using the Read Later feature in Apple News.
  • But what if you want to access those articles outside the Apple News app, such as on a different device or with someone who doesn't use Apple News?
  • Or what if you want to automatically post links to those articles on your blog? That's where the nerd powers come in.
  • The linked article shows how to use Python to solve your own problem
  • Leading to Rhet Turnbull’s CLI: apple-news-to-sqlite

Brian #3: What is a context manager?

  • Trey Hunner
  • Also look at all the cool goodies in contextlib from standard library
    • @contextmanager
    • closing
    • suppress
    • redirect_stdout, redirect_stderr
    • chdir

Michael #4: nox-poetry: Use Poetry inside Nox sessions

  • via 2 people: John Hagen and Marc Prewitt
  • This package provides a drop-in replacement for the nox.session decorator, and for the nox.Session object passed to user-defined session functions.
  • Comes from Claudio Jolowicz's hypermodern python cookiecutter
  • This session performs the following steps:
    • Build a wheel from the local package.
    • Install the wheel as well as the pytest package.
    • Invoke pytest to run the test suite against the installation.
  • Consider what would happen in this session if we had imported @session from nox instead of nox_poetry:
    • Package dependencies would only be constrained by the wheel metadata, not by the lock file. In other words, their versions would not be pinned.
    • The pytest dependency would not be constrained at all.
    • Poetry would be installed as a build backend every time.

Extras

Brian:

Michael:

Joke: UnsafeWarnings

View Details

Watch on YouTube

About the show

Sponsored by Compiler Podcast from Red Hat.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: pydantic-xml extension

  • via Ilan
  • Recall untangle. How about some pydantic in the mix?
  • pydantic-xml is a pydantic extension providing model fields xml binding and xml serialization / deserialization. It is closely integrated with pydantic which means it supports most of its features.

Brian #2: How virtual environments work

  • Brett Cannon
  • This should be required reading for anyone learning Python.
    • Maybe right after “Hello World” and right before “My first pytest test”, approximately.
  • Some history of environments
    • Back in the day, there was global and your directory.
  • How environments work
    • structure: bin, include, and lib
    • pyvenv.cfg configuration file
  • How Python uses virtual environments
  • What activation does, and that it’s optional.
    • Yes, activation is optional.
  • A new project called microvenv that helps VS Code.
    • Mostly to fix the “Debian doesn’t ship python3 with venv” problem.
    • It doesn’t include script activation stuff
    • It’s super small, less than 100 lines of code, in one file.

Michael #3: DbDeclare

  • Declarative layer for your database.
  • https://raaidarshad.github.io/dbdeclare/guide/controller/#example
  • Sent in by creator raaid
  • DbDeclare is a Python package that helps you create and manage entities in your database cluster, like databases, roles, access control, and (eventually) more.
  • It aims to fill the gap between SQLAlchemy (SQLA) and infrastructure as code (IaC).
  • You can:
    • Declare desired state in Python
    • Avoid maintaining raw SQL
    • Tightly integrate your databases, roles, access control, and more with your tables
  • Migrations like alembic coming too.

Brian #4: Testing multiple Python versions with nox and pyenv

  • Seth Michael Larson
  • This is a cool “what to do first” with nox.
  • Specifically, how to use it to run pytest against your project on multiple versions of Python.
  • Example noxfile.py is super small

     import nox @nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]) def test(session): session.install(".") session.install("-rdev-requirements.txt") session.run("pytest", "tests/")
  • How to run everything, nox or nox -s test.

  • How to run single sessions, nox -s test-311 for just Python 3.11
  • Also how to get this to work with pyenv.
    • pyenv global 3.8 3.9 3.10 3.11 3.12-dev
  • This reminds me that I keep meaning to write a workflow comparison post about nox and tox.

Extras

Michael:

Joke: Case of the Mondays

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Data Classification : Does Python still have a need for class without @dataclass?

  • Glyph
  • dataclasses have been in the the language since 3.7
    • That’s pretty much all modern Python, right?
  • “…, is there any point to having non-@dataclass classes any more? Is there any remaining justification for writing them in new code?”
  • Options:
    • class just becomes a dataclass if you have typehinted members in it.
    • data instead of class, to avoid decorators

Michael #2: PyGWalker

  • Turn your pandas dataframe into a Tableau-style User Interface for visual analysis.
  • Works with pandas and polars
  • Open-source alternative to Tableau
  • It allows data scientists to analyze data and visualize patterns with simple drag-and-drop operations.

Brian #3: An opinionated Python boilerplate

  • Duarte O.Carmo
  • Tools and processes for new projects
  • pip-tools - Pip-tools strikes the right balance between simplicity, effectiveness, and speed.
    • especially for generating pinned requirements.txt files, if necessary
  • pyproject.toml - for configuration. packaging, but also any tool that supports it.
  • ruff
  • black, isort
  • no pre-commit hooks, just run it in CI

Michael #4: Front Matter VS Code

  • via Mark Little
  • If you have content that supports frontmatter and is markdown-based, check this out.
  • Stay in your editor and easily create, manage, and publish content.
  • Don’t make front matter mistakes
    • When was it published? What is the timezone text formatting again?
  • Learn new features of your existing static site (e.g. article image)
  • Manage images and more.

Extras

Brian:

Michael:

Joke:

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

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: Python Parquet and Arrow: Using PyArrow With Pandas

  • Parquet is an efficient, compressed, column-oriented storage format for arrays and tables of data.
  • Less wrangle-able than Pandas, but way faster and lower memory
  • Questions answered
    • Can we use Pandas DataFrames and Arrow tables together, and if so, how is this done? (It turns out the answer is yes, and it’s quite simple, as we’ll see).
    • In what ways are Arrow tables “better” than Pandas DataFrames? In other words, for which tasks are Arrow tables better suited? Conversely, what tasks are possible or easy in Pandas that are difficult or impossible in Arrow?
    • As an on-disk format, how does Parquet compare to popular alternatives such as feather, orc, CSV, etc.?

Brian #2: FastAPI-Filter

  • Arthur Rio
  • Add query string filters to your api endpoints and show them in the swagger UI.
  • The supported backends are SQLAlchemy and MongoEngine.
  • FastAPI-Filter documentation
  • The philosophy of fastapi_filter is to be very declarative. You define the fields you want to be able to filter on as well as the type of operator, then tie your filter to a specific model.
  • default filters: neq, gt, gte, in, isnull, lt, lte, not/ne, not_in, nin, like/ilike
  • The swagger support is actually quite cool.

Michael #3: 12 Python Decorators to Take Your Code to the Next Level

  • Decorators are awesome
  • This is mostly home-grown decorators, but some standard ones too
  • Notable ones:
    • @warps
    • @lru_cache
    • @repeat
    • @timeit
    • @retry ← no please use tenacity
    • @countcall
    • @rate_limited
    • @dataclass
    • @register
    • @property
    • @singledispatch

Brian #4: PyHamcrest

  • Contributed by Txels
  • PyHamcrest is a framework for writing matcher objects, allowing you to declaratively define “match” rules.
  • PyHamcrest tutorial
  • Having a tool that allows you to pick out precisely the aspect under test and describe the values it should have, to a controlled level of precision, helps greatly in writing tests that are “just right.”
  • From Brian: I’ve been reluctant to try matcher style assertion helper libraries, as, with pytest, assert works just fine. However, I can see cases where PyHamcrest assertions could help test readability, and that’s always a win.
  • Examples:
    • equality: assert_that(theBiscuit, equal_to(myBiscuit))
    • exceptions: assert_that(calling(parse, bad_data), raises(ValueError))
    • async: assert_that(``await resolved(future), future_raising(ValueError))
    • boolean: assert_that(theBiscuit.isCooked())
  • There’s predefined matchers for
    • objects, numbers, text, logical checks, dequences, dictionaries

Extras

Brian:

Michael:

Joke: A group of developers is called …

View Details

Watch on YouTube

About the show

Sponsored by Compiler Podcast from Red Hat.Connect with the hosts

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: Use TOML for .env files?

  • Brett Cannon
  • .env files are used to store default settings that can be overridden by environmental variables.
  • Possibly brought on by twelve-factor app design.
  • Supported by python-dotenv, which is also used by pydantic, pipenv, and others.
  • One issue is that it’s not a defined standard.
    • from python-dotenv docs “The format is not formally specified and still improves over time. That being said, .env files should mostly look like Bash files.”
  • Adafruit decided that an upcoming CircuitPython will use TOML as the format for settings.toml files, which are to be used mostly how .env files are being used.
  • Brett notices this may fix things for Python for VS Code, and other people as well.
  • So… Is this a good idea? I think so.

Michael #2: Pydantic gets serious funding

  • via Mark Little (was on episode 285)
  • Sequoia backs open source data-validation framework Pydantic to commercialize with cloud services.
  • Pydantic Services Inc. emerges from stealth today with $4.7 million in seed funding.
  • Pydantic’s new commercial entity will incorporate a swath of new tools and services that are both “powered-by and inspired-by the Pydantic library”
  • Pydantic will start with an initial team of six, with the first three engineers based in Montana, Chicago and Berlin.
  • “With $4.7 million in the bank, Colvin said that they’re continuing to rewrite parts of Pydantic in Rust, with a view toward making it more efficient via a ten-fold performance improvement.”

Erin #3: JSON Fields for performance (Denormalization)

  • David Stokes
  • Using JSON fields when you design your databases is a good way to improve database query performance.

Brian #4: f-strings with pandas and Jupyter keyboard shortcuts

  • Kevin Markham
  • After a couple year break from blogging, friend of the show Kevin Markham has a couple great, short, useful posts.
  • How to use Python's f-strings with pandas
    • My favorite bit is the part about using f-strings for dictionary keys
  • Fly through Jupyter with keyboard shortcuts 🚀
    • I’m a sucker for a rocket emoji
    • Not an overwhelming list. Just the essentials for even the casual Jupyter user.
    • Examples
      • Esc and Enter for command mode/edit mode
      • a and b for creating a new cell above or below current cell.
      • m and y for changing the cell type to Markdown or code.
      • Shift+m to merge cells
      • so many more
  • -

Michael #5: BioGPT

Erin #6: Code Mentorship and Communicating with Newer Devs

Extras:

Michael:

Erin:

Joke:

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

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: camply

  • A tool to find campsites at sold out campgrounds through sites like recreation.gov and Yellowstone
  • Finding reservations at sold out campgrounds can be tough.
  • Searches the APIs of booking services like recreation.gov (which indexes thousands of campgrounds across the USA) to continuously check for cancellations and availabilities to pop up.
  • Once a campsite becomes available, camply sends you a notification to book your spot!
  • Want to camp in a tower in California?

    camply campgrounds --search "Fire Lookout Towers" --state CA

Brian #2: hatch-fancy-pypi-readme

  • Your ✨Fancy✨ Project Deserves a ✨Fancy✨ PyPI Readme! 🧐
  • Hynek Schlawack
  • Include lots of extras in a README.md
    • text fragments
    • files, like AUTHORS.md or Changelog.md, with custom start, stop, pattern includes, etc.
    • regular expression substitutions
  • Several projects with examples, including black.

Pamela #3: Pyodide dev branch now supports 3.11

Michael #4: EU hates open source?

  • via Pamphile Roy
  • The Cyber Resilience Act (CRA) is an interesting and important proposal for a European law that aims to drive the safety and integrity of software
  • The proposal includes a requirement for self-certification by suppliers of software to attest conformity with the requirements of the CRA including security, privacy and the absence of Critical Vulnerability Events (CVEs).
  • We recognize that the European Commission has framed an exception in recital 10 attempting to ensure these provisions do not accidentally impact Open Source software.
  • However, drawing on more than two decades of experience, we at the Open Source Initiative can clearly see that the current text will cause extensive problems for Open Source software.
  • Since the goal is to avoid harming Open Source software this goal should be stated at the start of the paragraph as the rationale, replacing the introductory wording about avoiding harm to "research and innovation" to avoid over-narrowing the exception.
  • The reference to "non-commercial" as a qualifier should be substituted. The term “commercial” has always led to legal uncertainty for software and is a term which should not be applied in the context of open source
  • OSI recommends further work on the Open Source exception to the requirements within the body of the Act to exclude all activities prior to commercial deployment of the software and to clearly ensure that responsibility for CE marks does not rest with any actor who is not a direct commercial beneficiary of deployment.

Brian #5: So, Single (‘) or Double (“) Quotes in Python?

  • Marcin Kozak
  • PEP8 doesn’t recommend anything.
  • REPL uses single quotes.>>> x = "one">>> x'one'
  • Black sides with “double quotes”, due to the apostrophe in the string problem.
    • 'Don\'t be so sad.' vs “Don’t be sad.”
  • You get to pick, and don’t be bullied by black-fanatics.
  • There’s always blue, which is just like black, but
    • defaults to single-quotes
    • line length defaults to 79, not black’s 88.
    • preserves whitespace before hash marks for right hanging comments (so multiple lines can line up).

Pamela #6: Frozen-Flask

Extras

Brian:

Michael:

Pamela:

Jokes:

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/stream/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: Packaging Python Projects

  • Tutorial from PyPA
  • This is a really good starting point to understand how to share Python code through packaging.
  • Includes discussion of
    • directory layout
    • creating package files, LICENSE, pyproject.toml, README.md, tests and src dir
    • how to fill out build-system section of pyproject.toml
      • using either hatchling, setuptools, flit, or pdm as backends
    • metadata
    • using build to generate wheels and tarballs
    • uploading with twine
  • However
  • Further discussion later in the show

Michael #2: untangle xml

  • Convert XML to Python objects
  • Children can be accessed with parent.child, attributes with element['attribute'].
  • Call the parse() method with a filename, an URL or an XML string.
  • Given this XML:
     [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED] [HTML_REMOVED]

Access the document:

 obj.root.child['name'] # u'child1'

Calvin #3: Mypy 1.0 Released

  • Mypy is a static type checker for Python, basically a Python linter on steroids
  • Started in 2012 and developed by a team at Dropbox lead by https://github.com/JukkaL
  • What’s New?
    • New Release Numbering Scheme
      • not using symver
      • Significant backward incompatible changes will be announced in the blog post for the previous feature release
      • feature flags will allow users to upgrade and turn on the new behavior
    • Mypy 1.0 is 40% faster than 0.991 against the Dropbox internal codebase
      • 20 optimizations included in this release
    • Mypy now warns about errors used before definition or possibly undefined variables
      • for example if a variable is used outside of a block of code that may not execute
    • Mypy now supports the new Self type introduced in PEP 673 and Python 3.11
    • Support ParamSpec in Type Aliases
    • Also, ParamSpec and Generic Self types are no loner experimental
    • Lots of Miscellaneous New Features
    • Fixes to crashes
    • Support for compiling Python match statements introduced in Python 3.10

Brian #4: Thoughts on the Python packaging ecosystem

  • Pradyun Gedam
  • Some great background on the internal tension around packaging.
  • Brian’s note: in the meantime
    • people are struggling to share Python code
    • the “best practice” answer seems to shift regularly
    • this might be healthy to arrive at better tooling in the long term, but in the short term, it’s hurting us.
  • From the article:
    • The Python packaging ecosystem unintentionally became the type of competitive space that it is today.
    • The community needs to make an explicit decision if it should continue operating under the model that led to status quo.
    • Pick from N different tools that do N different things is a good model.
    • Pick from N ~equivalent choices is a really bad user experience.
    • Picking a default doesn’t make other approaches illegal.
    • Communication about the Python packaging ecosystem is fragmented, and we should improve that.
  • Pradyun: “Many of the users who write Python code are not primarily full-time software engineers or “developers”.”
  • from Thea: “The reason there are so many tools for managing Python dependencies is because Python is not a monoculture and different folks need different things.”
  • opening up the build backend through pyproject.toml-based builds was good
  • but the fracturing of multiple “workflow” tools seems bad.
  • “I am certain that it is not possible to create a single “workflow” tool for Python software. What we have today, an ecosystem of tooling where each makes different design choices and technical trade-offs, is a part of why Python is as widespread as it is today. This flexibility and availability of choice is, however, both a blessing and a curse.”
  • On building a default workflow tool around pip
    • interesting idea
  • There’s tension between “we need a default workflow tool” and “unix philosophy: many focused tools that can work together”.

Michael #5: Top PyPI Packages

  • A monthly dump of the 5,000 most-downloaded packages from PyPI.
  • Also, a full copy of PyPI info too: github.com/orf/pypi-data

Calvin #6: SQLAlchemy 2.0 Released

  • #57 on the Top PyPI Packages 😸
  • Will be giving a SQLAlchemy tutorial at Python Web Conf
  • What’s New?
    • Significant API change from 1.4
    • You’ll want to follow the migration guide and see also the what’s new in 2.0 guide
    • Fully takes advantage of Python 3 features such as dataclasses, enums and inline annotations
    • Typing support in Core and ORM, but still should be considered beta
      • all SQLAlchemy stubs packages must be uninstalled all SQLAlchemy stubs packages must be uninstalled for typing to work
      • Mypy Plugin is considered deprecated now
    • Major speed increase in the all new fully ORM-integrated bulk INSERTs
      • sorry if you are on MySQL, they don’t support INSERT RETURNING yet
      • but MariaDB does support this
    • All new bulk optimized schema reflection architecture
      • Currently enabled for PostgreSQL and Oracle
      • 250% perf increase for Postgres
      • 900% per increase for Oracle
    • Native extensions ported to Cython
      • C extensions have been replaced by Cython
      • Benchmarks as fast or sometimes faster than the previous C extensions
      • Removes some risk of memory or stability issues introduced by C
    • SQLAlchemy is now pep-517 enabled and has a pyproject.toml at the root
      • means that local source building with pip can auto install the Cython dependancy

Extras

Brian:

  • Nothing to share yet, but I’m building a new alternative Python build backend.
    • which if course will be followed with a new workflow tool that follows “my workflow”.

Michael:

Calvin:

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/stream/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: git-sim

  • Visually simulate Git operations in your own repos with a single terminal command.
  • Generates an image (default) or video visualization depicting the Git command's behavior.
  • Features
    • Run a one-liner git-sim command in the terminal to generate a custom Git command visualization (.jpg) from your repo
    • Supported commands: log, status, add, restore, commit, stash, branch, tag, reset, revert, merge, rebase, cherry-pick
    • Generate an animated video (.mp4) instead of a static image using the --animate flag (note: significant performance slowdown, it is recommended to use --low-quality to speed up testing and remove when ready to generate presentation-quality video)
    • Choose between dark mode (default) and light mode
    • Animation only: Add custom branded intro/outro sequences if desired
    • Animation only: Speed up or slow down animation speed as desired
  • See images and animations on the github readme.

Brian #2: Why I Like Nox

  • Hynek Schlawack
  • I like tox and have wanted to try nox but couldn’t think of good reasons for a switch.
  • Hynek is a fan of both, so it’s nice to read his perspective.
  • The article starts with comparing doing the same thing in both
    • testing with Python 3.10 and 3.11 and adding the ability to pass in pytest arguments.
    • even with this example, I do admit that the nox example is easier to read, but a bit more verbose.
  • A second example of running a specific example combination of library and Python is quite a bit longer in nox, but there’s an interesting commentary: “… this is longer than the tox equivalent. But that’s because it’s more explicit and anyone with a passing understanding of Python can deduce what’s happening here – including myself, looking at it in a year. Explicit can be good, actually.”
  • Other benefits:
    • It’s a Python file with Python functions, you have the all of Python at your disposal when developing sessions to run.
    • It’s not “ini format”. Complex ini files get out of hand quickly.
    • nox has Python versions as fist class selectors.
  • Final note: “Again, this article is not a call to abandon tox and move all your projects to Nox – I haven’t done that myself and I don’t plan to. But if my issues resonate with you, there’s an option!”

Michael #3: I scanned every package on PyPi and found 57 live AWS keys

  • Scanning every release published to PyPi found 57 valid access keys.
  • Detecting AWS keys is actually fairly simple. A keypair consists of two components: the key ID and the key secret.
  • The key ID can be detected with the regular expression ((?:ASIA|AKIA|AROA|AIDA)([A-Z0-7]{16}))
  • The secret key can be detected with a much more general [a-zA-Z0-9+/]{40}.
  • Static PyPI data: github.com/orf/pypi-data

Brian #4: Getting Started With Property-Based Testing in Python With Hypothesis and pytest

  • Rodrigo Girão Serrão
  • Hypothesis and property based testing can be overwhelming at first.
  • So focused intro posts are quite helpful.
  • This post focuses on a couple of examples, gcd(), greatest common divisor, and my_sort(), a custom list sorter.
  • Good discussion of how property based testing is different and how to do it successfully, especially the order of development:
    • focus on developing properties of correct answers
    • develop a test that checks those properties
    • use hypothesis strategies to come up with input
    • pick @examples if necessary
    • narrow the range of input if necessary
      • caveat: I would have preferred hypothesis.assume() to limiting input in the first example. assume(not (n == m == 0))
      • see https://hypothesis.readthedocs.io/en/latest/details.html#hypothesis.assume
    • add more testing outside of hypothesis
      • In my experience it’s often easier for me to develop code with non-hypothesis test cases, then follow up with hypothesis. But after works also.
  • The mental gymnastics of thinking of properties for algorithmic code is worthwhile.

Extras

Michael:

Joke: Didn't come here to be called out

View Details

Watch on YouTube

About the show

Sponsored by us! Support our work through:

Connect with the hosts

Join us on YouTube at pythonbytes.fm/stream/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: markdown-it-py

Michael #2: Sketch

  • via Jake Firman
  • Sketch is an AI code-writing assistant for pandas users that understands the context of your data
  • A Natural Language interface that successfully navigates many tasks in the data stack landscape.
    • Data Cataloging:
      • General tagging (eg. PII identification)
      • Metadata generation (names and descriptions)
    • Data Engineering:
      • Data cleaning and masking (compliance)
      • Derived feature creation and extraction
    • Data Analysis:
      • Data questions
      • Data visualization
  • Watch the video on the GitHub page for a quick intro

Brian #3: Fixing Circular Imports in Python with Protocol

  • Built on Subclassing in Python Redux from Hynek
    • We covered this in the summer of 2021, episode 240
    • However, I re-read it recently due to a typing problem
    • Problem is when an object passes itself to another module to be called later.
      • This is common in many design patterns, including just normal callback functions.
      • Normally not a problem with Python, due to duck typing.
      • But with type hints, suddenly it seems like both modules need types from the other.
    • So how do you have two modules use types from each other without a circular import.
    • Hynek produces two options
      • Abstract Data Types, aka Interfaces, using the abc module
        • Requires a third interface class
      • Structural subtyping with Protocol
        • This is what I think I’ll use more often and I’m kinda in love with it now that I understand it.
        • Still has a third type, but one of the modules doesn’t have to know about it.
      • "Structural Subtyping : Structural subtyping is duck typing for types: if your class fulfills the constraints of a Protocol, it’s automatically considered a subtype of it. Therefore, a class can implement many Protocols from all kinds of packages without knowing about them!”
  • The Fixing Circular Imports in Python with Protocol article walks through one example of two classes talking with each other, typing, circular imports, and fixing them with Protocol

Michael #4: unrepl

  • via/by Ruud van der Ham
  • We’ve seen the code samples:

    >>> board = []>>> for i in range(3):... row = ['_'] * 3... board.append(row)... >>> board[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]>>> board\[2\][0] = 'X' >>> board[['_', '_', '_'], ['_', '_', '_'], ['X', '_', '_']]
  • But you cannot really run this code. You can’t paste it into a REPL yourself nor can you put it into a .py file.

  • So you unrepl it: Copying the above code to the clipboard and run unrepl.
  • Paste the result and now you can.
  • Unrepl can be used as a command line tool but also as a module.
  • The REPL functionality of underscore (_) to get access to the last value is also supported.

Extras

Michael:

  • You'll want to update your git ASAP.
  • Get course releases at Talk Python via RSS
  • Gist for using Turnstile with Python + Pydantic

Joke: there's a bug in the js

  • You’ve checked all your database indexes,
  • You’ve tuned all your API hooks,
  • You’re starting to think
  • That you might need a drink,
  • Because there’s only one place left to look:
  • There must be a bug in the javascript
  • Because everything else was built properly
  • But the frontend’s a pile of crap ;)

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Join us on YouTube at pythonbytes.fm/stream/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Michael #1: Secure maintainer workflow

  • by Ned Batchelder
  • We are the magicians, but also the gatekeepers for our users
  • Terminal sessions with implicit access to credentials
    • first is unlikely: a bad guy gets onto my computer and uses the credentials to cause havoc
    • second way is a more serious concern: I could unknowingly run evil or buggy code that uses my credentials in bad ways.
  • Mitigations
    • 1Password: where possible, I store credentials in 1Password, and use tooling to get them into environment variables.
      • Side bar: Do not use lastpass, see end segment
      • I can have the credentials in the environment for just long enough to use them. This works well for things like PyPI credentials, which are used rarely and could cause significant damage.
    • Docker: To really isolate unknown code, I use a Docker container.

Brian #2: Tools for parsing HTML and JSON

Michael #3: git-sizer

  • Compute various size metrics for a Git repository, flagging those that might cause problems.
  • Tip, partial clone: git clone --filter=blob:none URL

     # Stats for training.talkpython.fm # Full: git clone repo Receiving objects: 100% (118820/118820), 514.31 MiB | 28.83 MiB/s, done. Resolving deltas: 100% (71763/71763), done. Updating files: 100% (10792/10792), done. 1.01 GB on disk # Partial: git clone --filter=blob:none repo Receiving objects: 100% (10120/10120), 220.25 MiB | 24.92 MiB/s, done. Resolving deltas: 100% (1454/1454), done. Updating files: 100% (10792/10792), done. 694.4 MB on disk
  • Partial clone is a performance optimization that “allows Git to function without having a complete copy of the repository. The goal of this work is to allow Git better handle extremely large repositories.” When changing branches, Git may download more missing files.

  • Not the same as shallow clones or sparse checkouts
    • Consider shallow clones for CI/CD/deployment
    • Sparse checkouts for a slice of a monorepo

Brian #4: Dataclasses without type annotations

  • Probably file this under “don’t try this at home”.
    • Or maybe “try this at home, but not at work”.
    • Or just “that Brian fella is a bad influence”.
      • What! It’s not me. It’s Adrian, the dude that wrote the article.
  • Unless you’re using a type checker, for dataclasses, “… use any type you want. If you're not using a static type checker, no one is going to care what type you use.”
     @dataclass class Literally: anything: ("can go", "in here") as_long_as: lambda: "it can be evaluated" # Now, I've noticed a tendency for this program to get rather silly. hell: with_("from __future__ import annotations") it_s: not even.evaluated it: just.has(to=be) * syntactically[valid] # Right! Stop that! It's SILLY!

Extras

Michael:

Joke: Developer/maker, what’s my purpose?

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with us

Join us on YouTube at pythonbytes.fm/stream/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.

Brian #1: PEP 703 - Making the GIL Optional in CPython

  • Author: Sam Gross
  • Sponsor: Łukasz Langa
  • Draft status, but on Standards Track, targeting Python 3.12
  • Suggested by: Will Shanks
  • “The GIL is a major obstacle to concurrency.” Especially for scientific computing.
  • PEP 703 proposes adding a --without-gil build configuration to CPython to let it run code without the global interpreter lock and with the necessary changes needed to make the interpreter thread-safe.
  • PEP includes several issues with GIL and sckikit-learn, PyTorch, Numpy, Pillow, and other numerically intensive libraries.
  • Python’s GIL makes it difficult to use modern multi-core CPUs efficiently for many scientific and numeric computing applications.
  • There’s also a section on how the GIL makes many types of parallelism difficult to express.
  • Changes primarily in internals, and not much exposed to public Python and C APIs:
    • Reference counting
    • Memory management
    • Container thread-safety
    • Locking and atomic APIs
  • Includes information on all of these challenges.
  • Distribution
    • C-API extension authors will need access to a --without-gil Python to modify their projects and supply --without-gil versions.
    • Sam is proposing “To mitigate this, the author will work with Anaconda to distribute a --without-gil version of Python together with compatible packages from conda channels. This centralizes the challenges of building extensions, and the author believes this will enable more people to use Python without the GIL sooner than they would otherwise be able to.”

Michael #2: FerretDB

  • Via Jon Bultmeyer
  • A truly Open Source MongoDB alternative
  • MongoDB abandoned its Open-Source roots, changing the license to SSPL making it unusable for many Open Source and Commercial Projects.
  • The core of our solution is a stateless proxy, which converts MongoDB protocol queries to SQL, and uses PostgreSQL as a database engine.
  • FerretDB will be compatible with MongoDB drivers and will strive to serve as a drop-in replacement for MongoDB 6.0+.
  • First release back in Nov 2022
  • I still love you MongoDB ;)

Brian #3: Four tips for structuring your research group’s Python packages

  • David Aaron Nicholson
  • Not PyPI packages, but, you know, directories with __init__.py in them.
  • Corrections for mistakes I see frequently
    • Give your packages and modules terse, single-word names whenever possible.
    • Import modules internally, instead of importing everything from modules.
    • Make use of sub-packages.
    • Prefer modules with very specific names containing single functions over modules with very general names like utils, helpers, or support that contain many functions.

Michael #4: Quibbler

  • Quibbler is a toolset for building highly interactive, yet reproducible, transparent and efficient data analysis pipelines.
  • One import statement and matplotlib becomes interactive.
  • Check out the video on the repo page.

Extras

Brian:

Michael:

Joke: Testing the programJoke: Every Cloud Architecture

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Michael #1: StackOverflow 2022 Developer Survey

  • Last year we saw Git as a fundamental tool to being a developer. This year it appears that Docker is becoming a similar fundamental tool for Professional Developers, increasing from 55% to 69%.
  • Language: Rust is […] the most loved language with 87% of developers saying they want to continue using it.
  • JS Frameworks: Angular.js is in its third year as the most dreaded.
  • Let me Google that for you: 62% of all respondents spend more than 30 minutes a day searching for answers or solutions to problems. 25% spending more than an hour each day.
  • The demise of the full-stack developer is overrated.
  • I do wish there were more women in the field.
  • Databases: Postgres is #1 and MongoDB is still going strong.
  • The “which web framework do you use?” question is a full on train wreck. Why is this so hard for people to write the question? Node.js or Express (built on Node) vs. FastAPI or Flask (but no Python?)
  • Most wanted / loved language is Rust (wanted) and Python/Rust tied for most wanted.
  • Worked with vs. want to work with has some interesting graphics.

Brian #2: PePy.tech - PyPI download stats with package version breakdown

  • Petru Rares Sincraian
  • We’ve discussed pypistats.org before, which highlights
    • daily downloads
    • downloads per major/minor Python version
    • downloads per OS
  • PyPy is a bit more useful for me
    • default shows last few versions and total for this major version
    • “select versions” box is editable.
      • clicking in it shows dropdown with downloads per version already there
      • you can add * for graph of total
      • or other major versions if you want to compare
    • daily/weekly/monthly is nice, to round out some noise and see larger trends
    • Oddity I noticed - daily graph isn’t the same dates as the table.
      • off by a day on both sides
      • not a big deal, but I notice these kinds of things.

Michael #3: Codon Python Compiler

  • via Jeff Hutchins and Abdulaziz Alqasem
  • A high-performance, zero-overhead, extensible Python compiler using LLVM
  • You can scale performance and produce executables, even when using third party libraries such as matplotlib.
  • It also supports writing and executing GPU kernels, which is an interesting feature.
  • See how it works at exaloop.io
  • BTW, really terrible licensing.
    • Free for non-commercial (great)
    • “Contact us” for commercial use (it’s fine to charge, but give us a price)

Brian #4: 8 Levels of Using Type Hints in Python

  • Yang Zhou (yahng cho)
  • A progression of using type hints that seems to track how I’ve picked them up
  1. Type Hints for Basic Data Types.
    • x: int
  2. Define a Constant Using Final Type
    • DB: Final = '``PostgreSQL'
    • (ok. I haven’t used this one at all yet)
  3. Adding multipe type hints to one variable.
    • int | None
  4. Using general type hints.
    • def func(nums: Iterable)
    • Also using Optional
  5. Type hints for functions
    • def func(name: str) → str:
    • (I probably would put this at #2)
  6. Alias of type hints (not used this yet, but looks cool)PostsType = dict[int, str]

    new_posts: PostsType = {1: 'Python Type Hints', 2: 'Python Tricks'}

  7. Type hints for a class itself, i.e. Self typefrom typing import Self

    class ListNode: def __init__(self, prev_node: Self) -> None: pass

  8. Provide literals for a variable. (not used this yet, but looks cool)from typing import Literalweekend_day: Literal['Saturday', 'Sunday']weekend_day = 'Saturday'weekend_day = 'Monday' # will by a type error

Extras

Brian:

  • I hear a heartbeat for Test & Code, so it must not be dead yet.

Michael:

Joke: vim switch

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts


Hi folks. For our final episode of 2022 here on Python Bytes, we're crossing the streams with my other show, Talk Python To Me.

I present to you one of the more important episodes of the year, the release ofPython 3.11 with it's new features and 40% performance improvements.

Thank you for listening to Python Bytes in 2022, have a great holiday break,and Brian and I will see you next week.


Python 3.11 is here! Keeping with the annual release cycle, the Python core devs have released the latest version of Python. And this one is a big one. It has more friendly error messages and is massively faster than 3.10 (between 10 to 60% faster) which is a big deal for a year over year release of a 30 year old platform.

On this episode, we have Irit Katriel, Pablo Galindo Salgado, Mark Shannon, and Brandt Bucher all of whom participated in releasing Python this week on the show to tell us about that process and some of the highlight features.

Guests

Resources from the show

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Michael #1: Jupyter Server 2.0 is released!

  • Jupyter Server provides the core web server that powers JupyterLab and Jupyter Notebook.
  • New Identity API: As Jupyter continues to innovate its real-time collaboration experience, identity is an important component.
  • New Authorization API: Enabling collaboration on a notebook shouldn’t mean “allow everyone with access to my Jupyter Server to edit my notebooks”. What if I want to share my notebook with e.g. a subset of my teammates?
  • New Event System API: jupyter_events—a package that provides a JSON-schema-based event-driven system to Jupyter Server and server extensions.
  • Terminals Service is now a Server Extension: Jupyter Server now ships the “Terminals Service” as an extension (installed and enabled by default) rather than a core Jupyter Service.
  • pytest-jupyter: A pytest plugin for Jupyter

Brian #2: Converting to pyproject.toml

  • Last week, episode 314, we talked about “Tools for rewriting Python code” and I mentioned a desire to convert setup.py/setup.cfg to pyproject.toml
  • Several of you, including Christian Clauss and Brian Skinn, let me know about a few tools to help in that area. Thank you.
  • ini2toml - Automatically translates .ini/.cfg files into TOML
    • “… can also be used to convert any compatible .ini/.cfg file to TOML.”
    • “ini2toml comes in two flavours: “lite” and “full”. The “lite” flavour will create a TOML document that does not contain any of the comments from the original .ini/.cfg file. On the other hand, the “full” flavour will make an extra effort to translate these comments into a TOML-equivalent (please notice sometimes this translation is not perfect, so it is always good to check the TOML document afterwards).”
  • pyproject-fmt - Apply a consistent format to pyproject.toml files
    • Having a consistent ordering and such is actually quite nice.
    • I agreed with most changes when I tried it, except one change.
      • The faulty change: it modified the name of my project. Not cool.
      • pytest plugins are traditionally named pytest-something.
        • the tool replaced the - with _. Wrong.
        • So, be careful with adding this to your tool chain if you have intentional dashes in the name.
      • Otherwise, and still, cool project.
  • validate-pyproject - Automated checks on pyproject.toml powered by JSON Schema definitions

    • It’s a bit terse with errors, but still useful.
       $ validate-pyproject pyproject.toml Invalid file: pyproject.toml [ERROR] project.authors[{data\_\_authors\_x}] must be object $ validate-pyproject pyproject.toml Invalid file: pyproject.toml [ERROR] Invalid value (at line 3, column 12)
  • I’d probably add tox

    • Don’t forget to build and test your project after making changes to pyproject.toml
    • You’ll catch things like missing dependencies that the other tools will miss.

Michael #3: aws-lambda-powertools-python

  • Via Mark Pender
  • A suite of utilities for AWS Lambda Functions that makes distributed tracing, structured logging, custom metrics, idempotency, and many leading practices easier
  • Looks kinda cool if you prefer to work almost entirely in python and avoid using any 3rd party tools like Terraform etc to manage the support functions of deploying, monitoring, debugging lambda functions- Tracing: Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
  • Logging - Structured logging made easier, and decorator to enrich structured logging with key Lambda context details
  • Metrics - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
  • Event handler: AppSync - AWS AppSync event handler for Lambda Direct Resolver and Amplify GraphQL Transformer function
  • Event handler: API Gateway and ALB - Amazon API Gateway REST/HTTP API and ALB event handler for Lambda functions invoked using Proxy integration
  • Bring your own middleware - Decorator factory to create your own middleware to run logic before, and after each Lambda invocation
  • Parameters utility - Retrieve and cache parameter values from Parameter Store, Secrets Manager, or DynamoDB
  • Batch processing - Handle partial failures for AWS SQS batch processing
  • Typing - Static typing classes to speedup development in your IDE
  • Validation - JSON Schema validator for inbound events and responses
  • Event source data classes - Data classes describing the schema of common Lambda event triggers
  • Parser - Data parsing and deep validation using Pydantic
  • Idempotency - Convert your Lambda functions into idempotent operations which are safe to retry
  • Feature Flags - A simple rule engine to evaluate when one or multiple features should be enabled depending on the input
  • Streaming - Streams datasets larger than the available memory as streaming data.

Brian #4: How to create a self updating GitHub Readme

Extras

Brian:

Michael:

Joke: What are clouds made of?

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Brian #1: FAQtory

  • Will McGugan
  • “FAQtory is a tool to auto-generate a FAQ.md (Frequently Asked Questions) document for your project.
  • FAQtory has a FAQ.md written by itself, so you can see an example of the project in the project.
  • Builds a markdown FAQ.md that includes questions at the top that link to answers below.
  • “Additionally, a ‘suggest’ feature uses fuzzy matching to reply to GitHub issues with suggestions from your FAQ.”
    • I haven’t tried this part, but looking forward to it.
    • May help to answer GH issues that are really questions.

Michael #2: Kagi search "live with it” report

  • Still enjoying it a lot
  • Very fast
  • LOVE blocking SEO-heavy, content-light sites
  • Maps are rough around the edges
  • Not obvious how to set as a private/incognito search engine (but can be done in settings)
  • They have browser extensions - but I don't want to install extensions
    • I only use 1password & zoom
  • It could use some documentation however (e.g. supports !’s, but what are they?)
  • Being tempted by Orion too, but sticking with Vivaldi.

Brian #3: Tools for rewriting Python code

  • Luke Plant
  • A collection of tools change your code (hopefully for the better)
  • Several categories
    • formatting and coding style - black, isort, …
    • upgrades - pyupgrade, flynt, …
      • we need one to convert from setup.py/setup.cfg to pyproject.toml
    • type hints - auto type hints? cool. maybe.
      • I haven’t tried any of these, but they look interesting
    • refactoring, editors, rope, jedi
    • other - autoflake, shed, …
    • write your own, with LibCST

Michael #4: Socketify

  • Bringing WebSockets, Http/Https High Performance servers for PyPy3 and Python3
  • A new record for Python no other Web Framework as able to reach 6.2 mi requests per second before in @TFBenchmarks 🥇 🏆
  • This puts Python in the same ballpark than #golang, #Rust and #C++.

Extras

Brian:

  • watching mousebender from Brett Cannon
    • BTW, releases watching is cool. Probably a decent reason to use GH releases feature.
  • Python Developer’s Guide has a visual of the Python Versions and release cycle.

Michael:

Joke: Wise guy, eh?

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

Michael #1: How do you say that number?

  • Inflect: fosstodon.org/@linuxgal@techhub.social/109430499504962727
  • Num2Words: pypi.org/project/num2words/

    # Inflect:import inflectinflector=inflect.engine()print(inflector.number_to_words(8675309))# eight million, six hundred and seventy-five thousand, three hundred and nine# Num2Wordsfrom num2words import num2wordsprint(num2words(8675309))# eight million, six hundred and seventy-five thousand, three hundred and nine
  • Num2Words also has a CLI:

  • pipx install num2words
  • $ num2words 2948475
  • two million, nine hundred and forty-eight thousand, four hundred and seventy-five

Brian #2: The Origins of Python

  • Lambert Meertens
  • A wonderful tale starting with TELCOMP, traveling through ABC, and finally reaching Python.
  • This is a long article, but a wonderful story.
  • It includes a nice emphasis at all times to keep a language simple enough for the absolute beginner but powerful enough to not be annoying for experienced developers.
  • A few quotes from the article:
    • “Ease of learning and ease of use are both desirable attributes in any programming language. Nonetheless, I have often felt that this aspect of language design does not always receive the attention it deserves. And what may seem easy to a designer may not necessarily be easy for a language learner.”
    • Regarding ABC: “To serve our intended users, absolute beginners, we sought to hide low-level implementation details and instead to provide powerful high-level, task-oriented features.
    • Then Python: “The growth in popularity of Python, from its inception thirty years ago as a one-person effort flying under the radar, has been phenomenal, but not meteoric. Instead it has been a long, slow, and steady rise. Python’s ease of learning gave it a competitive advantage in a period when there was a perpetual need for more programmers. Its clean syntax and semantics make it easier to maintain a software base written in Python than other languages—an important consideration given that the cost of maintaining software dwarfs the cost of creating new software.”

Kelly #3:

  • Ozobot Evo Introduces a Python Beta Version. (August 17, 2022)
  • The original Ozobot model – the Ozobot Bit – is no longer available for purchase . The New Evo Ozobit- has three Kit options. The Entry Kit (single robot), the Ozobot Evo 12-Pack, and the Ozobot Evo 18-Pack.
  • https://beta.python.ozobot.com/doc-python-api/ozobot.html#module-0
  • Still has the updated OzoBlockly platform for Block Programming.
  • This tiny bot comes with:
    • Line following
    • Color detection
    • Sound
    • proximity sensor
    • bluetooth
    • Crash detection
    • Students can even code functions
  • Ozobot simulator(block) https://games.ozoblockly.com/shapetracer-freeform
  • Web beta app: beta.python.ozobot.com

Michael #4: setproctitle

  • A Python module to customize the process title

  • Awesome for servers and anytime “python” is not enough

  • Easy to use directly:

  • from setproctitle import setproctitle

  • setproctitle("tp-search daemon")

  • Used automatically by servers like uwsgi and gunicorn I believe.

    ### # uWSGI server configuration###[uwsgi]# uWSGI provides some functionality which can help identify the workersprocname-prefix = training-auto-procname = true
  • Some nice results, example from Talk Python Training

Brian #5: Looking forward to Python 3.12

  • New features in 3.12a2
    • Improved Error Messages
    • lots of other goodies, like pathlib.walk().
  • Release scheduled for Oct 2023
  • But why wait? Start testing your projects with it now: Testing with Python 3.12
  • Note that “During the alpha phase, features may be added up until the start of the beta phase (2023-05-08) and, if necessary, may be modified or deleted up until the release candidate phase (2023-07-31). Please keep in mind that this is a preview release and its use is not recommended for production environments.”
  • Actually, with that note, you might want to wait. I don’t. I’ll deal with it when/if I get a failure.

Sean #6: Re:Invent 2022 EF Education Breakout

  • Presentation at AWS Re:Invent 2022
  • Complete redesign of online learning platform by one of the largest education companies in the world
  • We’ve all seen Zoom classrooms with rows on rows of students
  • A more immersive experience for learning with green screens, digital sets, and props
  • Massive amount of analytics around student engagement and learning, including full transcription of every student, engagement tracking, and computer vision

Extras

Michael:

  • You can support the PSF if you’re selling things on EBay. Check “Donate a portion to charity” and choose “Python Software Foundation” via Joe Riedley
  • Textinator for Windows (the Windows version of TextSniper)
  • Paperlike for iPad

Kelly: A new Special Interest Group for the PSF launched 6 days ago. “Edu-sig, through its mailing list, provides an informal venue for comparing notes and discussing future possibilities for Python in education.” Led by Timothy Wilson.

Sean:

Jokes:

fosstodon.org/@kimvanwyk/109389398652030679

And a new mastodon user:

fosstodon.org/@vruz@mastodon.social/109394538570819699

Feature Comparison

View Details

Watch on YouTube

About the show

Sponsored by Complier Podcast from RedHat

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org

Brian #1: Coping strategies for the serial project hoarder

  • Simon Willison
  • Also a talk from DjangoCon2022
    • Massively increase your productivity on personal projects with comprehensive documentation and automated tests.
  • I’m actually not sure what title would be best, but this is an incredible video that I’m encouraging every developer to watch, whether or not you work with open source projects.
  • Covers
    • The perfect commit
      • Implementation, Tests, Documentation, and a link to an issue thread
    • Tests
      • Prove the implementation works, pass if it works, fails otherwise
      • A discussion of how adding tests is way easier than starting testing a project, so get the framework in place early, and devs won’t be afraid to add to it.
    • Cookiecutter repo templates for projects you will likely start
      • super cool idea to have your own that you keep up to date with your preferred best practices
    • A trick for using GitHub actions to use those templates to populate new repos
      • Trying this out is on my todo list
    • Documentation must live in the same repo as the code
      • and be included in PRs for the PR to be accepted by code review
      • maybe even test this using documentation unit tests
    • Everything links to an issue thread
      • Keep all of your thoughts in an issue thread
      • Doesn’t have to be a dialog with anyone but yourself
      • This allows you to NOT HAVE TO REMEMBER ANYTHING
    • Tell people what you did
      • This is just as important in work projects as it is in open source
      • Blog about it
      • Post on Twitter (or Mastodon, etc.)
    • Avoid side projects with user accounts
      • “If you build something that people can sign into, that’s not a side-project, it’s an unpaid job. It’s a very big responsibility, avoid at all costs!” - this is hilarious and something I’m probably not going to follow

Michael #2: GitHub copilot lawsuit

  • First, we aren’t lawyers
  • Lawsuit filed on November 3, 2022
  • We’ve filed a lawsuit challenging GitHub Copilot, an AI product that relies on unprecedented open-source software piracy.
  • GitHub copilot is trained on projects on GitHub, including GPL and other restrictive licenses
  • This is the first class-action case in the US challenging the training and output of AI systems.

Brian #3: Use Windows Dialog Boxes from Python with no extra libraries

  • Actual title: Display a message box with Python without using a non-standard library or other dependency (Windows)
  • By Matt Callahan / learned about from from PyCoders weekly
  • When I need a simple pop up dialog box that’s cross platform, PySimpleGUI is awesome and so easy.
  • But when I KNOW it’s only going to run on Windows, why not just use native dialog boxes?
  • Matt’s article shows you how, using ctypes to call into a Windows dll.
  • Small example from article:

``` import ctypes

def main():
    WS_EX_TOPMOST = 0x40000
    windowTitle = "Python Windows Message Box Test"
    message = "Hello, world!"
    # display a message box; execution will stop here until user acknowledges
    ctypes.windll.user32.MessageBoxExW(None, message, windowTitle, WS_EX_TOPMOST)
    print("User clicked OK.")

if __name__ == "__main__":
    main()

``` * Notes:

+ The uType (fourth) parameter is a multi-use value that can be or-ed for things like:
    - Type of dialog box: Help, OK, OK/Cancel, Retry/Cancel, Yes/No, etc.
    - The icon to use: Exclamation, Info, Question, etc.
    - Modality, …
+ Return value is used to understand how user reacted:
    - 1 - OK, 2 - Cancel (or x), …, 6 - Yes, 7 - No, …

Michael #4: Extra Extra Extra

  • Python browser extensions
  • takahe - Mastodon on Python - the right way
  • Michael’s article in Black Friday perf
    • We could scale down our server after what I’ve learned. But we’d pay 10x more in bandwidth overages ironically: Last month Talk Python broadly transferred 20.2 TB of data from our servers
  • Moved our static traffic to Bunny CDN, highly recommended service
  • RSS revival
    • My blog: mkennedy.codes
    • Reeder 5 app on iOS and macOS
  • Rivers Cuomo (from Weezer) and Guido sit down for a talk together
    • Also check out the Talk Python episode with Rivers: talkpython.fm/327
  • Kite is saying farewell

View Details

Watch on YouTube

About the show

Python Bytes 311 Sponsored by Microsoft for Startups Founders Hub.

Connect with the hosts

  • Michael: @mkennedy@fosstodon.org
  • Brian: @brianokken@fosstodon.org
  • Special guest: Murilo Cunha

Michael #1: Latexify

  • We are used to turning beautiful math into programming symbols.
  • For example: amitness.com/2019/08/math-for-programmers/#sigma
  • Take this code: def do_math(a, b, c): return (-b + math.sqrt(b ** 2 - 4 * a * c)) / (2 * a)
  • Add @latexify.function decorator
  • display do_math in a notebook
  • Get this latex: \mathrm{do_math}(a, b, c) = \frac{-b + \sqrt{b^{{2}} - {4} a c}}{{2} a}
  • Which renders as
  • I could only get it to install with: pip install git+https://github.com/google/latexify_py

Brian #2: prefixed

  • From Avram Lubkin
  • “Prefixed provides an alternative implementation of the built-in float which supports formatted output with SI (decimal) and IEC (binary) prefixes.”

```

from prefixed import Float f'{Float(3250):.2h}' '3.25k' '{:.2h}s'.format(Float(.00001534)) '15.34μs' '{:.2k}B'.format(Float(42467328)) '40.50MiB' f'{Float(2048):.2m}B' '2.00KB'

``` * Because prefixed.Float inherits from the built-in float, it behaves exactly the same in most cases. * When a math operation is performed with another real number type (float, int), the result will be a prefixed.Float instance. * also interesting + First new SI prefixes for over 30 years + new prefixes also show up here

Murilo #3: dbt

  • Open source tool
  • CLI tool
  • Built with Python 🐍
  • Applies “best practices” to SQL projects
  • Combines git + .sql files + jinja
  • Support many data platforms
  • Let’s you
    • Template SQL queries
      • Including loops
    • Execute DAGs
    • Data validation
    • Easily build docs (data lineage, visualize DAGs, etc.)
  • Now you can also run Python models
    • Useful if there’s a convenient python function for your data transformation or some more complex logic (i.e.:fuzzy string matching, machine learning models, etc.)
    • Available for Snowflake, Databricks, BigQuery
    • dbt’s coalesce’s announcement https://www.youtube.com/watch?v=rVprdyxcGUo

Michael #4: Memray pytest plugin

  • pytest-memray is the pytest plugin for, well, memray. :)
  • You can ensure that not too much memory is used with @pytest``**.**``mark``**.**``limit_memory``**(**``"24 MB"``**)**
  • And you get an allocation report with pytest --memray file.py
  • But coming soon, we’ll have memory leak checking too.

``` @pytest.mark.check_leaks() def test_foobar(): # Do some stuff and ensure # it does not leak memory pass

```

Brian #5: Stealing Open Source code from Textual

  • Will McGugan
  • Will reminds us of one of the great benefits of open source code, stealing code
    • (when allowed by the license, of course)
  • Goes as far as to point out some bits of textual that you might want to lift
    • looping with indication of when you’ve hit the first or last item
    • a LRUCache with more flexibility than lru_cache
    • a Color class with conversions for css, hex, monochrome, hsl
    • 2d geometry

Murilo #6: Shed

  • Superset of black
  • "shed is the maximally opinionated autoformatting tool. It's all about convention over configuration, and designed to be a single opinionated tool that fully canonicalises my code - formatting, imports, updates, and every other fix I can possibly automate.”
  • Also format code snippets in docstrings, markdown, restructured text
  • No configuration options
  • pre-commit hooks available
  • Bundles together:
    • black
    • isort
    • autoflake
    • pyupgrade
    • blacken-docs

Extras

Brian:

  • pytest-check (version 1.1.3) changes now live
    • New README, hopefully makes it clear how to use.
    • Use check from
      • from pytest_check import check
      • or from the check fixture: def test_foo(check): …
    • Either form returns the same object.
    • From that check object, you can
      • use helper functions like check.equal(a, b), etc.
      • use it as a context manager, with check: assert a == b
      • even grab the raises context manager: with check.raises(Exception): …
    • Intended to be backwards compatible
      • although some old use cases might be deprecated/removed in the future.

Michael:

  • New YouTube Video: Best Native App for Mastodon is ...
  • Nearly 50% of macOS malware comes from one app — do you have it on your MacBook?
  • PyCascades CfP
  • A fresh take on blogging (for Michael): mkennedy.codes
    • Based on Hugo - which is so good.
    • Hosted on netlify.com

Murilo:

  • mastodon.py - a Python wrapper around Mastodon’s API
  • Nice notebook diffs in Github PRs 🚀
  • flake8 is not on Gitlab anymore
  • Who’s gonna win the world cup?
  • lancer

Joke:

  • Messing with the algorithm
  • Let’s start this one with some history
  • Recusion joke

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Special guest:

  • Adam Hopkins
  • Python Web Development with Sanic

Brian #1: Tips for clean code in Python

  • Bob Belderbos
  • Generally some great tips to think about to keep code maintainable:
    • Smaller units. Break things up into single responsibility. SRP: Single Responsibility Principle
    • Move magic numbers into constants or parameters.
    • Avoid global scope. (even though it’s not really global)
    • Use linters and auto-formatters.
    • Use very narrow try/except blocks.
    • Idiomatic Python. (Although I agree, this is a weird one as it’s hard for new people to follow).
    • Pay attention to data structure choice and learn to utilize standard structures and those in collections.
    • Use the standard libary.
    • Use mappings
    • Flat is better than nested.
  • But I’m gonna focus on the “smaller units” because it applies to modules as well.
    • Try to keep modules organized such that you can keep relevant and related code concepts in your head.

Michael #2: Mastodon is picking up speed

  • @pythonbytes@fosstodon.org
  • @mkennedy@fosstodon.org
  • @brianokken@fosstodon.org
  • @admhpkns@fosstodon.org
  • I’m calling this a “Mastodon First” strategy rather than “Let’s burn down Twitter and scatter”
  • Just did a Talk Python about it
  • Money in mouth: I became a patreon of Fosstodon and Mastodon’s company
  • Mastodon is open source, find it here
  • Twitter’s potential collapse could wipe out vast records of recent human history
  • Python’s API for Mastodon: toot
  • Download a proper Twitter archive with this Python script
  • Integrated the API into stream deck
  • You can install it as a PWA:

Adam #3: Correction to Sanic Worker Manager in v22.9

  • Episode #308 covered a recent article published on a new feature in Sanic v22.9
  • Blog article: Pushing work to the background of your Sanic app
  • The segment focused on the celery-like job queue in Sanic
  • Clarification:
    • Goal of the feature is to bring a consistent development experience from dev thru prod
    • Enables usage of multiprocessing-safe shared objects
    • Simple pattern for managing multiple long-running processes
  • Release notes for Sanic v22.9
  • Sanic documentation on the Worker Manager

Brian #4: Some FastAPI news, and some great READMEs.

  • FastAPI 0.87.0 has some interesting notes
    • Upgraded Starlette, which includes TestClient based on HTTPX instead of Requests
    • Since that might break some peoples use of TestClient, someone named Kludex built bump-testclient to help automatically convert test code to the new interface. That’s so cool!
    • Use Ruff for linting
    • Add a Help Maintain FastAPI section to the docs that emphasizes that it’s super helpful to:
      • Help others with issues
      • Review PRs
      • Both of those sections have other expanded sections to describe what that means.
    • The FastAPI commitment to great documentation is amazing and worth emulating.
    • It also has a really good README.
      • Interesting sponsors section. Cool way for a popular project to get maintenance funding.
      • Testimonials. It’s like a sales landing page, which really, a README kinda is.
      • Other common good practices and cool items
        • Images
        • Some use of collapsable sections.
  • Other notable READMEs
    • pytest
      • short example right away to show how simple it can be to use.
    • textual and rich
      • great use of images and short examples
      • highlighting often missed features, such as pretty and inspect
      • Utilizing expandable/collapsable sections for longer examples
    • httpx
      • like pytest, shows a small example quickly,
      • redirects many other sections to more thorough docs.

Michael #5: Closevember

  • An annual event focused on sustainable open source development practices and maintainer well-being.
  • Let's support open source maintainers by helping them close issues and pull requests throughout November.
  • Over at closember.org
  • Contributing to a project carries a number of responsibilities, in order to make it as easy as possible for a project to receive that contribution.
  • For Maintainers: How to Get Ready (see site)
    • If you only want assistance with closing some issues and PRs, then tag your repo with closember and you’re all set.
    • One thing that we often find helpful is to declutter our physical and digital environment: tidying our desks a bit, decluttering our computers’ desktops, unsubscribing from some email lists ... that sort of thing.
    • I did this this month actually. Spent 6 hours completely rebuilding my desk to have zero wires and look tidy and clean (hint: 3m of industrial velcro and things stuck upside down) and formatted my computer to a fresh OS after two years.
  • For the Community: How to Participate (see site)
    • If you’ve never used GitHub before, your first step is going to be signing up for a free account.
    • Also, if you’re super new to git: talkpython.fm/git
    • If you’ve opened issues or PRs on projects in the past, you can start by taking a look at your own GitHub issues and your own PRs to see if any of them are outdated or have already been fixed—if so, close them!
    • After that, start browsing projects: take a look at your favorite projects and see if they’ve been tagged with closember, or browse the list of closember projects.
  • Check out the close boards (on the site)

Adam #6: Super simple “Cache with async power” using Cashews

  • Recently popped up in my GitHub Explore
    • Cashews: Async cache framework with simple API to build fast and reliable applications
  • Super simple out-of-the-box API
    • supports in memory, Redis, DiskCache (local sqlite)
    • one-line setup then implemented as a decorator
    • Human-friendly TTL values: example “3h”
  • Client-side caching - For example, if you are using Redis backend you do not need to make a network call on every cache request
  • Strategies for common cache issues
    • cache hits, early recalculation, soft TTL, resource locking, rate limiting!, circuit breaker
  • Has its own interface for middleware

Extras

Michael:

  • Take the PSF survey

Adam:

  • Voting season is upon us: Python Steering Council nominations are open

Joke: JavaScript has been Banned from Twitter

View Details

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael: #0: Python Bytes is 6 years old this week. Thank you! 🎉

Michael #1: Malicious proof-of-concepts are exposing GitHub users to malware and more

  • The paper
  • They found that of the 47,313 GitHub repositories they had downloaded and checked, 4,893 (10.3%) were malicious.
  • In some the attackers were trying to plant malware on users’ machines, while in others, they tried to open backdoors using CobaltStrike, for example
  • Ignoring this problem can cause damage that ranges from infecting yourself as [a] user, to infecting your company and likely your customers as well if it’s a more sophisticated attack,” El Yadmani warned.
  • Languages
    • Ruby 379
    • Go 400
    • JavaScript 548
    • Shell 652
    • C++ 962
    • Java 1071
    • C 1686
    • Python 8305
    • Undetected 31858
  • Example Python exfile script included in the paper

Brian #2: The great Mastodon experiment

  • Context should be obvious re Twitter news.
  • A lot of Python people have kept in touch via Twitter.
  • A lot are now experimenting with Mastadon,
  • What I did
    • asked Twitter people which server to use, then just picked fosstodon.org, but there are many servers
    • This is me: @brianokken@fosstodon.org
    • Michael got in too: https://fosstodon.org/@mkennedy
    • just started using it, following people, trying iOS clients, etc.
  • Now I’m ready for some tutorials, and here’s a list that looks decent:
    • An Increasingly Less-Brief Guide to Mastodon
    • Everything I know about Mastodon
      • A hastily written guide for data science folks trying to navigate the fediverse.
    • Mastodon is just blogs - Simon Willison is running his own server.
    • Eight Mastodon apps for iPhone - I’m currently trying like 4, but you can also just log into your sever and do everything there.
    • Fedi.Tips and their Beginners Start Here page

Michael #3: Gitpod and the traveling dev

  • Gitpod is an open-source Kubernetes application for ready-to-code developer environments that spins up fresh, automated dev environments for each task, in the cloud, in seconds.
  • Gitpod is paid, but there are decent free tiers
  • Features
  • Run a desktop or browser based version of VS Code or any JetBrains IDE and customise it to your individual needs - from themes to extensions, you have full control.

Brian #4: Color in the terminal

  • pytest-check currently doesn’t use color
    • but a little red for failures would be good (and was requested via an issue)
  • I could use rich, but maybe that’s a slightly larger hammer than I need for this job
  • Maybe raw escape sequences like print('\033[31m' + 'some red text')
    • kinda gross
    • won’t work out of the box on Windows.
  • But colorama can fix Windows.

    • It just recently added just_fix_windows_console(), which apparently works better than init() in that it can be called multiple times without blowing up.
    • Includes easier to read codes for some basic colors, so this works:

    ``` from colorama import just_fix_windows_console from colorama import Fore, Style just_fix_windows_console()

    print(Fore.RED + 'some red text')
    print(Style.RESET_ALL)
    print('back to normal now')
    

    ```

Extras

Brian:

  • Simon Willison wrote What to blog about, which includes
    • TIL (today I learned) posts that don’t need to be full tutorials
    • Projects you’ve built
  • I’d like to include
    • Projects in progress
    • Bug fixes or feature additions where you needed to learn a bit of something beforehand
      • Example: I should write up “Adding red to pytest-check”

Michael:

  • Beanie reorg: There is no sync version here more. Please use Bunnet instead
  • https://twitter.com/nicholdav/status/1589643652598759424 ?
  • PyCon Days Breakdown
  • Been playing with GeForce now, really impressive. Meanwhile, why is google still selling stadia?
  • New video: A Walrus Meets a Python - What is the := Walrus Operator?
  • New video: Python GC Settings - Change This and Go 20% Faster!

Joke:

  • Relaxation
  • Relax to it on YouTube: youtube.com

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Complier Podcast from RedHat

Michael #0: New livestream time - 11am PT on Tuesdays. Also, subscribe to the youtube channel and “hit the bell” to get notified of all the live streams.

Brian #1: It’s PyCon US 2023 CFP time

  • Will be held in Salt Lake City, Salt Palace Convention Center
  • Talks are Friday - Sunday, April 19-23
  • PyCon US 2023 launch announcement
  • PyCon 2023 site features images taken from past PyCon artwork
  • Call for proposals open until Dec 9, but please don’t wait that long.

Michael #2: Any.io

  • AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio or trio. It implements trio-like structured concurrency (SC) on top of asyncio.
  • Cool interpretability between native threads and asyncio
  • Using subprocesses: AnyIO allows you to run arbitrary executables in subprocesses, either as a one-shot call or by opening a process handle for you that gives you more control over the subprocess.
  • Async file I/O: AnyIO provides asynchronous wrappers for blocking file operations. These wrappers run blocking operations in worker threads.
  • Cool synchronization primitives too.
  • Catch the Talk Python episode with Alex: talkpython.fm/385

Brian #3: How to propose a winning conference talk

  • Reuven Lerner
  • Some nice tips and advice
  • Build a list of topics
    • If you train, teach, mentor, lead, or coach already:
      • what questions to people always ask you?
      • what knowledge would help people to have?
      • where do people seem to just “not get it”?
    • If you don’t train or teach, then maybe hit up Stack Overflow…
    • From Brian: I think you can imagine yourself a year or two ago and think about stuff you know now you wish you knew then and could learn faster.
  • Build an outline with times
    • This part often seems scary, but Reuven’s example is 10 bullets with (x min) notes.
  • Write up a summary. One short, one longer.
    • Indicate who will benefit, what they will come out knowing, and how it will help them.
  • Propose to multiple conferences. Why not?
  • Practice
  • (from Brian: Even if you get rejected, you’ve gained. Turn it into a youTube video or blog post or both.)

Michael #4: Sanic release adds background workers

  • via Felix
  • In v22.9 (go cal-ver!), the main new feature is the worker process management - the main Sanic process handles a pool of workers.
  • They are normally used for handling requests but you can also use them to handle background jobs and similar things. You could probably use it for a lot of the reasons people turn to something like Celery.
  • The lead developer (Adam Hopkins) has written a blog post about this feature.
  • MK: Sanic has been flying a bit under my radar. Maybe time to dive into it a bit more.

Extras

Brian:

  • Create Presentation from Jupyter Notebook
    • Cool walkthrough of how to use the built in slideshow features of Jupyter Notebooks.
  • pytest 7.2.0 is out
    • No longer depends on the py library. So if you do, you need to add it to your dependencies.
    • nose officially deprecated, which includes setup() and teardown(). Really glad I dropped the “x unit” section on the 2nd edition of the pytest book.
    • testpaths now supports shell-style wildcards
    • Lots of other improvements. check out the change log

Michael:

  • Rich on pyscript (via Matt Kramer)
  • Python 3.11 in 100 seconds video from Michael

Joke: Deep questions & Relationship advice from geeks

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #1: Python 3.11 is released

  • Live stream of the actual release procedure
  • Talk Python episode coming next week (live stream on Friday)
  • Major new features of the 3.11 series, compared to 3.10
  • General changes
    • PEP 657 -- Include Fine-Grained Error Locations in Tracebacks
    • PEP 654 -- Exception Groups and except*
    • PEP 680 -- tomllib: Support for Parsing TOML in the Standard Library
    • gh-90908 -- Introduce task groups to asyncio
    • gh-34627 -- Atomic grouping ((?>...)) and possessive quantifiers (*+, ++, ?+, {m,n}+) are now supported in regular expressions.
    • The Faster CPython Project is already yielding some exciting results. Python 3.11 is up to 10-60% faster than Python 3.10. On average, we measured a 1.22x speedup on the standard benchmark suite. See Faster CPython for details.
  • Typing and typing language changes
    • PEP 673 -- Self Type
    • PEP 646 -- Variadic Generics
    • PEP 675 -- Arbitrary Literal String Type
    • PEP 655 -- Marking individual TypedDict items as required or potentially-missing
    • PEP 681 -- Data Class Transforms

Brian #2: Installing Python 3.11 on Mac or Windows

  • pythontest.com
  • I wrote this up because there are lots tutorials with weird instructions.
  • For most people, I think the right answer is to use the python.org installer.
  • It just works.
  • One change, for Windows: Use “Advanced Options” and select “Add Python to environment variables”.
  • The default process:
    • allows multiple versions, like 3.7, 3.10, 3.11, to all live side by side.
    • allows tox to use all of these
    • allows you to specify which one if you want
      • python3.10, for example, on mac
      • py -3.10 on windows
    • allows you to update versions in place. Say 3.10.7 to 3.10.8, or 3.11.0 to 3.11.1 when it comes out.
  • Please, blog writers, stop recommending pyenv to novices. It’s a cool project, but it is not a project for casual users.
  • And homebrew lovers, go for it, you are not going to read my article anyway.

Michael #4: Bossie 2022 Awards

  • Notable winners
    • Wasmtime: Similar to what Node.js does for the JavaScript runtime, Wasmtime allows developers to leverage all of the advantages that WebAssembly provides inside the browser-including safe sandboxed execution, near-native performance, and support across multiple programming languages and platforms -outside the browser. (Python’s integration)
    • PyScript: One of the long-gestating promises of WebAssembly is enabling the use of languages other than JavaScript in the web browser. PyScript delivers a full Python runtime in the browser, allowing you to use Python in webpages as a full-blown scripting language.
    • Sentry: Alongside security, error and performance tracing are among the most frustratingly inevitable requirements for many apps. Cue a sigh of relief. Sentry offers an entire ecosystem of open source tools for monitoring the health of applications, services, and APIs, from the server-side API for collecting data, to a dashboard for making it manageable, to a comprehensive slew of application-side integrations.
    • nbdev: One of the dirty secrets of notebook programming, using environments like Jupyter or Google Colab, is that it produces some of the worst spaghetti code you've ever seen, with data scientists hopping from cell to cell and creating an unmaintainable mess. Some even go so far as to say that notebook programming might be as harmful as GOTO was back in the day.

Brian #5: Textual 0.2.0

  • All the cool things Will has been showing off on Twitter recently are part of the css branch.
  • This has been merged, and released as 0.2.0
  • They also held off this release until they were happy with the documentation, which includes:
    • A new tutorial that walks through a stopwatch application and everything that goes into it.
    • An in depth reference guide with fully working examples, all of which are also in github, so you can play with it directly without retyping everything.

Extras

Michael:

  • Video I created: 17x Faster Page Load in 30 minutes using Python, PyCharm, and MongoDB
  • Pandas Markets Calendar (by Ryan Sheftel)
  • Beanie adds a sync API
  • DuckDuckGo browser, exciting and disappointing
  • int() isn’t done yet
    • via Will Shanks
    • Ubuntu has decided to patch out the int limit and preserve the previous behavior on the basis that the risk factor is low and not worth breaking compatibility for. Details for Ubuntu here.

Joke: i heard you like getters

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Brian #1: Awesome pytest speedup

  • Neyts Zupan
  • A checklist of best practices to speed up your pytest suite.
  • as a talk at Plone NAMUR 2022
  • Measure first
  • Then make sure (all items have explanations)
    • Hardware is fast
      • use a faster computer
      • also try a self-hosted runner
        • seriously, a dedicated computer (or a few) for making test runs faster might be worth it. CI resources are usually slower in cloud than local, and even expensive VM farms are often slower. Try local
    • Collection is fast
      • utilize norecursedirs and specifying the location of the tests, either on the command line or with testpaths
    • PYTHONDONTWRITEBYTECODE=1 is set
      • might help
    • Built-in pytest plugins are disabled
      • try -p no:pastebin -p no:nose -p no:doctest
    • Only a subset of tests are executed
      • Especially when developing or debugging, run a subset and skip the slow tests.
    • Network access is disabled
      • pytest-socket can make sure of that
    • Disk access is disabled
      • interesting idea
    • Database access is optimized
      • great discussion here, including using truncate and rollback.
    • Tests run in parallel
      • pytest-xdist or similar
  • Then keep them fast
    • monitor test speed

Michael #2: Strive to travel without a laptop

  • Prompt from Panic for SSH on iThings
  • github.dev for an editor on iPad
  • Push to branch for continuous deployment
  • BTW, Apple could just make M1 iPads boot to macOS rather than chase silly multi windowing systems (stage manager, etc, etc)

Brian #3: Some fun tools from the previous testing article

  • hyperfine for timing the whole suite
  • pytest --``durations 10 for finding test times of slowest 10 tests
    • leave the 10 off to find times of everything, sorted
  • pyinstrument for profiling with nice tree structures
    • and how to use it with pytest
  • pytest-socket disables network calls with --disable-socket, helping to find tests that use network calls.
  • pyfakefs, a fake file system that mocks the Python file system modules. “Using pyfakefs, your tests operate on a fake file system in memory without touching the real disk.”
  • BlueRacer.io

Michael #4: Refurb

  • A tool for refurbishing and modernizing Python codebases
  • Think of it as suggesting the pythonic line of code.
  • A little sampling of what I got on Talk Python Training
    • file.py:186:25 [FURB106]: Replace x.replace("\t", " ") with x.expandtabs(1)
    • file.py:128:17 [FURB131]: Replace del x[y] with x.pop(y)
    • file.py:103:17 [FURB131]: Replace del x[y] with x.pop(y)
    • file.py:112:39 [FURB109]: Replace not in [x, y, z] with not in (x, y, z)
    • file.py:45:5 [FURB131]: Replace del x[y] with x.pop(y)
    • file.py:81:21 [FURB131]: Replace del x[y] with x.pop(y)
    • file.py:143:9 [FURB131]: Replace del x[y] with x.pop(y)
    • file.py:8:50 [FURB123]: Replace list(x) with x.copy()
  • You don’t always want the change, can suppress the recommendation with either a CLI flag or comment.

Extras

Michael:

  • Back on episode 54 in 2017 we discussed python apps in systemd daemons.
    • Multiprocessing allows for a cool way to save on server memory
    • Do the scheduled work a multiprocessing.Process
    • Here’s an example from Talk Python Training
  • Completely rewrote search UI for Talk Python courses
  • Google analytics is now illegal?
  • Fleet is finally in public preview
  • I’ll be on a JetBrains/PyCharm webcast Thursday.

Joke: Tests pass

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #0: Scorpions concert

  • Check out this short video if you're interested.

Michael #1: Pyscript 2022.09.1 is out

  • Beware of the breaking changes

Brian #2: Decorator shortcuts

  • by Ned Batchelder

Michael #3: Panel (of Holoviz) on Pyscript

  • via Marc Skov Madsen
  • Panel can now run on pyodide and pyscript with no backend server.

Brian #4: auto-walrus

  • Marco Gorelli
  • Also, a reminder about pyupgrade, mentioned on the show back in 2018
    • Especially, look at the --py38-plus through --py39-plus flags.
    • There are flags for 3.10 and 3.11, but limited testing for them.

Joke: I need a new shirt

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Compiler Podcast from RedHat

Brian #1: Ten tasty ingredients for a delicious pull request

  • on wagtail blog, from LB
  • Great tips for helping out with open source projects.
  • But even for closed source, there’s good stuff there to know for people transitioning to single person projects to working on a team.
  • The tips
    • Read the [development] instructions. The contributing guide, etc.
    • Read the issue and comments
    • Create a fresh branch for your contribution
    • Keep the changes focused
    • Write unit tests
      • also, extending tests for untested or under-tested features are a great way to contributes
    • Give your pull request a name with context
    • Reference the issue being fixed or resolved in the pull request
    • Review & fix the CI failures
    • Push to the same branch with fixes and do not open a new pull request
    • Be patient. (Article lists this as “Eagerness balanced with patience”).

Michael #2: textX

  • via Rhet Turnbull
  • textX is a meta-language for building Domain-Specific Languages (DSLs) in Python. It is inspired by Xtext.
  • In a nutshell, textX will help you build your textual language in an easy way. You can invent your own language or build a support for already existing textual language or file format.
  • From a single language description (grammar), textX will build a parser and a meta-model (a.k.a. abstract syntax) for the language

Brian #3: Reasoning about asyncio.Semaphore

  • Guido van Rossum
  • Article uses a fast food restaurant analogy to reason about concurrency, asyncio, locks, and semaphores.
  • A lock is like a single table restaurant with buzzers handed out to people waiting.
  • A semaphore is like the same thing but with more than one table.
  • Great discussion of the complexities of the Semaphore implementation.
  • Also of concurrency.
  • But almost as important, it’s an excellent example of utilizing a fairly easy to visualize analogy to reason about a complex problem. It also hits parts of the problem difficult to fit into the analogy, and pragmatically abandons the analogy when necessary.

Michael #4: Turnstile

  • A user-friendly, privacy-preserving alternative to CAPTCHA
  • I created a Python library based on Pydantic to validate the forms: turnstile.py (should I make this proper package and GitHub repo?)

Extras

Brian:

  • Choosing a place to host your Python application.
    • aka Heroku Alternatives for Python-based Applications
  • Kicking around the idea of starting cohort based pytest training, possibly starting mid Dec.
    • Please let me know if you think this is a good idea and you might be interested.
    • message me @brianokken

Michael:

  • Cppfront project aims to modernize C++
  • New pyscript (will cover in more depth soon)
  • NextDNS follow up
    • https://nextdns.io/
    • Yes, it’s basically PiHole in the Cloud with tons of options
    • Currently outdoing my NordVPN protections
    • Try with https://adblock-tester.com
    • Had to manually set DNS-over-HTTPS in Vivaldi to work with VPN
    • Add additional blocking lists
  • Got a Feather ESP32-S2 and put CircuitPython on it

Joke: Getting help with code

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #1: Human regular expressions revisited

  • via Mikael Honkala
  • We mentioned of Al Sweigart's humre in Python Bytes…
  • Mikael went on a little search and compiled my findings into this repo.
  • A lot of people feel that re needs some help. At least 3 of the "serious" packages I found came out in the last few months.
  • Since a package like this is not overly complex to make, all the ways to approach the problem are clearly being explored.
  • Unfortunately these seem to be mostly single-person efforts, and many have fallen to the wayside before long.
  • Hopefully there's some consolidation on the horizon, to share some of the maintenance effort and establish some of the packages as here for the long haul.
  • The list could be useful to you if you are:
    • Looking for a tool: Check the list to get a quick idea of the "look and feel" of each package.
    • Thinking about building a tool: Check the list for alternative approaches, and maybe consider if contributing to an existing package might be a better way to get what you need.
    • Building a tool, or already have one: Use the list to clarify and communicate what the main differences and strengths of your solution are.

Brian #2: Implicit Optional Types Will Be Disabled by Default

  • … in a future mypy feature release (possibly the next one after 0.98x) …
  • Thanks Adam Johnson for spotting this and letting us know
  • Stop doing this: s: str = None
  • Do one of these:
    • s: str | None = None
    • s: Union[str, None] = None
    • s: Optional[str] = None ← but this has problems
  • Optional != optional
    • From python docs:
      • Optional[X] is equivalent to X | None (or Union[X, None]).”
      • “Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a default does not require the Optional qualifier on its type annotation just because it is optional. “
  • Best described in FastAPI docs, Python Types Intro, starting at “Possibly None"
  • Recommendation is to use:
    • s: str | None = None for Python 3.10+
    • s: Union[str, None] = None for Python 3.9+
  • For 3.7, 3.8, you still have Optional as an option, I think.
    • Why haven’t you upgraded to 3.9? We’re almost to 3.11, what’s the problem?!

Michael #3: cython-lint

  • by Marco Gorelli
  • A tool (and pre-commit hook) to lint Cython files, similar to how flake8 lints Python files, and works by parsing Cython's own AST (abstract syntax tree).
  • Found quite a few nice clean-ups which could be applied on:
    • pandas
    • numpy
    • scikit-learn
    • cupy

Brian #4: difftastic - structural diff

  • “Difftastic is a structural diff tool that understands syntax.”
  • “Difftastic detects the language, parses the code, and then compares the syntax trees.”
  • Interesting story about building difftastic
  • For one off git diff replacement
    • use GIT_EXTERNAL_DIFF=difft git diff
    • or GIT_EXTERNAL_DIFF="difft --syntax-highlight=off" git diff
  • To always use difft with git, see https://difftastic.wilfred.me.uk/git.html

Extras

Brian:

  • Oh My Git! - An open source game about learning Git!
  • Python 3.11.0 is up to rc2

Michael:

  • NextDNS

Joke: I mean, who’s wrong?

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Brian #1: Can Amazon’s CodeWhisperer write better Python than you?

  • Brian Tarbox
  • “Despite the clickbait-y title, whether CW’s code is better or worse than mine is at the margins and not really important. What is significant is that it has the potential to save me a ton of time and mental space to focus on improving, refactoring and testing. It’s making me a better programmer by taking on some of the undifferentiated heavy lifting.”
  • Some decent code generation, starting with Amazon API examples.
  • The generated dataclass method was neat, but really, the comment “prompt” probably took as much time to write as the code would have.
  • The generated test case is workable, but I would not consider that a good test.
    • Perhaps don’t lump together construction, attribute access, and tests for all methods in one test function.
    • That said, I’ve seen way worse test methods in my career. So, decent starting point.
  • Related and worth listening to: Changelog #506: Stable Diffusion breaks the internet w/ Simon Willison
    • Mostly an episode about AI generated art.
    • There is a bit of a tie in to AI code generation, the ethics around it, and making sure you walk up the value chain.
  • I’m planning on playing with GitHub CoPilot.
    • I’ve been reluctant in the past, but Simon’s interview is compelling to combine experienced engineering skill with AI code generation to possibly improve productivity. Simon does warn against possible abuse by Junior devs and the “just believe the code” problem that we also see with “copy from StackOverflow” situations.

Michael #2: Apache Superset

  • Apache Superset is a modern data exploration and visualization platform
  • An intuitive interface for visualizing datasets and crafting interactive dashboards
  • A wide array of beautiful visualizations to showcase your data
  • Code-free visualization builder to extract and present datasets
  • A world-class SQL IDE for preparing data for visualization, including a rich metadata browser
  • A lightweight semantic layer which empowers data analysts to quickly define custom dimensions and metrics
  • Out-of-the-box support for most SQL-speaking databases
  • Seamless, in-memory asynchronous caching and queries
  • An extensible security model that allows configuration of very intricate rules on who can access which product features and datasets.
  • Integration with major authentication backends (database, OpenID, LDAP, OAuth, REMOTE_USER, etc)
  • The ability to add custom visualization plugins
  • An API for programmatic customization

Brian #3: Recipes from Python SQLite docs

  • Redowan Delowar
  • Expanding on sqlite3 Python docs with more examples, including
    • Executing individual and batch statements
    • Applying user-defined callbacks: scalar and aggregate
      • scalar example shows using a sha256 function to hash passwords as their inserted into the database
    • Enabling tracebacks when callbacks raise an error
    • Transforming types between SQLite and Python
    • Implementing authorization control
    • … much more …
  • This is great for not only learning SQLite, but also, since these kinds of topics exist in other databases, learning about databases.
  • AND a great example of learning a subsystem by creating little code snippets to check your understanding of something.
    • One mod I would do in practice is to write these examples as pytest functions, because I can then run them individually while keeping a bunch in the same file. 🙂

Michael #4: -ffast-math and indirect changes

  • Brendan Dolan-Gavitt downloaded 4 TB of Python packages containing native x86-64 libraries and see how many of them use -ffast-math, potentially altering floating point behavior in any program unlucky enough to load them!
  • Python packages built with an appealing-sounding but dangerous compiler option, -ffast-math, could end up causing any program that uses them to compute incorrect numerical results.
  • When -ffast-math is enabled, the compiler will link in a constructor that sets the FTZ/DAZ flags whenever the library is loaded — even on shared libraries, which means that any application that loads that library will have its floating point behavior changed for the whole process.
  • A total of 2,514 packages eventually depend on a package that uses -ffast-math.
  • Because of highly connected nature of the modern software supply chain, even though a mere 49 packages were actually built with -ffast-math, thousands of other packages, with a total of at least 9.7 million downloads over the past 30 days, are affected.

Extras

Brian:

  • Thinking about changelogs
  • Focusing on helping teams with specific goals
    • Working on an experiment in consulting with some lead engineers before the training to altering the content of a pytest course so the examples better match what the team will need.
      • Sharing packages through internal system, as that’s usually different than the PyPI process.
      • Altering the database and API example of the TalkPython pytest course content to match a teams external resources and responsibility scope.
    • It takes extra time and thought, but in the end might increase engagement and excitement about testing and keeping up on Python’s evolving common practices.

Michael:

  • New course: Python Data Visualization
  • pytest course going strong

Joke:

  • They all use it
  • State of emergency

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #1: PythonAnywhere: Our Commitment to Providing Free Accounts

  • via Matthew Kramer
  • In light of Heroku’s cancelling their free tiers…
  • They believe free tiers are important for beginners
  • Two part solution:
    • Limit outbound internet access for free accounts
    • “Proof of life” to keep running - 3 months for apps, 1 yr for accounts
  • BTW, they were acquired by Anaconda Inc.

Brian #2: ruff: An extremely fast Python linter, written in Rust.

  • Announcement article: Python tooling could be much, much faster
  • Charlie Marsh
  • Quite the star history, as it’s a new repo as of Aug 30. Now at 1.8k.
  • It is extremely fast.
  • I installed it and tried it on a small project.
  • It ran so fast I thought it didn’t do anything. I went and added some errors to convince myself it was running.

``` $ time flake8 src tests
... flake8 src tests 0.29s user 0.02s system 98% cpu 0.311 total

$ time ruff src/ tests/   
...  
ruff src/ tests/  0.01s user 0.01s system 162% cpu 0.011 total

```

Michael #3: Meta spins off PyTorch Foundation to make AI framework vendor neutral

  • PyTorch, which powers Tesla Autopilot and 150K other projects, will join the Linux Foundation.
  • Its governing board includes representatives from Nvidia, Meta, Google, Microsoft, Amazon, and AMD.
  • The PyTorch Foundation will strive to adhere to four principles,
    • Remaining open
    • Maintaining neutral branding
    • Staying fair
    • Forging a strong technical identity
  • According to Meta, the transition to the PyTorch Foundation will not affect any existing PyTorch code

Brian #4: Two string resources

  • Python String Methods to Know
    • Trey Hunner
  • F-Strings Number Formatting Cheat Sheet
    • Brian Allan

Extras

Brian:

  • In Feb, on episode 271, we talked about Seaborn’s new object interface
    • Well, it’s out now in seaborn 0.12
  • Interesting discussion about lazy imports.
  • Other than that, I’m good with your extra. 🙂

Michael:

  • pytest course is out!

Joke: If a developer had to build a horse

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Special guest: Seth Larson

Brian #1: Test your packages and wheels

  • I’ve been building some wheels the last couple of weeks with various tools:
    • flit, flit-core, and flit build
    • hatch, hatchling, and hatch build
    • setuptools, build_meta, and python -m build
  • There are a few projects I’ve used to make sure my projects are in good shape
    • wheel-inspect - you can inspect within Python code through inspect_wheel() function that converts to json. Or use on the command line with wheel2json
    • check-wheel-contents - a linter for wheels
    • tox - easily test the building, installation, and running of a package locally
      • I actually start here, then utilize the other two tools
  • Should have been obvious, but it wasn’t to me
    • Projects saved on git (such as gitHub) don’t keep wheels in git. (this was obvious)
    • When installing from git using pip install git+https://path/to/git/repo.git
      • Your local pip will run the packaging backend to build the wheel before installing.
      • Yet another way to test packaging.

Michael #2: The Jupyter+git problem is now solved

  • Jupyter notebooks don’t work with git by default (they inherently have meaningless conflicts).
  • With nbdev2, the Jupyter+git problem has been totally solved.
  • Uses a set of hooks which provide clean git diffs, solve most git conflicts automatically, and ensure that any remaining conflicts can be resolved entirely within the standard Jupyter notebook environment.
  • The techniques used to make the merge driver work are quite fascinating

Seth #3: Help us test system trust stores in Python

  • Package aiming to replace certifi called “truststore”, use system trust stores for HTTPS instead of a static list of certificates.
  • Problem truststore is solving usually manifests in corporate networks: “unable to get local issuer certificate”.
  • Experimental support added to pip to prove the implementation
  • Users can try out the functionality and report issues.

Brian #4: Making plots in your terminal with plotext

  • Bob Belderbos
  • Tutorial on using plotext - that’s one t in the middle
  • With the rise of CLI usage, plots are a nice addition.
  • Bob’s plot is great, but check out the options in the plotext docs
    • lots-o-plots
    • streaming data
    • images
    • subplots
  • so fun

Michael #5: jinja2-fragments

  • Carson from HTMX (see podcast and course) wrote about template fragments.
  • My jinja_partials project sorta fulfills this, but not really.
  • I had a nice discussion with Sergi Pons Freixes who uses jinja_partials about this.
  • He created Jinja2 fragments

Seth #6: SLSA 3 Generic Builder for GitHub Actions GA

  • Supply chain Levels for Software Artifacts, or SLSA (“salsa”)
  • Tools to attest to and verify “provenance” of artifacts, ie “where it came from”
  • Prove cryptographically that artifacts are built from a specific GitHub repository, commit, tag. Another future defense against stolen PyPI credentials/accounts.
  • Generic builder means you can sign anything, like wheels/sdists

Extras

Brian:

  • Bring your pytest books to PyBay, if you want them signed.
    • I’m only bringing a small amount.
  • I’ll be presenting
    • "Sharing is Caring - pytest fixture edition” at 3:05
    • “Experts Panel on Testing in Python” at 7:00
  • And be a zombie on my 8 am flight back unless I can change my reservation.
  • That’s this weekend, Sat Sept 10, in SF

Michael:

  • Heroku announces plans to eliminate free plans
  • Banned paywalls
  • PyPI phisher identified: Actor Phishing PyPI Users Identified and Actors behind PyPI supply chain attack have been active since late 2021
  • Major Python CVE: CVE-2020-10735: Prevent DoS by large int[HTML_REMOVED]str conversions

Seth:

  • Pyxel, retro game engine for Python, v1.8.0 added experimental web support with WASM

Joke: Dev just after work

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by the IRL Podcast from Mozilla

Michael #1: Careful with that PyPI email

  • via John Hagen
  • There is a widespread Phishing attack going on against PyPI users.
  • The PyPA is currently tweeting about it: https://twitter.com/pypi/status/1562442188285308929

Brian #2: IEEE Top Programming Languages 2022 : Python’s still No. 1, but employers love to see SQL skills

  • by Stephen Cass
  • Related: The Rise of SQL It’s become the second programming language everyone needs to know
    • by Rina Diane Caballar
  • Good to see Python on top for Spectrum and Trending
  • But interesting to see growth and strength in SQL
  • SQL is actually top for Jobs
  • SQL is a skill you can’t ignore.
  • Not only are relational databases just as important for large systems, they’re increasingly more important for small and even local systems, and are ever growing the responsibility of developers, not left to database specialists.

Will #3:

  • Using Mypy in production at Spring
    • by Charlie Marsh

Michael #4: Django 4.1

  • Yes, I’m a bit slow to notice this, from August 3, 2022.
  • Big deal for us async folks!
    • Asynchronous ORM interface: QuerySet now provides an asynchronous interface for all data access operations.
    • Asynchronous handlers for class-based views: View subclasses may now define async HTTP method handlers:
  • Also: Validation of Constraints: Check, unique, and exclusion constraints defined in the Meta.constraints option are now checked during model validation.
  • Check out Chris’ Django: Getting Started course at Talk Python.

Brian #5: You Should Be Using Python's Walrus Operator - Here’s Why

  • by Martin Heinz
  • A fun look at some places where I’ve never considered using :=
  • Examples
    • reusing a value while building a list
    • regular expression match results
    • cleaning up while loops (ok, that I’m using already, but it’s great)
    • accumulating data in place
    • named values in f-strings for multiple formatting. wow, super cool.

Will #6: Humre

  • By Al Sweigart Author of "Automate the Boring Stuff with Python"
  • Human readable regular expressions§

Joke: Password PR

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Brian #1: Uncommon Uses of Python in Commonly Used Libraries

  • by Eugene Yan
  • Specifically, Using relative imports
  • Example from sklearn’s base.py from .utils.validation import check_X_y from .utils.validation import check_array
  • “Relative imports ensure we search the current package (and import from it) before searching the rest of the PYTHONPATH. “
  • For relative imports, we have to use the from .something import thing form.
  • We cannot use import .something since later on in the code .something isn’t valid.
  • There’s a good discussion of relative imports in pep 328

Michael #2: Skyplane Cloud Transfers

  • Skyplane is a tool for blazingly fast bulk data transfers in the cloud.
  • Skyplane manages parallelism, data partitioning, and network paths to optimize data transfers, and can also spin up VM instances to increase transfer throughput.
  • You can use Skyplane to transfer data:
    • Between buckets within a cloud provider
    • Between object stores across multiple cloud providers
    • (experimental) Between local storage and cloud object stores
  • Skyplane takes several steps to ensure the correctness of transfers: Checksums, verify files exist and match sizes.
  • Data transfers in Skyplane are encrypted end-to-end.
  • Security: Encrypted while in transit and over TLS + config options

Brian #3: 7 things I've learned building a modern TUI framework

  • by Will McGugan
  • Specifically, DictViews are amazing. They have set operations.
  • Example of using items() to get views, then for symmetric difference (done at the C level):

``` # Get widgets which are new or changed print(render_map.items() ^ new_render_map.items())

``` * Lots of other great topics in the article

+ `lru_cache` is fast
+ Unicode art in addition to text in doc strings
+ The `fractions` module
+ and a cool embedded video demo of some of the new css stuff in Textual
  • Python’s object allocator ascii art

Michael #4: ‘Unstoppable’ Python

  • Python popularity still soaring: ‘Unstoppable’ Python once again ranked No. 1 in the August updates of both the Tiobe and Pypl indexes of programming language popularity.
  • Python first took the top spot in the index last October, becoming the only language besides Java and C to hold the No. 1 position.
  • “Python seems to be unstoppable,” said the Tiobe commentary accompanying the August index.
  • In the alternative Pypl Popularity of Programming Language index, which assesses language popularity based on Google searches of programming language tutorials, Python is way out front.

Extras

Brian:

  • Matplotlib stylesheets can make your chart look awesome with one line of code.
    • But it never occurred to me that I could write my own style sheet.
    • Here’s an article discussing creation of custom matplotlib stylesheets
      • The Magic of Matplotlib Stylesheets
      • XKCD Plots

Michael:

  • Back on 295 we talked about Flet. We now have a Talk Python episode on it (live and polished versions).

Joke: Rakes and AWS

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by the IRL Podcast from Mozilla

Michael #1: SQLCodeGen

  • via Josh Thurston
  • This is a tool that reads the structure of an existing database and generates the appropriate SQLAlchemy model code, using the declarative style if possible.
  • This tool was written as a replacement for sqlautocode, which was suffering from several issues (including, but not limited to, incompatibility with Python 3 and the latest SQLAlchemy version).
  • Features:
    • Supports SQLAlchemy 1.4.x
    • Produces declarative code that almost looks like it was hand written
    • Produces PEP 8 compliant code
    • Accurately determines relationships, including many-to-many, one-to-one
    • Automatically detects joined table inheritance
    • Excellent test coverage

Brian #2: The death of setup.py*, long live pyproject.toml

  • for Python-only projects
  • Juan Luis Cano Rodriguez tweet
  • pip install --``editable . now works with setuptools, as of version 64.0.0
  • To be clear, setup.cfg also not required.
  • So everything can be in pyproject.toml
  • The * part: projects with non-Python bits may still need setup.py
  • See also the newly updated tutorial by the PyPA: Packaging Python Projects
    • Now with absolutely no mention of setup.py or setup.cfg
    • It’s all pyproject.toml
  • Commentary:
    • For Python only projects, is setuptools a decent flit contender???
    • stay tuned

Michael #3: aiocache

  • via Owen Lamont
  • In the same vein as async-cache you might also be interested in aiocache.
  • It has some cool functionality like an optional Redis backend for multi process caching.
  • his library aims for simplicity over specialization. All caches contain the same minimum interface which consists on the following functions:
    • add: Only adds key/value if key does not exist.
    • get: Retrieve value identified by key.
    • set: Sets key/value.
    • multi_get: Retrieves multiple key/values.
    • multi_set: Sets multiple key/values.
    • exists: Returns True if key exists False otherwise.
    • increment: Increment the value stored in the given key.
    • delete: Deletes key and returns number of deleted items.
    • clear: Clears the items stored.
    • raw: Executes the specified command using the underlying client.

Brian #4: Hatch : a modern, extensible Python project manager

  • Another flit contender?
  • While reading Packaging Python Projects tutorial update, I noticed some examples for hatchling, as an alternative to setuptools, flit-core, and pdm.
  • Played with it some, but still have some exploring to do.
  • features
    • Standardized build system with reproducible builds by default
    • Robust environment management with support for custom scripts
    • Easy publishing to PyPI or other sources
      • includes --repo flag to be able to publish to alternative indices.
      • Awesome for internal systems.
    • Version management
    • Configurable project generation with sane defaults
    • Responsive CLI, ~2-3x faster than equivalent tools
      • This sounds great. I haven’t verified this
  • Commentary:
    • Good to see more packaging tools and user workflow explorations around packaging.

Extras

Michael:

  • M1 Support for PyPy Announced (via PyCoders)

Joke: I am the docs

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by the IRL Podcast from Mozilla

Brian #1: Pip constraints files

  • by luminousmen
  • You can put some constraints on your dependencies with a constraints file.
  • “Constraints files are requirements files that only control which version of a requirement is installed, not whether it is installed or not. “
  • Syntax is a subset of requirements.txt syntax
    • but all the restrictions seem reasonable, considering
      • must have a name
      • can’t be editable
      • can’t specify extras (that one is maybe slightly weird)
  • You can put --constraint constraints.txt right at the top of your requirements.txt file
  • or specify it on command line,
    • pip install --constraint constraints.txt -r requirements.txt
  • Or, my favorite, stick it at the top of requirements.in file.
    • yes. pip-compile correctly handles constraints when generating requirements.txt.
  • Example

    • requirements.in --constraint constraints.txt typer
    • constraints.txt click<8.1.3
    • Output from pip-compile requirements.in

    ```

    This file is autogenerated by pip-compile with python 3.10

    To update, run:

    pip-compile requirements.in

    click==8.1.2 # via # -c constraints.txt # typer typer==0.6.1 # via -r requirements.in

    ```

Michael #2: async-cache

  • A caching solution for asyncio
  • Quite simple but looks effective and flexible too
  • Example:

```

TTL Cache

from cache import AsyncTTL

@AsyncTTL(time_to_live=60, maxsize=1024) async def func(args, *kwargs): """ time_to_live : max time for which a cached result is valid maxsize : max number of results that are cached. if max limit is reached the oldest result is deleted. """ pass

```

Brian #3: Organize Python code like a PRO

  • Guilherme Latrova
  • Yes, this is one author’s opinion. but…
    • lots of great advice
    • nothing too weird
    • no tool recommendations
  • Recommendations of note

    • keep a src dir.
      • A cool and simple reason: it keeps your source code together in alphabetized IDEs.
    • file/module names: plural except for config, main, core, or similar
      • slightly weird tangent that there are no files, there are modules. ok, whatever.
      • Also talking about directories as main modules. odd. but ok.
    • functions/methods should be verbs
    • variables/constants should be nouns
    • Class names should be singular, unless the class really represents a container
    • The __name__ == "__main__" trick for modules.
    • The __main__.py entry point trick for modules/packages so that -m mymodule does something.

Michael #4: keyring

  • via Trent
  • The Python keyring library provides an easy way to access the system keyring service from python. It can be used in any application that needs safe password storage.
  • It’s also helpful in that it allows you to write your own backends. Useful for testing.
  • Basically create a dummy keychain that stores to a pytest temp_path fixture instead of cluttering the real keychain.
  • You could potentially write a backend to interact with any service such as 1Password.

Extras

Brian:

  • I’m taking a class on FastAPI. The instructor is awesome!
  • Also, editing some pytest course video.

Michael:

  • Gitlab, you alright??

Joke:

  • from a dad-jokes repo
    • Q: How do programming pirates pass method parameters?
    • A: Varrrrarrrgs.
    • Q: How do you get the code for the bank vault?
    • A: You checkout their branch.
    • "Unfortunately these jokes only work if you git them."
  • Screw driver

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #1: Faster routing for Flask & Quart

  • Flask and Quart both utilise Werkzeug's HTTP route
  • With the upcoming 2.2 release of Werkzeug this router will be significantly faster, with up to a factor of 5.
  • Better for large sets of routes
  • Micro-benchmarks are unaffected and are unlikely to show a speedup.
  • Started with tree-based radix algorithm
  • Moved to state machine algorithm because of wild cards

Brian #2: Quarto: an open-source scientific and technical publishing system built on Pandoc

  • suggested by Paul Mackenzie
  • Power of Pandoc and Jupyter
  • Build
    • documents - html, pdf, word
    • presentations - Revealjs, PowerPoint, Beemer
    • websites
    • books - html, pdf, word, epub
    • journal articles - acm, plos, elsevier, acs, jss
  • Publish
    • GitHub pages, Netlify, …
  • kinda related - Kindle to support ePub

Michael #3: Flet UI

  • via Mikael Honkala
  • New and upcoming UI framework by Feodor Fitzner: flet.
  • It has a very interesting stack - a Python client driving a Flutter front-end via a Go server.
  • That sounds complicated, but the developer experience is incredibly simple. Installation is just pip install flet.
  • Here's a quick and stupid but working sample:

``` import time import flet from flet import Column, ElevatedButton, Page, Row, TextField

def main(page: Page): text_field = TextField()

def clear_field(event):
    text_field.value = "CLEARING"
    page.update()
    time.sleep(1)
    text_field.value = ""
    page.update()

clear_button = ElevatedButton("Clear the field", on_click=clear_field)
page.add(Row([Column([text_field, clear_button])], alignment="center"))
page.update()

flet.app(target=main)

If you run this, you get a native app window on Mac, Windows or Linux, looking something like this:

```

  • While the example is simple, it shows the handling of an event, updating the UI, and even doing a little sleeping between the updates, without having to worry about threads and such.
  • What's more important, if you change the last line to:

``` flet.app(target=main, view=WEB_BROWSER)

``` * You get the exact same functionality, but as a web application in a browser, with support for multiple users and deep linking to different parts of the app. All without leaving the comfortable Python world, with its access to all Python libraries, and without having to learn 3 extra, completely different languages (yes, HTML, CSS and JavaScript). * As this is Flutter, mobile support is in the works, after the basic UI functionality is all there. * Check the project front page here: flet.dev * Jump directly to the currently available controls: flet.dev/docs/controls * Check couple of tutorials here: flet.dev/docs/tutorials * Or read the plans for the mobile support here: flet.dev/blog/flet-mobile-strategy

Brian #4: Building an authenticated Python CLI

  • Project that uses click, rich, and OAth for using Twitter API
  • Persistent authentication
    • requests secret information from user using getpass and input
      • Client ID, Client Secret, App name
    • fetches bearer token from Twitter API
    • stores token in netrc file
  • I’m not familiar with netrc, so I don’t know if this is a good idea or not.
    • So I figured I’d ask Michael

Extras

Michael:

  • New course: Django - Getting Started

Joke: Light touches kingdom

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Michael #1: Specialist: Python 3.11 perf highlighter

  • via Alex Waygood
  • Visualize CPython 3.11's specializing, adaptive interpreter. 🔥
  • PEP 659 – Specializing Adaptive Interpreter
  • Specialist uses fine-grained location information to create visual representations of exactly where and how CPython 3.11's new specializing, adaptive interpreter optimizes your code.
  • Dark, rich colors indicate code with many quickened instructions (and, therefore, high specialization potential), while light, pale colors indicate code with relatively few specialization opportunities.

Brian #2: tomli “A lil’ TOML parser”

  • Fully compatible with TOML spec 1.0.0
  • This is the library that tomllib from Python 3.11 is based on, so great to use for Python 3.7-3.10 applications.
    • We discussed Python 3.11 and PEP 680 on episode 273
  • Real Python has a great introduction for TOML in Python: Python and TOML: New Best Friends
    • TOML as a config format, key-value pairs, data types
    • using both tomli and tomllib
    • Loading TOML documents into Python
    • And like, writing, and updating toml docs programatically, which, although cool, I think the bulk of users can kinda skip over. But the the first 3 sections are an excellent reference.
    • Tables are cool, with [name] and [name.subsection] syntax, as well as arrays of tables with [[name]] syntax. I didn’t know how to do that before this article.

Michael #3: Pydantic V2 Plan

  • via Douglas Nichols and John Thagen
  • A very detailed plan
  • Goal to have all this done by the end of October, definitely by the end of the year.
  • Samuel Colvin take a sabbatical to work on this (sound familiar?)
  • Some details highlighted by John:
    • Moving the core logic to Rust to drastically increase performance (17x) https://pydantic-docs.helpmanual.io/blog/pydantic-v2/#performance
    • Strict mode (something I've wanted for a long time): https://pydantic-docs.helpmanual.io/blog/pydantic-v2/#strict-mode
    • Cleaning up required vs nullable: https://pydantic-docs.helpmanual.io/blog/pydantic-v2/#required-vs-nullable-cleanup
    • Naming cleanup: https://pydantic-docs.helpmanual.io/blog/pydantic-v2/#model-namespace-cleanup
  • This is a huge change, but overall it looks very promising for the community. It will likely require refactors by downstream users, so pinning pydantic using Poetry/pip-tools etc like always is a good idea.
  • Many things have Pydantic at the core, so this matters, including:
    • FastAPI
    • Beanie
    • SQLModel
    • Pydastic

Brian #4: pikepdf

  • a Python library for reading and writing PDF files
  • Based on QPDF, which is written in C++.
  • Features:
    • Supports password protected PDFs
    • Creates linearized ("fast web view") PDFs
    • Integrates with Jupyter and IPython notebooks for rapid development
  • Some cool uses
    • copy pates from one PDF into another
    • split and merge PDFs
    • extract content
    • replace content, such as replacing images, without altering the rest of the file.
  • Documentation mentions that if you only want to write PDFs, consider other libs, such as reportlab.

Extras

Brian:

  • pytest-check
    • I’ve set up 2fa for my account, so now I have no excuse for not looking into feature requests and merge requests for pytest-check, other than like all the other things I’m doing.
    • I don’t have data for the top 3,500 for the last 6 months, but there is a list of the top 5,000 for last 30 days.
    • pytest-check is #1677 in the last 30 days.
    • pytest is #72 on the same list.
    • pydantic is #117
    • There are 57 pytest plugins that show up in the top 3,500 python packages. (packages that start with “pytest-”)
    • pytest-check is #20 of those. I guess it’s time to do another top plugins episode of Test & Code.

Joke:

  • Error, OK, I’ll check the logs

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Special guest: Ashley Anderson

Ashley #1: PSF security key giveaway for critical package maintainers

  • Giving away 4000 2FA hardware keys
  • Surely a team effort but I found it via @di_codes twitter (Dustin Ingram)
    • links to previous talks on PyPI/supply chain security
  • Interesting idea for helping with supply-chain vulnerabilities
  • At least one dev pulled a critical package in response
  • Previously:
  • I don’t have any critical projects
  • Armin Ronacher has an interesting take

Michael #2: PyLeft-Pad

  • via Dan Bader
  • Markus Unterwaditzer was maintaining atomicwrites
  • More on how this relates to a project (Home Assistant)
  • I wonder if PyPI will become immutable once an item is published

Brian #3: FastAPI Filter

  • Suggested and created by Arthur Rio
  • “I loved using django-filter with DRF and wanted an equivalent for FastAPI.” - Arthur
  • Add query string filters to your api endpoints and show them in the swagger UI.
  • Supports SQLAlchemy and MongoEngine.
  • Supports operators: gt, gte, in, isnull, it, lte, not/ne, not_in/nin

Ashley #4:

  • Tools for building Python extensions in Rust

    • PyO3
      • pyo3 - Python/Rust FFI bindings
        • nice list of examples people might recognize in the PyO3 README
        • Pydantic V2 will use it for pydantic-core
      • maturin - PEP 621 wheel builder (pyproject.toml)
        • pretty light weight, feels like flit for Rust or python/Rust
      • rust-numpy (+ndarray) for scientific computing
      • setuptools-rust for integrating with existing Python projects using setuptools
    • Rust project and community place high value on good tooling, relatively young language/community with a coherent story from early on
    • Rust macro system allows for really nice ergonomics (writing macros is very hard, using them is very easy)
    • The performance/safety/simplicity tradeoffs Python and Rust make are very different, but both really appeal to me

    -

Michael #5: AutoRegEx

  • via Jason Washburn
  • Enter an english phrase, it’ll try to generate a regex for you
  • You can do the reverse too, explain a regex
  • You must sign in and are limited to 100 queries / [some time frame]
  • Related from Simon Willison: Using GPT-3 to explain how code works

Brian #6: Anaconda Acquires PythonAnywhere

  • Suggested by Filip Łajszczak
  • See also Anaconda Acquisition FAQs from PythonAnywhere blog
  • From announcement: “The acquisition comes on the heels of Anaconda’s release of PyScript, an open-source framework running Python applications within the HTML environment. The PythonAnywhere acquisition and the development of PyScript are central to Anaconda’s focus on democratizing Python and data science.”
  • My take:
    • We don’t hear a lot about PA much, even their own blog has had 3 posts in 2022, including the acquisition announcement.
    • Their home page boasts “Python versions 2.7, 3.5, 3.6, 3.7 and 3.8”, although I think they support 3.9 as well, but not 3.10 yet, seems like from the forum. Also, no ASGI, so FastAPI won’t work, for example.
    • Still, I think PA is a cool idea, and I’d like to see it stay around, and stay up to date. Hopefully this acquisition is the shot in the arm it needed.

Extras

Michael:

  • Python becomes the most sought after for employers hiring (by some metric)

Ashley:

  • PEP691 JSON Simple API for PyPI
  • Rich Codex - automatic terminal “screenshots”

Joke: Neta is a programmer

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Brian #1: rich-codex

  • by Phil Ewels
  • suggested by Will McGugan
  • “A GitHub Action / command-line tool which generates screen grab images of a terminal window, containing command outputs or code snippets.”
  • Generate images from commands embedded in markdown files, like README.md, for example.
    • Searches through markdown files for stuff like: cat cat.txt | lolcat -S 1
    • then runs the command, and generates the image.
  • Can be done within a GitHub action
  • Can also send code snippets or json to rich-cli, then generate an image.
  • You can also have commands in a config file,
  • Very easy to use, makes very professional looking images for documentation, that’s always up to date.

Michael #2: Pydastic

  • via Roman Right, by Rami Awar
  • Pydastic is an elasticsearch python ORM based on Pydantic.
  • Core Features
    • Simple CRUD operations supported
    • Sessions for simplifying bulk operations (a la SQLAlchemy)
    • Dynamic index support when committing operations
  • More on Elasticsearch here

Brian #3: 3 Things to Know Before Building with PyScript

  • by Braden Riggs
  • Package indentation matters
  • Local file access is possible.

``` [HTML_REMOVED] - numpy - pandas - paths: - /views.csv [HTML_REMOVED]

``` * + DOM manipulation has interesting conventions + For buttons, you can include pys-onClick=”your_function” parameter to trigger python functions when clicked. + For retrieving user input from within the [HTML_REMOVED] tag document.getElementById(‘input_obj_id’).value can retrieve the input value. + And Finally pyscript.write(“output_obj_id”, data) can write output to a tag from within the [HTML_REMOVED] tag. * Michael's Pyscript videos + Python + pyscript + WebAssembly: Python Web Apps, Running Locally with pyscript + Python iOS Web App with pyscript and offline PWAs

Michael #4: disnake

  • via Sean Koenig
  • disnake is a modern, easy to use, feature-rich, and async-ready API wrapper for Discord.
  • Features:
    • Modern Pythonic API using async/await syntax
    • Sane rate limit handling that prevents 429 errors
    • Command extension to aid with bot creation
    • Easy to use with an object oriented design
    • Optimized for both speed and memory
    • Quickstart
    • Commands API

Extras

Michael:

  • Scholarships for upcoming FastAPI + MongoDB live course
  • Humble Bundle for Python 2022
  • Michael's crazy earbuds (UE Fits)

Joke: Better than a wage increase

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Michael #1: Python License tracker

  • by Tom Nijhof/Nyhof
  • Every package depends on other package with sometimes different licenses.
  • Tom made a tool to find out what licenses you all need for a project:
  • PyTest alone needs 4 different licenses for itself and its dependencies.
  • Tensorflow is even worst

Brian #2: undataclass

  • Trey Hunner
  • As a teaching aid, and to show how much dataclasses do for you, this is a module and an application that converts dataclasses to normal classes, and fills in all of the dunder methods you need.
  • Example in app:

``` from dataclasses import dataclass

@dataclass()
class Point:
    x: float
    y: float
    z: float

``` * Converts to

``` class Point: match_args = ('x', 'y', 'z')

    def __init__(self, x: float, y: float, z: float) -> None:
        self.x = x
        self.y = y
        self.z = z

    def __repr__(self):
        cls = type(self).__name__
        return f'{cls}(x={self.x!r}, y={self.y!r}, z={self.z!r})'

    def __eq__(self, other):
        if not isinstance(other, Point):
            return NotImplemented
        return (self.x, self.y, self.z) == (other.x, other.y, other.z)

`` * Note onNotImplemented`:

+ It just means, “I don’t know how to compare this”, and Python will try `__eq__` on the `other` object. If that also raises `NotImplemented`, a `False` is returned.
  • The default is the above with @dataclass(frozen=True, slots=True) and adds the methods:
    • fronzen=True gives you implementations of __hash__, __setattr__, __delattr__, __getstate__, __setstate__,
      • Essentially raises exception if you try to change the contents, and makes your objects hashable.
    • slots=True adds the line: __slots__ = (``'``x', '``y``'``, '``z``'``).
      • This disallows adding new attributes to objects at runtime. See Python docs
  • Trey wrote two posts about it:
    • Appreciating Python's match-case by parsing Python code
    • How I made a dataclass remover
  • Turns out, this is a cool example for AST and structural pattern matching.
  • Notes from the “how I made..” article:
  • "I used some tricks I don't usually get to use in Python. I used:
  • Many very hairy **match**-**case** blocks which replaced even hairier if-elif blocks
  • A sentinel object to keep track of a location that needed replacing
  • Python's **textwrap.dedent** utility, which I feel should be more widely known & used
  • slice assignment to inject one list into another
  • The ast module's unparse function to convert an abstract syntax tree into Python code”

Michael #3: Qutebrowser

  • via Martin Borus
  • Qutebrowser is a keyboard-focused browser with a minimal GUI."
  • It's Python powered
  • Whats more important - doesn't force you to use it's Vim-based shortcuts, the mouse
  • still works. But you usually don't need it: Because on any page, a keypress on the "f" key will show, you every clickable think and a letter combination to enter to click this.

Brian #4: asyncio and web applications

  • A collection of articles
  • Quart is now a Pallets project
    • P G Jones, maintainer of Quart and Hypercorn
    • “Quart, an ASGI re-implementation of the Flask API has joined the Pallets organization. This means that future development will be under the Pallets governance by the Pallets maintainers.
    • Our long term aim is to merge Quart and Flask to bring ASGI support directly to Flask.
    • “When to use Quart?”
      • “Quart is an ASGI framework utilising async IO throughout, whereas Flask is a WSGI framework utilising sync IO. It is therefore best to use Quart if you intend to use async IO (i.e. async/await libraries) and Flask if not. Don't worry if you choose the 'wrong' framework though, as Quart supports sync IO and Flask supports async IO, although less efficiently.”
  • Using async and await, from Flask docs
    • Flask has some support of async/await since Flask 2.0
    • But it’s still a WSGI application.
    • “Deciding whether you should use Flask, Quart, or something else is ultimately up to understanding the specific needs of your project.”
  • Should You Use AsyncIO for Your Next Python Web Application?
    • Steven Pate
    • A cool “brief history of Python web server interfaces”
    • Discussion of the Python servers and frameworks for both WSGI and ASGI
    • Recommendation: Do you need async? “… most people don’t. WSGI servers and frameworks are usually performant enough.”

Extras

Michael:

  • Python Web Conf Talk: HTMX + Flask: Modern Python Web Apps, Hold the JavaScript
  • browserosaurus

Joke: Understanding JavaScript

Joke: Where do you see yourself in 5 years?

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Special guest: Nick Muoh

Brian #1: picologging

  • From a tweet by Anthony Shaw
  • From README.md
  • “early-alpha” stage project with some incomplete features. (cool to be so up front about that)
    • “Picologging is a high-performance logging library for Python. picologging is 4-10x faster than the logging module in the standard library.”
    • “Picologging is designed to be used as a drop-in replacement for applications which already use logging, and supports the same API as the logging module.”
  • Now you’ve definitely got my attention.
  • For many common use cases, it’s just way faster.
  • Sounds great, why not use it? A few limitations listed:
    • process and thread name not captured.
    • Some logging globals not observed: logging.logThreads, logging.logMultiprocessing, logging.logProcesses
    • Logger will always default to the Sys.stderr and not observe (emittedNoHandlerWarning).

Michael #2: CheekyKeys

  • via Prayson Daniel
  • What if you could silently talk to your computer?
  • CheekyKeys uses OpenCV and MediaPipe's Face Mesh to perform real-time detection of facial landmarks from video input.
  • The primary input is to "type" letters, digits, and symbols via Morse code by opening and closing your mouth quickly for . and slightly longer for -.
  • Most of the rest of the keyboard and other helpful actions are included as modifier gestures, such as:
    • shift: close right eye
    • command: close left eye
    • arrow up/down: raise left/right eyebrow
  • Watch the video where he does a coding interview for a big tech company using no keyboard.

Nick #3: Is Google’s LaMDA Model Sentient?

  • authored by Richard Luscombe (The Guardian)
  • The Google engineer who thinks the company’s AI has come to life
  • Transcript of conversation

Brian #4: richbench

  • Also from Anthony
  • “A little Python benchmarking tool.”
  • Give it a list of (first_func, second_func, “label”), and it times them and prints out a comparison.
  • Simple and awesome.

``` def sort_seven(): """Sort a list of seven items""" for _ in range(10_000): sorted([3,2,4,5,1,5,3])

def sort_three(): """Sort a list of three items""" for _ in range(10_000): sorted([3,2,4])

benchmarks = [ (sort_seven, sort_three, "Sorting 3 items instead of 7") ]

```

Michael #5: typeguard

  • A run-time type checker for Python
  • Three principal ways to do type checking are provided, each with its pros and cons:
    • Manually with function calls
    • @typechecked decorator
    • import hook (typeguard.importhook.install_import_hook())
  • Example:

``` @typechecked def some_function(a: int, b: float, c: str, *args: str) -> bool: ... return retval

```

Nick #6: CustomTkinter

  • A modern and customizable python UI-library based on Tkinter.

Extras

Michael:

  • OpenSSF Funds Python and Eclipse Foundations - OpenSSF’s Alpha-Omega Project has committed $400K to the Python Software Foundation (PSF), in order to create a new role which will provide security expertise for Python, the Python Package Index (PyPI), and the rest of the Python ecosystem, as well as funding a security audit. (via Python Weekly)

Nick:

  • Terms of Service Didn’t Read - Terms of Service; Didn't Read” (short: ToS;DR) is a young project started in June 2012 to help fix the “biggest lie on the web”: almost no one really reads the terms of service we agree to all the time.

Joke:

  • Serverless
  • A DevOps approach to COVID-19

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Special guest: Gina Häußge, creator & maintainer of OctoPrint

Michael #1: beanita

  • Local MongoDB-like database prepared to work with Beanie ODM
  • So, you know Beanie - Pydantic + async + MongoDB
  • And you know Mongita - Mongita is to MongoDB as SQLite is to SQL
  • Beanita lets you use Beanie, but against Mongita rather than a server-based MongoDB server

Brian #2: The Good Research Code Handbook

  • Patrick J Mineault
  • “for grad students, postdocs and PIs (principle investigator) who do a lot of programming as part of their research.”
  • lessons
    • setup
      • git, virtual environments, project layout, packaging, cookie cutter
    • style
      • style guides, keeping things clean
    • coding
      • separating concerns, separating pure functions and those with side effects, pythonic-ness
    • testing
      • unit testing, testing with side effects, …
      • (incorrect definition of end-to-end tests, but a good job at covering the other bits)
    • documentation
      • comments, tests, docstrings, README.md, usage docs, tutorials, websites
      • documenting pipelines and projects
    • social aspects
      • various reviews, pairing, open source, community
    • sample project
    • extras
      • testing example
      • good tools to use

Gina #3: CadQuery

  • Python lib to do build parametric 3D CAD models
  • Can output STL, STEP, AMF, SVG and some more
  • Uses same geometry kernel as FreeCAD (OpenCascade)
  • Also available: desktop editor, Jupyter extension, CLI
    • Would recommend the Jupyter extension, the app seems a bit behind latest development
  • Jupyter extension is easy to set up on Docker and comes with a nice 3D preview pane
  • Was able to create a basic parametric design of an insert for an assortment box easily
  • Python 3.8+, not yet 3.11, OpenCascade related

Michael #4: Textinator

  • Like TextSniper, but in Python
  • Simple MacOS StatusBar / Menu Bar app to automatically detect text in screenshots
  • Built with RUMPS: Ridiculously Uncomplicated macOS Python Statusbar apps
  • Take a screenshot of a region of the screen using ⌘ + ⇧ + 4 (Cmd + Shift + 4).
  • The app will automatically detect any text in the screenshot and copy it to your clipboard.
  • How Textinator Works
    • At startup, Textinator starts a persistent NSMetadataQuery Spotlight query (using the pyobjc Python-to-Objective-C bridge) to detect when a new screenshot is created.
    • When the user creates screenshot, the NSMetadataQuery query is fired and Textinator performs text detection using a Vision VNRecognizeTextRequest call.

Brian #5: Handling Concurrency Without Locks

  • "How to not let concurrency cripple your system”
  • Haki Benita
  • “…common concurrency challenges and how to overcome them with minimal locking.”
  • Starts with a Django web app
  • A url shortener that generates a unique short url and stores the result in a database so it doesn’t get re-used.
  • Discussions of
    • collision with two users checking, then storing keys at the same time.
    • locking problems in general
    • utilizing database ability to make sure some items are unique, in this case PostgreSQL
    • updating your code to take advantage of database constraints support to allow you to do less locking within your code

Gina #6: TatSu

  • Generates parsers from EBNF grammars (or ANTLR)
  • Can compile the model (similar to regex) for quick reuse or generate python source
  • Many examples provided
  • Active development, Python 3.10+

Extras

Michael:

  • Back on 285 we spoke about PEP 690. Now there is a proper blog post about it.
  • Expedited release of Python3.11.0b3 - Due to a known incompatibility with pytest and the previous beta release (Python 3.11.0b2) and after some deliberation, Python release team have decided to do an expedited release of Python 3.11.0b3 so the community can continue testing their packages with pytest and therefore testing the betas as expected. (via Python Weekly)
  • Kagi search
    • via Daniel Hjertholm
    • Not really python related, but if I know Michael right, he'll love the new completely ad free and privacy-respecting search engine kagi.com. I've used kagi.com since their public beta launched, mainly to search for solutions to Python issues at work. The results are way better than DuckDuckGo's results, and even better than Googles! Love the Programming-lens and the ability to up/down prioritize domains in the results.
    • Their FAQ explains everything you need to know: https://kagi.com/faq
    • Looks great but not sure about the pricing justification (32 sec of compute = $1), that’s either 837x more than all of Talk Python + Python Bytes or more than 6,700x more than just one of our sites/services. (We spend about $100/mo on 8 servers.) But they may be buying results from Google and Bing, and that could be the cost.
    • Here's a short interview with the man who started kagi.

Gina:

  • rdserialtool: Reads out low-cost USB power monitors (UM24C, UM25C, UM34C) via BLE/pybluez. Amazing if you need to monitor the power consumption/voltage/current of some embedded electronics on a budget. Helped me solve a very much OctoPrint development specific problem. Python 3.4+
  • nodejs-bin:
    • by Sam Willis: https://twitter.com/samwillis/status/1537787836119793667
    • Install nodejs via pypi/as dependency, still very much an Alpha but looks promising
    • Makes it easier to obtain a full stack environment
    • Very interesting for end to end testing with JS based tooling, or packaging a frontend with your Python app
    • See also nodeenv, which does a similar thing, but with additional steps

Joke: Rejected Github Badges

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Brian #1: Polars: Lightning-fast DataFrame library for Rust and Python

  • Suggested by a several listeners
  • “Polars is a blazingly fast DataFrames library implemented in Rust using Apache Arrow Columnar Format as memory model.
    • Lazy | eager execution
    • Multi-threaded
    • SIMD (Single Instruction/Multiple Data)
    • Query optimization
    • Powerful expression API
    • Rust | Python | ...”
  • Python API syntax set up to allow parallel and execution while sidestepping GIL issues, for both lazy and eager use cases. From the docs: Do not kill parallelization
  • The syntax is very functional and pipeline-esque:

``` import polars as pl q = ( pl.scan_csv("iris.csv") .filter(pl.col("sepal_length") > 5) .groupby("species") .agg(pl.all().sum()) ) df = q.collect()

``` * Polars User Guide is excellent and looks like it’s entirely written with Python examples. * Includes a 30 min intro video from PyData Global 2021

Michael #2: PSF Survey is out

  • Have a look, their page summarizes it better than my bullet points will.

Brian #3: Gin Config: a lightweight configuration framework for Python

  • Found through Vincent D. Warmerdam’s excellent intro videos on gin on calmcode.io
  • Quickly make parts of your code configurable through a configuration file with the @gin.configurable decorator.
  • It’s in interesting take on config files. (Example from Vincent)

``` # simulate.py @gin.configurable def simulate(n_samples): ... # config.py simulate.n_samples = 100

``` * You can specify:

+ required settings: `def` `simulate`(n\_samples=gin.REQUIRED)`
+ blacklisted settings: `@gin.configurable(blacklist=["n_samples"])`
+ external configurations (specify values to functions your code is calling)
+ can also references to other functions: `dnn.activation_fn = @tf.nn.tanh`
  • Documentation suggests that it is especially useful for machine learning.
  • From motivation section:
    • “Modern ML experiments require configuring a dizzying array of hyperparameters, ranging from small details like learning rates or thresholds all the way to parameters affecting the model architecture.
    • Many choices for representing such configuration (proto buffers, tf.HParams, ParameterContainer, ConfigDict) require that model and experiment parameters are duplicated: at least once in the code where they are defined and used, and again when declaring the set of configurable hyperparameters.
    • Gin provides a lightweight dependency injection driven approach to configuring experiments in a reliable and transparent fashion. It allows functions or classes to be annotated as @gin.configurable, which enables setting their parameters via a simple config file using a clear and powerful syntax. This approach reduces configuration maintenance, while making experiment configuration transparent and easily repeatable.”

Michael #4: Performance benchmarks for Python 3.11 are amazing

  • via Eduardo Orochena
  • Performance may be the biggest feature of all
  • Python 3.11 has
    • task groups in asyncio
    • fine-grained error locations in tracebacks
    • the self-type to return an instance of their class
  • The "Faster CPython Project" to speed-up the reference implementation.
    • See my interview with Guido and Mark: talkpython.fm/339
    • Python 3.11 is 10~60% faster than Python 3.10 according to the official figures
    • And a 1.22x speed-up with their standard benchmark suite.
  • Arriving as stable until October

Extras

Michael:

  • Python 3.10.5 is available (changelog)
  • Raycast (vs Spotlight)
    • e.g. CMD+Space => pypi search:

Joke: Why wouldn't you choose a parrot for your next application

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Michael #1: auto-py-to-exe

  • Converts .py to .exe using a simple graphical interface
  • A good candidate to install via pipx
  • For me, just point it at the top level app.py file and click go
  • Can add icons, etc.
  • Got a .app version and CLI version (I think 😉 )
  • Required brew install python-tk to get tkinter on my mac
  • I tested it against my URLify app.
  • Oddly, only ran on Python 3.9 but not 3.10

Brian #2: 8 surprising ways how to use Jupyter Notebook

  • by Aleksandra Płońska, Piotr Płoński
  • Fun romp through ways you can use and abuse notebooks
    • package development
    • web app
    • slides
    • book
    • blog
    • report
    • dashboard
    • REST API

Michael #3: piptrends

  • by Tankala Ashok
  • Use piptrends.com for comparing python packages downloads and GitHub Statistics.
  • Whenever doing research which python package, check multiple places to finalize it so thought of putting all those things in a single place.
  • Inspired by npmtends.com.

Brian #4: Is it a class or a function? It's a callable!

  • by Trey Hunner
  • It’s kinda hard to tell in Python. Actually, impossible to tell from staring at the calling code.
  • “Of the 69 “built-in functions” listed in the Python Built-In Functions page, only 42 are actually implemented as functions: 26 are classes and 1 (help) is an instance of a callable class.
  • Of the 26 classes among those built-in “functions”, four were actually functions in Python 2 (the now-lazy map, filter, range, and zip) but have since become classes.
  • The Python built-ins and the standard library are both full of maybe-functions-maybe-classes.”
  • len - yep, that’s a function
  • zip - that’s a class
  • reversed, enumerate, range, and filter “functions” are all classes. But callable classes.
  • Cool discussion of
    • callable objects
    • partials, itemgetters, iterators, generators, factory functions

Extras

Brian:

  • What’s in which Python - Ned Batchelder
    • brief bullet list of a few memorable changes in versions 2.1 through 3.11

Michael:

  • Orion Browser via Dan Bader
  • PSF 2021 Survey Results are out (full analysis next week)

Joke: async problems

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Brian #1: The Python GIL: Past, Present, and Future

  • Bary Warsaw and Paweł Polewicz

Michael #2: Announcing the PyOxy Python Runner

  • PyOxy is all of the following:
    • An executable program used for running Python interpreters.
    • A single file and highly portable (C)Python distribution.
    • An alternative python driver providing more control over the interpreter than what python itself provides.
    • A way to make some of PyOxidizer's technology more broadly available without using PyOxidizer.
  • PyOxidizer is often used to generate binaries embedding a Python interpreter and a custom Python application. However, its configuration files support additional functionality, such as the ability to produce Windows MSI installers, macOS application bundles, and more.
  • The pyoxy executable also embeds a copy of the Python standard library and imports it from memory using the oxidized_importer Python extension module.

Brian #3: The unreasonable effectiveness of f-strings and re.VERBOSE

Michael #4: PyCharm PR Management

  • Really nice but not very discoverable
  • Not covered in the docs, but super useful.
  • Available in pro and free community edition
  • Steps
    • Open a project that has an associated github git repo
    • If the GitHub repo has a PR, you’ll see it in the Pull Requests tab.
    • Browse the PRs, and open them for details
    • There you can see the comments, close or merge it, and more
    • Most importantly, check it out to see how it works

Extras

Brian:

  • Pandas Tutor: Using Pyodide to Teach Data Science at Scale

Michael:

  • Python + pyscript + WebAssembly: Python Web Apps, Running Locally with pyscript video is out
  • And an iOS Python Apps video too

Joke:

Losing an orm!

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored: RedHat: Compiler Podcast

Special guests

  • Mark Little
  • Ben Cosby

Michael #1: libgravatar

  • A library that provides a Python 3 interface to the Gravatar APIs.
  • If you have users and want to show some sort of an image, Gravatar is OK
  • PyPI uses this for example (gravatar, not necessarily this lib)

Usage:

``` >>> g = Gravatar('myemailaddress@example.com') >>> g.get_image() 'https://www.gravatar.com/avatar/0bc83cb571cd1c50ba6f3e8a78ef1346'

```

Brian #2: JSON to Pydantic Converter

  • Suggested by Chun Ly, “this awesome JSON to @samuel_colvin's pydantic is so useful. It literally saved me days of work with a complex nested JSON schema.“
  • “JSON to Pydantic is a tool that lets you convert JSON objects into Pydantic models.”
  • It’s a live site, where you can plop JSON on one the left, and Pydantic models show up on the right.
  • There’s a couple options:
    • Specify every field as Optional
    • Alias camelCase fields as snake_case
  • It’s also an open source project, built with FastAPI, Create React App, and a project called datamodel-code-generator.

Mark #3: tailwindcss, tailwindui

  • Not python, but helpful for web UI and open source business model example
  • tailwindcss generates CSS
  • Used on the Lexchart app
  • Benefits of tailwindcss and tailwindui:
    • Just-in-Time makes it fast. Output includes only classes used for the project.
    • Stand on shoulders of design thinking from Steve Schoger and Adam Wathan. See also refactoingui.com.
    • Use in current projects without CSS conflicts. Custom namespace with prefix in tailwind.config.js. Bonus: custom namespace prefixes work with the tailwind plug-ins for VS Code and PyCharm.
    • Works well with template engines like, Chameleon. We use tailwind for our app UI. Toolbar template example.
    • Another example of docs and tutorials being a strategic business asset.
  • Resources
    • tailwindcss.com
    • tailwindlabs on YouTube, great tutorials from Simon at Tailwind
    • Beginner friendly tutorials: Thirus, example of tailwind install methods

Michael #4: PEP 690 – Lazy Imports

  • From Itamar
  • Discussion at https://discuss.python.org/t/pep-690-lazy-imports/15474
  • PEP proposes a feature to transparently defer the execution of imported modules until the moment when an imported object is used.
  • PEP 8 says imports go a the top, that means you pay the full price of importing code
  • This means that importing the main module of a program typically results in an immediate cascade of imports of most or all of the modules that may ever be needed by the program.
  • Lazy imports also mostly eliminate the risk of import cycles or crashes.
  • The implementation in this PEP has already demonstrated startup time improvements up to 70% and memory-use reductions up to 40% on real-world Python CLIs.

Brian #5: Two small items

  • pytest-rich
    • Suggested by Brian Skinn
    • Created by Bruno Oliveira as a proof of concept
    • pytest + rich, what’s not to love?
    • Now we just need a maintainer or two or three….
  • Embedding images in GitHub README
    • Suggested by Henrik Finsberg
    • Video by Anthony Sottile
    • This is WITHOUT putting the image in the repo.
    • Upload or drop an image to an issue comment.
      • Don’t save the comment, just wait for GitHub to upload it to their CDN.
      • GH will add a markdown link in the comment text box with a link to the now uploaded image.
      • Now you can use that image in a README file.
    • You can do the same while editing the README in the online editor.

Ben #6: pyotp

  • A library for generating and verifying one-time passwords (OTP).
  • Helpful for implementing multi-factor authentication (MFA) in web applications.
  • Supports HMAC-based one-time passwords (HOTP) and time-based one-time passwords (TOTP).
    • While HOTP delivered via SMS text messages is a common approach to implementing MFA, SMS is not really secure.
    • TOTP using an authenticator app on the user’s device such as Google Authenticator or Microsoft Authenticator is more secure, fairly easy to implement, and free (no SMS messaging fees and multiple free authenticator apps available for users).
    • TOTP works best by making a QR code available to simplify the setup for the user in their authenticator app. Lots of easy to implement QR code generators to choose from (qrcode is a popular one if you use javascript on the front end).

TOTP quick reference:

``` import pyotp

def generate_shared_secret(): # securely store this shared secret with user account data return pyotp.random_base32()

def generate_provisioning_uri(secret, email): # generate uri for a QR code from the user's shared secret and email address return pyotp.totp.TOTP(secret).provisioning_uri(name=email, issuer_name='YourApp')

def verify_otp(secret, otp): # verify user's one-time password entry with their shared secret totp = pyotp.TOTP(secret) return totp.verify(otp)

```

Extras

Brian:

  • PyConUS 2022 videos now up
  • A few more Python related extensions for VSCode
    • black, pylint, isort, and Jupyter PowerToys
  • Work has begun on a pytest course
    • Saying this in public to inspire me to finish it.
    • No ETA yet
  • Sad Python Girls Club podcast

Michael:

  • PyTorch M1
  • Mission Encodable
  • PWAs and pyscript
    • Michael's now released pyscript PWA YouTube video
  • cal.com (open source calendly)
  • Supabase (open source Firebase)

Joke: Beginner problems

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Brian #1:distinctipy

  • distinctipy is a lightweight python package providing functions to generate colours that are visually distinct from one another.”
  • Small, focused tool, but really cool.
  • Say you need to plot a dynamic number of lines.
  • Why not let distinctipy pick colors for you that will be distinct?
  • Also can display the color swatches.
  • Some example palettes here: https://github.com/alan-turing-institute/distinctipy/tree/main/examples

``` from distinctipy import distinctipy

number of colours to generate

N = 36

generate N visually distinct colours

colors = distinctipy.get_colors(N)

display the colours

distinctipy.color_swatch(colors)

```

Michael #2: Soda SQL

  • Soda SQL is a free, open-source command-line tool.
  • It utilizes user-defined input to prepare SQL queries that run tests on dataset in a data source to find invalid, missing, or unexpected data.
  • Looks good for data pipelines and other CI/CD work!

Daniel #3: Python in Nature

  • There’s a review article from Sept 2020 on array programming with NumPy in the research journal Nature.
  • For reference, in grad school we had a fancy paper on quantum entanglement that got rejected from Nature Communications, a sub-journal to Nature. Nature is hard to get into.
  • List of authors includes Travis Oliphant who started NumPy. Covers NumPy as the foundation, building up to specialized libraries like QuTiP for quantum computing.
  • If you search “Python” on their site, many papers come up. Interesting to see their take on publishing software work.

Brian #4: Supercharging GitHub Actions with Job Summaries

  • From a tweet by Simon Willison

    • and an article: GH Actions job summaries
    • Also, Ned Batchelder is using it for Coverage reports
    • “You can now output and group custom Markdown content on the Actions run summary page.”
    • “Custom Markdown content can be used for a variety of creative purposes, such as:

    • Aggregating and displaying test results

    • Generating reports
    • Custom output independent of logs”
    • Coverage.py example:

``` - name: "Create summary" run: | echo '### Total coverage: ${{ env.total }}%' >> $GITHUB_STEP_SUMMARY echo '${{ env.url }}' >> $GITHUB_STEP_SUMMARY

```

Michael #5:Language Summit is write up out

  • via Itamar, by Alex Waygood
    • Python without the GIL: A talk by Sam Gross
    • Reaching a per-interpreter GIL: A talk by Eric Snow
    • The "Faster CPython" project: 3.12 and beyond: A talk by Mark Shannon
    • WebAssembly: Python in the browser and beyond: A talk by Christian Heimes
    • F-strings in the grammar: A talk by Pablo Galindo Salgado
    • Cinder Async Optimisations: A talk by Itamar Ostricher
    • The issue and PR backlog: A talk by Irit Katriel
    • The path forward for immortal objects: A talk by Eddie Elizondo and Eric Snow
    • Lightning talks, featuring short presentations by Carl Meyer, Thomas Wouters, Kevin Modzelewski, Samuel Colvin and Larry Hastings

Daniel #6:AllSpice is Git for EEs

  • Software engineers have Git/SVN/Mercurial/etc
  • None of the other engineering disciplines (mechanical, electrical, optical, etc), have it nearly as good. Altium has their Vault and “365,” but there’s nothing with a Git-like UX.
  • Supports version history, diffs, all the things you expect. Even self-hosting and a Gov Cloud version.
  • “Bring your workflow to the 21st century, finally.”

Extras

Brian:

  • Will McGugan talks about Rich, Textual, and Textualize on Test & Code 188
  • Also 3 other episodes since last week. (I have a backlog I’m working through.)

Michael:

  • Power On-Xbox Documentary | Full Movie
  • The 4 Reasons To Branch with Git - Illustrated Examples with Python
  • A Python spotting - via Jason Pecor
  • 2022 StackOverflow Developer Survey is live, via Brian
  • TextSniper macOS App
  • PandasTutor on webassembly

Daniel:

  • I know Adafruit’s a household name, shout-out to Sparkfun, Seeed Studio, OpenMV, and other companies in the field.

Joke:

A little awkward

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored: RedHat: Compiler Podcast

Special guest: Tonya Sims

Michael #1: Pathy: a Path interface for local and cloud bucket storage

  • via Spencer
  • Pathy is a python package (with type annotations) for working with Cloud Bucket storage providers using a pathlib interface.
  • It provides an easy-to-use API bundled with a CLI app for basic file operations between local files and remote buckets.
  • It enables a smooth developer experience by letting developers work against the local file system during development and only switch over to live APIs for deployment.
  • Also has optional local file caching.
  • From Spenser
  • The really cool function is "Pathy.fluid" which can take any type of local, GCS, or S3 path string and then just give you back a Path object that you can interact with agnostic of what platform it was. So this has worked amazingly for me in local testing since i can just change the file path from the "s3://bucket/path" that i use in prod to a local "test_dir/path" and it works automatically.

Brian #2: Robyn

  • “Robyn is a fast, high-performance Python web framework with a Rust runtime.”
  • Hello, Robyn! - intro article
  • docs, repo
  • Neat things
    • doesn’t need WSGI or ASGI
    • async
    • very Flask-like
  • Early, so still needs some TLC
    • docs, etc. getting started and demo apps would be good.

Tonya #3: Python package 'nba_api' is a package to access data for NBA.com

  • This package is maintained by Swar Patel
  • API Client package for NBA.com, more accessible endpoints, and better documentation
  • The NBA.com API's are not well documented and change frequently (player traded, injured, retired, points per game, stats, etc)
  • The nba_api package has tons of features:
  • The nba_api starts with static data on players and teams (Full name, team name, etc). Each player and Team has an id.
  • Can get game data from the playergamelog API endpoint
  • The package also has many different API endpoints that it can hit by passing in features from the static data to the API endpoints as parameters

Michael #4: Termshot

  • From Jay Miller
  • Creates screenshots based on terminal command output
  • Just run termshot YOUR_CMD
  • or termshot --show-cmd -- python program.py
  • Even termshot /bin/zsh for full interactive “recording”
  • Example I made:

Brian #5: When Python can’t thread: a deep-dive into the GIL’s impact

  • Itamar Turner-Trauring
  • Building a mental model of the GIL using profiler graphs of simple two thread applications.
  • The graphs really help a lot to see when the CPU is active or waiting on each thread.

Tonya #6: Sportsipy: A free sports API written for python

  • Free python API that pulls the stats from www.sports-reference.com
  • sports-reference.com - great website for getting sports stats for professional sports(NBA, NFL, NHL, MLB, college sports)
  • Looks like an HTML website for the 90s - great for scraping (email site owners)
  • You can get API queries for every sport (North American sports) like the list of teams for that sport, the date and time of a game, the total number of wins for a team during the season, and many more team-related metrics.
  • You can also get stats from players and box scores - so you can build cool stuff around how a team performed during a game or during a season.

Extras

Michael:

  • Python 3.11.0 beta 1 is out
    • Test with GitHub Actions against Python 3.11

Joke: Finding my family

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by us! Support our work through:

  • Our courses at Talk Python Training
  • Test & Code Podcast
  • Patreon Supporters

Brian #1: pyscript

  • Python in the browser, from Anaconda. repo here
  • Announced at PyConUS
  • “During a keynote speech at PyCon US 2022, Anaconda’s CEO Peter Wang unveiled quite a surprising project — PyScript. It is a JavaScript framework that allows users to create Python applications in the browser using a mix of Python and standard HTML. The project’s ultimate goal is to allow a much wider audience (for example, front-end developers) to benefit from the power of Python and its various libraries (statistical, ML/DL, etc.).” from a nice article on it, PyScript — unleash the power of Python in your browser
  • PyScript is built on Pyodide, which is a port of CPython based on WebAssembly.
  • Demos are cool.
  • Note included in README: “This is an extremely experimental project, so expect things to break!”

Michael #2: Memray from Bloomberg

  • Memray is a memory profiler for Python.
  • It can track memory allocations in
    • Python code
    • native extension modules
    • the Python interpreter itself
  • Works both via CLI and focused app calls
  • Memray can help with the following problems:
    • Analyze allocations in applications to help discover the cause of high memory usage.
    • Find memory leaks.
    • Find hotspots in code which cause a lot of allocations.
  • Notable features:
    • 🕵️‍♀️ Traces every function call so it can accurately represent the call stack, unlike sampling profilers.
    • ℭ Also handles native calls in C/C++ libraries so the entire call stack is present in the results.
    • 🏎 Blazing fast! Profiling causes minimal slowdown in the application. Tracking native code is somewhat slower, but this can be enabled or disabled on demand.
    • 📈 It can generate various reports about the collected memory usage data, like flame graphs.
    • 🧵 Works with Python threads.
    • 👽🧵 Works with native-threads (e.g. C++ threads in native extensions)
  • Has a live view in the terminal.
  • Linux only

Brian #3: pytest-parallel

  • I’ve often sped up tests that can be run in parallel by using -n from pytest-xdist.
  • I was recommending this to someone on Twitter, and Bruno Oliviera suggested a couple of alternatives. One was pytest-parallel, so I gave it a try.
  • pytest-xdist runs using multiprocessing
  • pytest-parallel uses both multiprocessing and multithreading.
  • This is especially useful for test suites containing threadsafe tests. That is, mostly, pure software tests.
  • Lots of unit tests are like this. System tests are often not.
  • Use --workers flag for multiple processors, --workers auto works great.
  • Use --tests-per-worker for multi-threading. --tesst-per-worker auto let’s it pick.
  • Very cool alternative to xdist.

Michael #4: Pooch: A friend for data files

  • via via Matthew Fieckert
  • Just want to download a file without messing with requests and urllib?
  • Who is it for? Scientists/researchers/developers looking to simply download a file.
  • Pooch makes it easy to download a file (one function call). On top of that, it also comes with some bonus features:
    • Download and cache your data files locally (so it’s only downloaded once).
    • Make sure everyone running the code has the same version of the data files by verifying cryptographic hashes.
    • Multiple download protocols HTTP/FTP/SFTP and basic authentication.
    • Download from Digital Object Identifiers (DOIs) issued by repositories like figshare and Zenodo.
    • Built-in utilities to unzip/decompress files upon download
  • file_path = pooch.retrieve(url)

Extras

Michael:

  • New course! Up and Running with Git - A Pragmatic, UI-based Introduction.

Joke:

  • Don’t embarrass me in front of the wizards
  • Michael’s crashing github is embarrassing him in front of the wizards!

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored: RedHat: Compiler Podcast

Special guest: Anna Astori

Michael #1: Take Your Github Repository To The Next Level 🚀️

  • Step 0. Make Your Project More Discoverable
  • Step 1. Choose A Name That Sticks
  • Step 2. Display A Beautiful Cover Image
  • Step 3. Add Badges To Convey More Information
  • Step 4. Write A Convincing Description
  • Step 5. Record Visuals To Attract Users 👀
  • Step 6. Create A Detailed Installation Guide (if needed)
  • Step 7. Create A Practical Usage Guide 🏁
  • Step 8. Answer Common Questions
  • Step 9. Build A Supportive Community
  • Step 10. Create Contribution Guidelines
  • Step 11. Choose The Right License
  • Step 12. Plan Your Future Roadmap
  • Step 13. Create Github Releases (know release drafter)
  • Step 14. Customize Your Social Media Preview
  • Step 15. Launch A Website

Brian #2: Fastero

  • “Python timeit CLI for the 21st century.”
  • Arian Mollik Wasi, @wasi_master
  • Colorful and very usable benchmarking/comparison tool
  • Time or Compare one ore more
    • code snippet
    • python file
    • mix and match, even
  • Allows setup code before snippets run
  • Multiple output export formats: markdown, html, csv, json, images, …
  • Lots of customization possible
  • Takeaway
    • especially for comparing two+ options, this is super handy

Anna #3:

  • langid vs langdetect

langdetect

  • This library is a direct port of Google's language-detection library from Java to Python
  • langdetect supports 55 languages out of the box (ISO 639-1 codes):
  • Basic usage: detect() and detect_langs()
  • great to work with noisy data like social media and web blogs
  • being statistical, works better on larger pieces of text vs short posts

langid

  • hasn't been updated for a few years
  • 97 languages
  • can use Python's built-in wsgiref.simple_server (or fapws3 if available) to provide language identification as a web service. To do this, launch python langid.py -s, and access http://localhost:9008/detect . The web service supports GET, POST and PUT.
  • the actual calculations are implemented in the log-probability space but can also have a "confidence" score for the probability prediction between 0 and 1:

    from langid.langid import LanguageIdentifier, model identifier = LanguageIdentifier.from_modelstring(model, norm_probs=True) identifier.classify("This is a test") ('en', 0.9999999909903544)

  • minimal dependencies
  • relatively fast
  • NB algo, can train on user data.

Michael #4: Watchfiles

  • by Samual Colvin (of Pydantic fame)
  • Simple, modern and high performance file watching and code reload in python.
  • Underlying file system notifications are handled by the Notify rust library.
  • Supports sync watching but also async watching
  • CLI example
  • Running and restarting a command¶
    • Let's say you want to re-run failing tests whenever files change. You could do this with watchfiles using
    • Running a command: watchfiles 'pytest --lf``'

Brian #5: Slipcover: Near Zero-Overhead Python Code Coverage

  • From coverage.py twitter account, which I’m pretty sure is Ned Bachelder
  • coverage numbers with “3% or less overhead”
  • Early stages of the project.
  • It does seem pretty zippy though.
  • Mixed results when trying it out with a couple different projects
    • flask:
      • just pytest: 2.70s
      • with slipcover: 2.88s
      • with coverage.py: 4.36s
    • flask with xdist n=4
      • pytest: 2.11 s
      • coverage: 2.60s
      • slipcover: doesn’t run (seems to load pytest plugins)
  • Again, still worth looking at and watching. It’s good to see some innovation in the coverage space aside from Ned’s work.

Anna #6:

  • scrapy vs robox

scra-py

  • shell to try out things: fetch url, view response object, response.text
  • extract using css selectors or xpath
  • lets you navigate between levels e.g. the parent of an element with id X
  • crawler to crawl websites and spider to extract data
  • startproject for project structure and templates like settings and pipelines
  • some advanced features like specifying user-agents etc for large scale scraping.
  • various options to export and store the data
  • nice features like LinkExtractor to determine specific links to extract, already deduped.
  • FormRequest class

robox

  • layer on top of httpx and beautifulsoup4
  • allows to interact with forms on pages: check, choose, submit

Extras

Michael:

  • ohmyzsh + ohmyposh + mcfly + iterm2 + pls + nerdfonts = wow
  • Watch the video we discussed here

Joke:

  • Out for a byte

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Mergify!

Special guest: Pat Decker

Michael #0: New live stream / recording time: 12pm US PT on Tuesdays. Please subscribe to our YouTube channel to get notified and be part of the episodes.

Brian #1: BTW, don’t make a public repo private

  • How we lost 54k GitHub stars
    • Jakub Roztočil
    • HTTPie kinda sorta accidentally flipped their main repo to private for a sec.
    • And dropped the star count from 54k to 0
    • oops
    • They’re back up to 16k, as of today. But ouch.
  • “HTTPie is a command-line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. HTTPie is designed for testing, debugging, and generally interacting with APIs & HTTP servers. The http & https commands allow for creating and sending arbitrary HTTP requests. They use simple and natural syntax and provide formatted and colorized output.”
  • Actually, pretty cool tool to use for developing and testing APIs.

Michael #2: The counter-intuitive rise of Python in scientific computing

  • via Galen Swint
  • In our laboratory, a polarizing debate rages since around 2010, summarized by this question: Why are more and more time-critical scientific computations formerly performed in Fortran now written in Python, a slower language?
  • Python has the reputation of being slow, i.e. significantly slower than compiled languages such as Fortran, C or Rust.
  • So yes, plain Python is much slower than Fortran.
  • However, this comparison makes little sense, as scientific uses of Python do not rely on plain Python.
  • Used the right way, Python is slightly slower than compiled code.

Pat #3:

  • Meta donates $300,000 to PSF to add a second year for the Developer in Residence

Brian #4: Dashboards in Python

  • Two suggestions from Marc Skov Madsen
  • The Easiest Way to Create an Interactive Dashboard in Python
    • Sophia Yang & Mark Skov Madsen
    • Includes
      • animated gif showing the dashboard
      • video of Sophia walking through the article in under 6 minutes
    • “Turn Pandas pipelines into a dashboard using hvPlot .interactive"
    • hvPlot is part of HoloViz and this example is pretty short and amazing to get a great dashboard with controls up very quickly.
  • Python Dashboarding Shootout and Showdown | PyData Global 2021
    • 5 speakers, 4 dashboard libraries, nice for comparison.
    • Nice clickable index posted by Duy Nguyen
      • 00:00 - Begin and Welcome
      • 03:15 - Intro to the 4 Dashboarding libraries
      • 07:04 - Plotly - Nicolas Kruchten
      • 22:01 - Panel - Marc Skov Madsen
      • 37:38 - voila - Sylvain Corlay
      • 51:36 - Streamlit - Adrien Treuille
      • 01:10:52 - Discussion Topics

Michael #5: sourcepy

  • by Dave Chevell
  • Sourcepy lets you source python scripts natively inside your shell
  • Imagine a Python script with functions in it. This converts those to CLI commands (kind of like entrypoints, but simpler)
  • Type hints can be used to coerce input values into their corresponding types.
  • standard IO type hints can be used to target stdin at different arguments and to receive the sys.stdin
  • Sourcepy has full support for asyncio syntax

Pat #6: Xonsh

  • Xonsh Shell Combines the Best of Bash Shell and Python in Linux Terminal
  • Awesome demo video (50 min) https://youtu.be/x85LSyCxiw8

Extras

Pat:

  • Donate to the PSF by using https://rewards.microsoft.com

Joke: Can you really quit vim?

Joke: Forgetting how to count

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Datadog: pythonbytes.fm/datadog

Special guest: Brian Skinn (Twitter | Github)

Michael #1: OpenBB wants to be an open source challenger to Bloomberg Terminal

  • OpenBB Terminal provides a modern Python-based integrated environment for investment research, that allows an average joe retail trader to leverage state-of-the-art Data Science and Machine Learning technologies.
  • As a modern Python-based environment, OpenBBTerminal opens access to numerous Python data libraries in
    • Data Science (Pandas, Numpy, Scipy, Jupyter)
    • Machine Learning (Pytorch, Tensorflow, Sklearn, Flair)
    • Data Acquisition (Beautiful Soup, and numerous third-party APIs)
  • They have a discord community too
  • BTW, seem to be a successful open source project: OpenBB Raises $8.5M in Seed Round Funding Following Open Source Project Gamestonk Terminal's Success
  • Great graphics / gallery here.
  • Way more affordable than the $1,900/mo/user for the Bloomberg Terminal

Brian #2: Python f-strings

  • https://fstring.help
    • Florian Bruhin
    • Quick overview of cool features of f-strings, made with Jupyter
  • Python f-strings Are More Powerful Than You Might Think
    • Martin Heinz
    • More verbose discussion of f-strings
  • Both are great to up your string formatting game.

Brian S. #3: pyproject.toml and PEP 621 Support in setuptools

  • PEP 621: “Storing project metadata in pyproject.toml”
    • Authors: Brett Cannon, Dustin Ingram, Paul Ganssle, Pradyun Gedam, Sébastien Eustace, Thomas Kluyver, Tzu-ping Chung (Jun-Oct 2020)
    • Covers build-tool-independent fields (name, version, description, readme, authors, etc.)
  • Various tools had already implemented pyproject.toml support, but not setuptools
    • Including: Flit, Hatch, PDM, Trampolim, and Whey (h/t: Scikit-HEP)
    • Not Poetry yet, though it's under discussion
  • setuptools support had been discussed pretty extensively, and had been included on the PSF’s list of fundable packaging improvements
  • Initial experimental implementation spearheaded by Anderson Bravalheri, recently completed
    • Seeking testing and bug reports from the community (Discuss thread)
    • I tried it on one of my projects — it mostly worked, but revealed a bug that Anderson fixed super-quick (proper handling of a dynamic long_description, defined in setup.py)
  • Related tools (all early-stage/experimental AFAIK)
    • ini2toml (Anderson Bravalheri) — Can convert setup.cfg (which is in INI format) to pyproject.toml
      • Mostly worked well for me, though I had to manually fix a couple things, most of which were due to limitations of the INI format
        • INI has no list syntax!
    • validate-pyproject (Anderson Bravalheri) — Automated pyproject.toml checks
    • pyproject-fmt (Bernát Gábor) — Autoformatter for pyproject.toml
  • Don’t forget to use it with build, instead of via a python setup.py invocation!
    • $ pip install build $ python -m build
  • Will also want to constrain your setuptools version in the build-backend.requires key of pyproject.toml (you are using PEP517/518, right??)

Michael #4: JSON Web Tokens @ jwt.io

  • JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.
  • Basically a visualizer and debugger for JWTs
    • Enter an encoded token
    • Select a decryption algorithm
    • See the payload data
    • verify the signature
  • List of libraries, grouped by language

Brian #5: Autocorrect and other Git Tricks

`` - Waylon Walker - Usegit config --global help.autocorrect 10to have git automatically run the command you meant in 1 second. The10is 10 x 1/10 of a second. So50` for 5 seconds, etc.

```

  • Automatically set upstream branch if it’s not there
    • git config --global push.default current
    • You may NOT want to do this if you are not careful with your branches.
    • From https://stackoverflow.com/a/22933955
  • git commit -a
    • Automatically “add” all changed and deleted files, but not untracked files.
    • From https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--a
  • Now most of my interactions with git CLI, especially for quick changes, is: $ git checkout main $ git pull $ git checkout -b okken_something $ git commit -a -m 'quick message' $ git push
  • With these working, with autocorrect $ git chkout main $ git pll $ git comit -a -m 'quick message' $ git psh

Brian S. #6: jupyter-tempvars

  • Jupyter notebooks are great, and the global namespace of the Python kernel backend makes it super easy to flow analysis from one cell to another
  • BUT, that global namespace also makes it super easy to footgun, when variables leak into/out of a cell when you don’t want them to
  • jupyter-tempvars notebook extension
    • Built on top of the tempvars library, which defines a TempVars context manager for handling temporary variables
      • When you create a TempVars context manager, you provide it patterns for variable names to treat as temporary
      • In its simplest form, TempVars (1) clears matching variables from the namespace on entering the context, and then (2) clears them again upon exiting the context, and restoring their prior values, if any
      • TempVars works great, but it’s cumbersome and distracting to manually include it in every notebook cell where it’s needed
    • With jupyter-tempvars, you instead apply tags with a specific format to notebook cells, and the extension automatically wraps each cell’s code in a TempVars context before execution
  • Javascript adapted from existing extensions
    • Patching CodeCell.execute, from the jupyter_contrib_nbextensions ‘Execution Dependencies’ extension, to enclose the cell code with the context manager
    • Listening for the ‘kernel ready’ event, from [jupyter-black](https://github.com/drillan/jupyter-black/blob/d197945508a9d2879f2e2cc99cafe0cedf034cf2/kernel_exec_on_cell.js#L347-L350), to import the [TempVars](https://github.com/bskinn/jupyter-tempvars/blob/491babaca4f48c8d453ce4598ac12aa6c5323181/src/jupyter_tempvars/extension/jupyter_tempvars.js#L42-L46) context manager upon kernel (re)start
  • See the README (with animated GIFs!) for installation and usage instructions
    • It’s on PyPI: $ pip install jupyter-tempvars
    • And, I made a shortcut install script for it: $ jupyter-tempvars install && jupyter-tempvars enable
  • Please try it out, find/report bugs, and suggest features!
  • Future work
    • Publish to conda-forge (definitely)
    • Adapt to JupyterLab, VS Code, etc. (pending interest)

Extras

Brian:

  • Ok. Python issues are now on GitHub. Seriously. See for yourself.
  • Lorem Ipsum is more interesting than I realized.
  • O RLY Cover Generator
  • Example:

Michael:

  • New course: Secure APIs with FastAPI and the Microsoft Identity Platform
  • Pyenv Virtualenv for Windows (Sorta'ish)
  • Hipster Ipsum

Brian S.:

  • PSF staff is expanding
    • PSF hiring an Infrastructure Engineer
      • Link now 404s, perhaps they’ve made their hire?
    • Last year’s hire of the Packaging Project Manager (Shamika Mohanan)
    • Steering Council supports PSF hiring a second developer-in-residence
  • PSF has chosen its new Executive Director: Deb Nicholson!
  • PyOhio 2022 Call for Proposals is open
  • Teaser tweet for performance improvements to pydantic

Jokes:

https://twitter.com/CaNerdIan/status/1512628780212396036

https://www.reddit.com/r/ProgrammerHumor/comments/tuh06y/i_guess_we_all_have_been_there/

https://twitter.com/PR0GRAMMERHUM0R/status/1507613349625966599

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by: Microsoft for Startups Founders Hub.

Special guest: Vuyisile Ndlovu

Brian #1: dunk - a prettier git diff

  • Darren Burns
  • Uses Rich
  • “⚠️ This project is very early stages” - whatever, I like it.
  • Recommendation is to use less as a pager for it
    • git diff | dunk | less -R

Michael #2: Is your Python code vulnerable to log injection?

  • via Adam Parkin
  • Let’s just appreciate log4jmemes.com for a moment
  • Ok, now we can talk about Python
  • We can freak our the logging with line injection

``` "hello'.\nINFO:main:user 'alice' commented: 'I like pineapple pizza"

```

Results in two lines for one statement

``` INFO:main:user 'bob' commented: 'hello'. INFO:main:user 'alice' commented: 'I like pineapple pizza'.

```

  • The safest solution is to simply not log untrusted text. If you need to store it for an audit trail, use a database.
  • Alternatively, structured logging can prevent newline-based attacks.
  • Padding a ton? One such case is abusing padding syntax. Consider this message:
  • *"%(user)999999999s"*
  • This will pad the user with almost a gigabyte of whitespace.
  • Mitigation: To eliminate these risks, you should always let logging handle string formatting.
  • See this discussion: Safer logging methods for f-strings and new-style formatting

Vuyisile #3: Building multi tenant applications with Django

  • Free book by Agiliq, covers different approaches to building Software as a service applications in Python/Django.
  • Covers four approaches to multi tenancy, namely:
    1. Shared database with shared schema
    2. Shared database with isolated schema
    3. Isolated database with a shared app server
    4. Completely isolated tenants using Docker

Brian #4: Should you pre-allocate lists in Python?

  • Redowan Delowar
  • Discussion of 3 ways to build up a list
    • Start empty and append: l=[]; l.append(1); …
    • Pre-allocate: l = [None] * 10_000; …
    • List comprehension: l = [i for i in range(10_000)]
  • Interesting discussion and results
    • The times (filling the list with the index):
      • append: 499 µs ± 1.23 µs
      • pre-allocate: 321 µs ± 71.1
      • comprehension: 225 µs ± 711
    • Python lists dynamically allocate extra memory when they run out, and it’s pretty fast at doing this.
    • Pre-allocation can save a little time.
    • Conclusion: use comprehensions when you can, otherwise, don’t sweat it unless you really need to shave off as much time as possible
  • Of note: this was just measuring time, no discussion of memory usage.

Michael #5: mockaroo and tonic

  • Do you need to generate fake data?
  • Mockaroo let’s you generate realistic data based data types (car registrations, credit cards, dates, etc)
  • Tonic takes your actual production data and reworks it into test data (possibly striping out PII)

Vuyisile #6:

  • Brachiograph —the cheapest, simplest possible Python powered pen plotter by Daniele Procida
  • Low tech Raspberry Pi project that can be built for < $50 using common household objects like a clothes peg ice cream stick

Extras

Brian:

  • April 8 new date for Python Issues migrating to GH

Michael:

  • ngrok has a detailed web explorer

Vuyisile:

  • Thunder Client : VS Code extension, Lightweight client for testing REST APIs Postman alternative

Joke: Linux world in tatters

Related: Origin of the joke - Lapsus$ claims to leak 90% of Microsoft Bing's source code

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by: Microsoft for Startups Founders Hub.

Special guest: Thomas Gaigher, creator/maintainer pypyr taskrunner

Michael #1: March Package Madness

  • via Chris May
  • Start with 16 packages
  • They battle it out 2-on-2 in elimination rounds
  • Voting is once a week
  • So go vote!

Brian #2: nbpreview

  • “A terminal viewer for Jupyter notebooks. It’s like cat for ipynb files.”
  • Some cool features
    • pretty colors by default
      • piping strips formatting, so you can pass it to grep or other post processing
      • automatic paging
    • syntax highlighting
      • line numbers and wrapping work nicely
    • markdown rendering
    • images converted to block, character, or dots (braille)
    • dataframe rendering
    • clickable links

Thomas #3: pyfakefs

  • A fake file system!
  • It intercepts all calls that involve the filesystem in Python - e.g open(), shutil, or pathlib.Path.
  • This is completely transparent - your functional code does not know or need to know that under the hood it's been disconnected from the actual filesystem.
  • The nice thing about this is that you don't have to go patching open using mock_open - which works fine, but gets annoying quickly for more complex test scenarios.
    • E.g Doing a mkdir -p before a file write to ensure parent dirs exist.
  • What it looks like without a fake filesystem:

``` in_bytes = b"""[table] foo = "bar" # String """

read

with patch('pypyr.toml.open', mock_open(read_data=in_bytes)) as mocked_open: payload = toml.read_file('arb/path.in')

write

with io.BytesIO() as out_bytes: with patch('pypyr.toml.open', mock_open()) as mock_output: mock_output.return_value.write.side_effect = out_bytes.write toml.write_file('arb/out.toml', payload)

out_str = out_bytes.getvalue().decode()

mock_output.assert_called_once_with('arb/out.toml', 'wb')

assert out_str == """[table] foo = "bar" """

```

  • If you've ever tried to patch/mock out pathlib, you'll know the pain!
  • Also, no more annoying test clean-up routines or tempfile - as soon as the fake filesystem goes out of scope, it's gone, no clean-up required.
  • Not a flash in the pan - long history: originally developed by Mike Bland at Google back in 2006. Open sourced in 2011 on Google Code. Moved to Github and nowadays maintained by John McGehee.
  • This has been especially useful for pypyr, because as a task-runner or automation tool pypyr deals with wrangling config files on disk a LOT (reading, generating, editing, token replacing, globs, different encodings), so this makes testing so much easier.
    • Especially to keep on hitting the 100% test coverage bar!
  • Works great with pytest with the provided fs fixture.
    • Just add the fs fixture to a test, and all code under test will use the fake filesystem.
  • Dynamically switch between Linux, MacOs & Windows filesystems.
  • Set up paths/files in your fake filesystem as part of test setup with some neat helper functions.
  • Very responsive maintainers - I had a PR merged in less than half a day. Shoutout to mrbean-bremen.
  • Docs here: http://jmcgeheeiv.github.io/pyfakefs/release/
  • Github here: https://github.com/jmcgeheeiv/pyfakefs
  • Real world example:

``` @patch('pypyr.config.config.default_encoding', new='utf-16') def test_json_pass_with_encoding(fs): """Relative path to json should succeed with encoding.""" # arrange in_path = './tests/testfiles/test.json' fs.create_file(in_path, contents="""{ "key1": "value1", "key2": "value2", "key3": "value3" } """, encoding='utf-16')

# act
context = pypyr.parser.jsonfile.get_parsed_context([in_path])

# assert
assert context == {
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
}

def test_json_parse_not_mapping_at_root(fs): """Not mapping at root level raises.""" # arrange in_path = './tests/testfiles/singleliteral.json' fs.create_file(in_path, contents='123')

# act
with pytest.raises(TypeError) as err_info:
    pypyr.parser.jsonfile.get_parsed_context([in_path])

# assert
assert str(err_info.value) == (
    "json input should describe an object at the top "
    "level. You should have something like\n"
    "{\n\"key1\":\"value1\",\n\"key2\":\"value2\"\n}\n"
    "at the json top-level, not an [array] or literal.")

```

Michael #4: strenum

  • A Python Enum that inherits from str.
  • To complement enum.IntEnum in the standard library. Supports python 3.6+.
  • Example usage:

``` class HttpMethod(StrEnum): GET = auto() POST = auto() PUT = auto() DELETE = auto()

assert HttpMethod.GET == "GET"

```

Use wherever you can use strings, basically:

``` ## You can use StrEnum values just like strings:

import urllib.request

req = urllib.request.Request('https://www.python.org/', method=HttpMethod.HEAD)
with urllib.request.urlopen(req) as response:
   html = response.read()

```

Can auto-translate casing with LowercaseStrEnum and UppercaseStrEnum.

Brian #5: Code Review Guidelines for Data Science Teams

  • Tim Hopper
  • Great guidelines for any team
  • What is code review for?
    • correctness, familiarity, design feedback, mutual learning, regression protection
    • NOT opportunities for
      • reviewer to impose their idiosyncrasies
      • dev to push correctness responsibility to reviewers
      • demands for perfection
  • Opening a PR
    • informative commit messages
    • consider change in context of project
    • keep them short
    • write a description that helps reviewer
    • include tests with new code
  • Reviewing
    • Wait for CI before starting
      • I would also add “wait at least 10 min or so, requester might be adding comments”
    • Stay positive, constructive, helpful
    • Clarify when a comment is minor or not essential for merging, preface with “nit:” for example
    • If a PR is too large, ask for it to be broken into smaller ones
    • What to look for
      • does it look like it works
      • is new code in the right place
      • unnecessary complexity
      • tests

Thomas #6: Shell Power is so over. Leave the turtles in the late 80ies.

  • Partly inspired by/continuation of last week’s episode’s mention of running subprocesses from Python.
  • Article by Itamar Turner-Trauring
    • Please Stop Writing Shell Scripts https://pythonspeed.com/articles/shell-scripts/
  • Aims mostly at bash, but I'll happily include bourne, zsh etc. under the same dictum
  • If nothing else, solid listing of common pitfalls/gotchas with bash and their remedies, which is educational enough in and of itself already.
    • TLDR; Error handling in shell is hard, but also surprising if you're not particularly steeped in the ways of the shell.
    • Error resumes next, unset vars don't raise errors, piping & sub shells errs thrown away
  • If you really-eally HAVE to shell, you prob want this boilerplate on top (aka unofficial bash strict mode:

```

!/bin/bash

set -euo pipefail
IFS=$'\n\t'

```

  • This will,
    • -e: fail immediately on error
    • -u: fail on Unset vars
    • -o pipefail: raise immediately when piping
    • IFS: set Internal Field Separator to newline | tab, rather than space | newline | tab.
      • Prevents surprises when iterating over strings with spaces in them
  • Itamar lists common counter-arguments from shell script die-hards:
    • It's always there!
      • But so is the runtime of whatever you're actually coding in, and in the case of a build CI server. . .almost by definition.
    • Git gud! (I'm paraphrasing)
    • Shell-check (linting for bash, basically)
  • The article is short & sweet - mercifully so in these days of padded content.
  • The rest is going to be me musing out loud, so don't blame the OG author. So expanding on this, I think there're a couple of things going on here:
  • If anything, the author is going a bit soft on your average shell script. If you’re just calling a couple of commands in a row, okay, fine. But the moment you start worrying about retrying on failure, parsing some values into or out of some json, conditional branching - which, if you are writing any sort of automation script that interacts with other systems, you WILL be doing - shell scripts are an unproductive malarial nightmare.
    • Much the same point applies to Makefile. It’s an amazing tool, but it’s also misused for things it was never really meant to do. You end up with Makefiles that call shell scripts that call Makefiles. . .
  • Given that coding involves automating stuff, amazingly often the actual automation of the development process itself is deprioritized & unbudgeted.
  • Sort of like the shoemaker's kid not having shoes.
    • Partly because when management has to choose between shiny new features and automation, shiny new features win every time.
    • Partly because techies will just "quickly" do a thing in shell to solve the immediate problem… Which then becomes part of the firmament like a dead dinosaur that fossilises and more and more inscrutable layers accrete on top of the original "simple" script.
    • Partly because coders would rather get on with clever but marginal micro-optimisations and arguing over important stuff like spaces vs tabs, rather than do the drudge work of automating the development/deployment workflow.
  • There's the glimmering of a point in there somewhere: when you have to choose between shiny new features & more backoffice automation, shiny new features probably win.
    • Your competitiveness in the marketplace might well depend on this.
    • BUT, we shouldn’t allow the false idea that shell scripts are "quicker" or "lighter touch" to sneak in there alongside the brutal commercial reality of trade-offs on available budget & time.
    • If you have to automate quickly, it's more sensible to use a task-runner or just your actual programming language. If you're in python already, you're in luck, python's GREAT for this.
  • Don’t confuse excellent cli programs like git , curl , awscli, sed or awk with a shell script. These are executables, you don’t need the shell to invoke these.
  • Aside from these empirical factors, a couple of psychological factors also.
    • Dealing with hairy shell scripts is almost a Technocratic rite of passage - coupled with imposter syndrome, it's easy to be intimidated by the Shell Bros who're steeped in the arcana of bash.
    • It's the tech equivalent of "back in my day, we didn't even have <<>>", as if this is a justification for things being more difficult than they need to be ever thereafter.
    • This isn't Elden Ring, the extra difficulty doesn't make it more fun. You're trying to get business critical work done, reliably & quickly, so you can get on with those new shiny features that actually pay the bills.

Extras

Michael:

  • A changing of the guard
    • Firefox → Vivaldi
      • (here’s a little more info on the state of Firefox/Mozilla financially)
      • (threat team is particularly troubling)
    • Google email/drive/etc → Zoho
    • @gmail.com to @customdomain.com
    • Google search → DuckDuckGo
    • BTW Calendar apps/integrations and email clients are trouble

Joke: A missed opportunity - and cybersecurity

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by FusionAuth: pythonbytes.fm/fusionauth

Special guest: Ian Hellen

Brian #1: gensim.parsing.preprocessing

  • Problem I’m working on
    • Turn a blog title into a possible url
      • example: “Twisted and Testing Event Driven / Asynchronous Applications - Glyph”
      • would like, perhaps: “twisted-testing-event-driven-asynchrounous-applications”
  • Sub-problem: remove stop words ← this is the hard part
  • I started with an article called Removing Stop Words from Strings in Python
    • It covered how to do this with NLTK, Gensim, and SpaCy
    • I was most successful with remove_stopwords() from Gensim
      • from gensim.parsing.preprocessing import remove_stopwords
      • It’s part of a gensim.parsing.preprocessing package
  • I wonder what’s all in there?
    • a treasure trove
    • gensim.parsing.preprocessing.preprocess_string is one
    • this function applies filters to a string, with the defaults almost being just what I want:
      • strip_tags()
      • strip_punctuation()
      • strip_multiple_whitespaces()
      • strip_numeric()
      • remove_stopwords()
      • strip_short()
      • stem_text() ← I think I want everything except this
        • this one turns “Twisted” into “Twist”, not good.
  • There’s lots of other text processing goodies in there also.
  • Oh, yeah, and Gensim is also cool.
    • topic modeling for training semantic NLP models
  • So, I think I found a really big hammer for my little problem.
    • But I’m good with that

Michael #2: DevDocs

  • via Loic Thomson
  • Gather and search a bunch of technology docs together at once
  • For example: Python + Flask + JavaScript + Vue + CSS
  • Has an offline mode for laptops / tablets
  • Installs as a PWA (sadly not on Firefox)

Ian #3: MSTICPy

  • MSTICPy is toolset for CyberSecurity investigations and hunting in Jupyter notebooks.
  • What is CyberSec hunting/investigating? - responding to security alerts and threat intelligence reports, trawling through security logs from cloud services and hosts to determine if it’s a real threat or not.
  • Why Jupyter notebooks?
    • SOC (Security Ops Center) tools can be excellent but all have limitations
    • You can get data from anywhere
    • Use custom analysis and visualizations
    • Control the workflow…. workflow is repeatable
  • Open source pkg - created originally to support MS Sentinel Notebooks but now supports lots of providers. When I start this 3+ yrs ago I thought a lot this would be in PyPI - but no 😞
  • MSTICPy has 4 main functional areas:
    • Data querying - import log data (Sentinel, Splunk, MS Defender, others…working on Elastic Search)
    • Enrichment - is this IP Address or domain known to be malicious?
    • Analysis - extract more info from data, identify anomalies (simple example - spike in logon failures)
    • Visualization - more specialized than traditional graphs - timelines, process trees.
  • All components use pandas, Bokeh for visualizations
  • Current focus on usability, discovery of functionality and being able to chain
  • Always looking for collaborators and contributors - code, docs, queries, critiques
  • https://github.com/microsoft/msticpy
  • https://msticpy.readthedocs.io/

Brian #4: The Right Way To Compare Floats in Python

  • David Amos
  • Definitely an easier read than the classic What Every Computer Scientist Should Know About Floating-Point Arithmetic
    • What many of us remember
      • floating point numbers aren’t exact due to representation limitations and rounding error,
      • errors can accumulate
      • comparison is tricky
  • Be careful when comparing floating point numbers, even simple comparisons, like:

    0.1 + 0.2 == 0.3 False 0.1 + 0.2 <= 0.3 False

  • David has a short but nice introduction to the problems of representation and rounding.
  • Three reasons for rounding
    • more significant digits than floating point allows
    • irrational numbers
    • rational but non-terminating
  • So how do you compare:
    • math.isclose()
      • be aware of rel_tol and abs_tol and when to use each.
    • numpy.allclose(), returns a boolean comparing two arrays
    • numpy.isclose(), returns an array of booleans
    • pytest.approx(), used a bit differently
      • 0.1 + 0.2 == pytest.approx(0.3)
      • Also allows rel and abs comparisons
  • Discussion of Decimal and Fraction types
    • And the memory and speed hit you take on when using them.

Michael #5: Pypyr

  • Task runner for automation pipelines
  • For when your shell scripts get out of hand. Less tricky than makefile.
  • Script sequential task workflow steps in yaml
  • Conditional execution, loops, error handling & retries
  • Have a look at the getting started.

Ian #6: Pygments

  • Python package that’s useful for anyone who wants to display code
    • Jupyter notebook Markdown and GitHub markdown let you display code with syntax highlighting. (Jupyter uses Pygments behind the scenes to do this.)
    • There are tools that convert code to image format (PNG, JPG, etc) but you lose the ability to copy/paste the code
  • Pygments can intelligently render syntax-highlighted code to HTML (and other formats)
  • Applications:
    • Documentation (used by Sphinx/ReadtheDocs) - render code to HTML + CSS
    • Displaying code snippets dynamically in readable form
  • Lots (maybe 100s) of code lexers - Python (code, traceback), Bash, C, JS, CSS, HTML, also config and data formats like TOML, JSON, XML
  • Easy to use - 3 lines of code - example:

``` from IPython.display import display, HTML from pygments import highlight from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter

code = """ def print_hello(who="World"): message = f"Hello {who}" print(message) """ display(HTML( highlight(code, PythonLexer(), HtmlFormatter(full=True, nobackground=True)) ))

use HtmlFormatter(style="stata-dark", full=True, nobackground=True)

for dark themes

```

  • Output to HTML, Latex, image formats.
  • We use it in MSTICPy for displaying scripts used in attacks. Example:

Extras

Brian:

  • smart-open
    • one of the 3 Gensim dependencies
    • It’s for streaming large files, from really anywhere, and looks just like Python’s open().

Michael:

  • Python 3.10.3 is out.
  • git fixup (follow up from last week, via Adam Parkin)

Joke: What’s your secret?

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Special guest: Emily Morehouse-Valcarcel

Michael #1: Async and await with subprocesses

  • by Fredrik Averpil
  • People know I do all sorts of stuff with async
  • Lots of cool async things are not necessarily built into Python, but our instead third-party packages
  • E.g. files via aiofiles
  • But asyncio has asyncio.create_subprocess_exec
  • Fredrik’s article has some nice examples
  • I started using this for mp3 uploads and behind the scenes processing for us

Brian #2: Typesplainer

  • Arian Mollik Wasi, @wasi_master
  • Suggested by Will McGugan
  • Now released a vscode extension for that! Available on vscode as typesplainer

Emily #3: Ibis Project

  • via Marlene Mhangami
  • “Productivity-centric Python data analysis framework for SQL engines and Hadoop” focused on:
    • Type safety
    • Expressiveness
    • Composability
    • Familiarity
  • Marlene wrote an excellent blog post as an introduction
  • Works with tons of different backends, either directly or via compilation
    • Depending on the backend, it actually uses SQLAlchemy under the hood
  • There’s a ton of options for interacting with a SQL database from Python, but Ibis has some interesting features geared towards performance and analyzing large sets of data. It’s a great tool for simple projects, but an excellent tool for anything data science related since it plays so nicely with things like pandas

Michael #4: ASV

  • via Will McGugan
  • AirSpeed Velocity (asv) is a tool for benchmarking Python packages over their lifetime.
  • Runtime, memory consumption and even custom-computed values may be tracked.
  • See quickstart
  • Example of astropy here.
  • Finding a commit that produces a large regression

Brian #5: perflint

  • Anthony Shaw
  • pylint extension for performance anti patterns
    • curious why a pylint extension and not a flake8 plugin.
  • I think the normal advice of “beware premature optimization” is good advice.
  • But also, having a linter show you some code habits you may have that just slow things down is a nice learning tool.
  • Many of these items are also not going to be the big show stopper performance problems, but they add unnecessary performance hits.
  • To use this, you also have to use pylint, and that can be a bit painful to start up with, as it’s pretty picky.
    • Tried it on a tutorial project today, and it complained about any variable, or parameter under 3 characters. Seems a bit picky to me for tutorials, but probably good advice for production code.
    • These are all configurable though, so you can dial back the strictness if necessary.
  • perflint checks:
    • W8101 : Unnessecary list() on already iterable type
    • W8102: Incorrect iterator method for dictionary
    • W8201: Loop invariant statement (loop-invariant-statement) ←- very cool
    • W8202: Global name usage in a loop (loop-invariant-global-usage)
    • R8203 : Try..except blocks have a significant overhead. Avoid using them inside a loop (loop-try-except-usage).
    • W8204 : Looped slicing of bytes objects is inefficient. Use a memoryview() instead (memoryview-over-bytes)
    • W8205 : Importing the "%s" name directly is more efficient in this loop. (dotted-import-in-loop)

Emily #6: PEP 594 Acceptance

  • “Removing dead batteries from the standard library”
  • Written by Christian Heimes and Brett Cannon back in 2019, though the conversation goes back further than that
    • It’s a very thin line for modules that might still be useful to someone versus the development effort needed to maintain them.
  • Recently accepted, targeting Python 3.11 (final release planned for October 2022, development begins in May 2021. See the full release schedule)
  • Deprecations will begin in 3.11 and modules won’t be fully removed until 3.13 (~October 2024)
  • See the full list of deprecated modules
  • Bonus: new PEP site and theme!

Extras

Brian: Michael:

Emily:

  • Riff off of one of Brian’s topics from last week:
    • Automate your interactive rebases with fixups and auto-squashing
  • Cool award that The PSF just received
  • PSF Spring Fundraiser
  • Cuttlesoft is hiring!

Jokes:

  • Changing (via Ruslan)
  • Please hire me

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Microsoft for Startups Founders Hub.

Special guest: Anne Barela

Brian #1: The Adam Test : 12 Questions for New Dependencies

  • Found through a discussion with Ryan Cheley, who will be on an upcoming episode of Test & Code, talking about Managing Software Teams.
  • The Joel Test dates back to 2000, and some of it is a bit dated. I should probably do a Test & Code episode or pythontest article on my opinions of this at some point.
    • Nice shameless plugs, don’t you think?
    • The Joel Test is 12 questions and is a “highly irresponsible, sloppy test to rate the quality of a software team.”
  • “The Adam Test” is 12 questions “to decide whether a new package we’re considering depending on is well-maintained.”
    • He’s calling it “The Well-Maintained Test”, but I like “The Adam Test”
  • Here’s the test:
    • Is it described as “production ready”?
    • Is there sufficient documentation?
    • Is there a changelog?
    • Is someone responding to bug reports?
    • Are there sufficient tests?
    • Are the tests running with the latest language version?
      • like Python 3.10, of course
    • Are the tests running with the latest integration version?
      • Examples include Django, PostgreSQL, etc.
    • Is there a Continuous Integration (CI) configuration?
    • Is the CI passing?
    • Does it seem relatively well used?
    • Has there been a commit in the last year?
    • Has there been a release in the last year?
  • Article has a short discussion of each.
  • What score is good? That’s up to you to decide.
  • But these questions are good to think about for your dependencies.
  • I also think I’ll use these questions for my own projects.
    • I’ve got a README.md, but do I need more examples in it? Should I have RTD docs for it?
    • Have I updated the test matrix to include the newest versions of Python, etc?
    • Have I hooked up CI?

Michael #2: Validate emails with email-validator

  • When you think about validating emails, you probably think regex (or just nothing)
  • Regex is fine but so is this email: jane_doe@domain_that_doesnt_exist.com
  • Problem is (at the time of the recording), domain_that_doesnt_exist.com is not a website.
  • What about unicode variations that are technically the same but visually different?
  • If the passed email address is valid, the validate_email() method will return an object containing a normalized form of the passed email address.

Anne #3: The Python on Microcontrollers Newsletter

One of my main focuses at Adafruit since the pandemic started is as editor of the Python on Microcontrollers Newsletter.

  • With a weekly distribution of almost 9,400 subscribers, it’s the largest newsletter of it’s kind.
  • It mainly focuses on CircuitPython and MicroPython and also discusses Python on single board computers (SBC) like Raspberry Pi.
  • News about Python with a small computer emphasis
  • Folks may subscribe by going to https://www.adafruitdaily.com/ which is separate from adafruit.com. The information is not sold or used for marketing and it’s easy to unsubscribe (no “do you really want to do this, please reconsider…)
  • The challenge, like for Python Bytes and other publications, is to find content. I scour the internet, with a bit of a focus on Twitter as I have an active account there. We encourage others to put in issues and Pull Requests on the newsletter GitHub, email information to cpnews@adafruit.com and using hashtag CircuitPython or MicroPython on Twitter.

Brian #4: Git Organized: A Better Git Flow

  • Annie Sexton
  • Found through Changelog episode 480: Get your reset on
  • A possible and common git workflow
    • Branch off of a main branch to a personal dev branch
    • Commit and Push during development to save your work
    • When ready to merge, make a PR
  • Problems
    • Commits are hard to follow and messy, not ever really intended to separate parts of the workflow or anything.
    • Commits are therefore useless in helping someone code review large changes.
  • Annie’s workflow
    • Branch off of a main branch to a personal dev branch
    • Commit and Push during development to save your work. But don’t worry to much about commit messages, “WIP” is sufficient. Or a note to yourself.
    • When ready to merge
      • git reset origin/main
      • Re-commit all changes in a logical order that makes more sense than the way the work actually happened.
      • These will be several commits, with descriptive messages.
      • Even partial commits, if there are unrelated changes in a file, work with this process
      • Push all the new commits. (Is --force going to be necessary?)
      • Create a PR.
    • Now there are a set of commits that are actually helpful to break up large PRs into small chunks that tell a story.
  • I’m looking to try this soon to see how it goes

Michael #5: CPython issues moving to GitHub soon

  • Update by The Python Developer in Residence, Łukasz Langa
  • The Steering Council is working on migrating the data that is currently residing in Roundup at https://bugs.python.org/ (BPO) into the GitHub issues of the CPython repository hosted there.
  • Laid out in PEP 581 -- Using GitHub Issues for CPython
  • The ultimate goal is to move user- and core developer-provided issue-reporting entirely to Github.
  • Each issue that currently exists on BPO will include metadata indicating where it was moved on Github.
  • New issues will only exist on Github.
  • Feedback, please: At the current stage, we’re asking you to take a look at the links and important dates below, and share any feedback you might have.
  • Timeline:
    • Friday, March 11th 2022: Github starts transfer of the issues in the temporary repository to github.com/python/cpython/ .
    • The migration is estimated to take anywhere from 3 to 7 days, depending on the load on Github.com.

Anne #6: MicroPython, CircuitPython and GitHub

  • What are Microcontrollers and Single Board Computers (SBCs)?
  • Why not use CPython on Microcontrollers?
  • MicroPython was originally created by the Australian programmer and theoretical physicist Damien George, after a successful Kickstarter backed campaign in 2013. Originally it only ran on a number of boards and was based on Python 3.4.
  • CircuitPython was forked from MicroPython in 2017 by Adafruit Industries.
  • Both MicroPython and CircuitPython are Open Source under MIT Licenses so adoption and modification by anyone is easy.
  • Why fork CircuitPython? 1) Make a requirement that CircuitPython boards can enumerate to computers as a USB thumb drive to add or change code files with any text editor. 2) Aim to make CircuitPython use CPython library syntax whenever possible. 3) Make it easy to use and understand for beginners yet powerful for more advanced users.
  • All CircuitPython code is on GitHub. GitHub Actions is used on repos like the Adafruit Learning System code to automate CI with Pylint, Black, and ensuring code has proper SPDX author and license tags, which is a new addition this year.
  • Currently there are 283 microcontroller boards compatible with CircuitPython and 87 single board computers can use CircuitPython libraries in CPython via the Adafruit Blinka abstraction layer. Code portability between boards requires little if any changes.
  • There are 346 CircuitPython libraries (all on PyPI / pip as well as GitHub) covering a wide range of hardware and real world needs. From blinking LEDs to using ulab (microlab), a subset of numpy, for data crunching.
  • I just counted and there are exactly 1,000 Adafruit Learning System guides referencing CircuitPython, all free and open source/MIT licensed. https://learn.adafruit.com/

Extras

Brian:

  • Quick read: The Thirty Minute Rule, by Daniel Roy Greenfield
    • summary: Stuck on a software problem for 30 min? Ask for help.

Michael:

  • The CircuitPython Show by Paul Cutler
  • Follow up from my Python 3 == Active Python 3? James wrote:
  • In episode #273, you guys were discussing supporting "Python 3" to mean any currently supported version of Python rather than "Python 3.7+" or similar. That's a really bad idea. There are still tons of people using unsupported versions of Python, and they're not all invalid use cases. For example, I am one of the upstream maintainers for cloud-init, and I was only recently able to remove Python 3.5 in order to make 3.6 our minimum supported version (which will continue for the next year). The reason is that our main consumers are downstream distro packagers (ubuntu, red hat, fedora, etc), and it's not uncommon for software released into long-term supported OS releases to be supported for 5-10 years or more. If I fire up an Ubuntu Trusty container, which still receives extended support until 2024, I get Python 3.4. So even though 3.4 is unsupported by Python upstream, it is still absolutely in use and supported by OS manufacturers.

Joke: A case of the Mondays

View Details

Watch the live stream:

Watch on YouTube

About the show

Sponsored by Datadog: pythonbytes.fm/datadog

Michael #1: Physics Breakthrough as AI Successfully Controls Plasma in Nuclear Fusion Experiment

  • Interesting break through using AI
  • Is Python at the center of it?
  • With enough digging, the anwswer is yes, and we love it!

Brian #2: PEP 680 -- tomllib: Support for Parsing TOML in the Standard Library

  • Accepted for Python 3.11
  • This PEP proposes basing the standard library support for reading TOML on the third-party library tomli

Michael #3: Thread local

  • threading.local: A class that represents thread-local data. Thread-local data are data whose values are thread specific.
  • Just create an instance of local (or a subclass) and store attributes on it
  • You can even subclass it.

Brian #4: What is a generator function?

  • Trey Hunner
  • Super handy, and way easier than you think, if you’ve never written your own.
  • Really, it’s just a function that uses yield instead of return and supplies one element at a time instead of returning a list or dict or tuple or other large structure.
  • Some details
    • generator functions return generator objects
    • generator objects are on pause and use the built in next() function to get next item.
    • they raise StopIteration when done.
    • Most generally used from for loops.
    • Generator objects cannot be re-used when exhausted
      • but you can get a new one with the next for loop you use. So, it’s all good.

Michael #5: dirty-equals

  • via Will McGugan, by Samual Colvin
  • Doing dirty (but extremely useful) things with equals.

``` from dirty_equals import IsPositive

assert 1 == IsPositive assert -2 == IsPositive # this will fail!

```

``` user_data = db_conn.fetchrow('select * from users') assert user_data == { 'id': IsPositiveInt, 'username': 'samuelcolvin', 'avatar_file': IsStr(regex=r'/[a-z0-9-]{10}/example.png'), 'settings_json': IsJson({'theme': 'dark', 'language': 'en'}), 'created_ts': IsNow(delta=3), }

```

Brian #6: Commitizen

  • from the docs
    • Command-line utility to create commits with your rules. Defaults: Conventional commits
    • Display information about your commit rules (commands: schema, example, info)
    • Bump version automatically using semantic versioning based on the commits. Read More
    • Generate a changelog using Keep a changelog
  • considering using for consistent commit message formatting
  • can be used with python-semantic-release for automatic semantic versioning
  • learned about it in 10 Tools I Wish I Knew When I Started Working with Python
  • questions
    • anyone using this or something similar?
    • does this make sense for small to medium sized projects? or overkill?

Extras:

  • pytest book
    • 40% off sale continues through March 19 for eBook
    • Amazon lists the book as “shipping in 1-2 days”, as of March 2

Michael:

  • Pronouncing the Python Walrus operator := as “becomes”
  • Via John Sheehan: String methods startswith() and endswith() can take a tuple as its first argument that lets you check for multiple values with one call:

``` >>> x = "abcdefg" >>> x.startswith(("ab", "cd", "ef"), 2) True

```

Joke: CS Background

View Details

See the full show notes for this episode on the website at pythonbytes.fm/272

View Details

See the full show notes for this episode on the website at pythonbytes.fm/271

View Details

See the full show notes for this episode on the website at pythonbytes.fm/270

View Details

See the full show notes for this episode on the website at pythonbytes.fm/269

View Details

See the full show notes for this episode on the website at pythonbytes.fm/268

View Details

See the full show notes for this episode on the website at pythonbytes.fm/267

View Details

See the full show notes for this episode on the website at pythonbytes.fm/265

View Details

See the full show notes for this episode on the website at pythonbytes.fm/264

View Details

See the full show notes for this episode on the website at pythonbytes.fm/263

View Details

See the full show notes for this episode on the website at pythonbytes.fm/262

View Details

See the full show notes for this episode on the website at pythonbytes.fm/261

View Details

See the full show notes for this episode on the website at pythonbytes.fm/260

View Details

See the full show notes for this episode on the website at pythonbytes.fm/259

View Details

See the full show notes for this episode on the website at pythonbytes.fm/258

View Details

See the full show notes for this episode on the website at pythonbytes.fm/257

View Details

See the full show notes for this episode on the website at pythonbytes.fm/256

View Details

See the full show notes for this episode on the website at pythonbytes.fm/255

View Details

See the full show notes for this episode on the website at pythonbytes.fm/254

View Details

See the full show notes for this episode on the website at pythonbytes.fm/253

View Details

See the full show notes for this episode on the website at pythonbytes.fm/252

View Details

See the full show notes for this episode on the website at pythonbytes.fm/251

View Details

See the full show notes for this episode on the website at pythonbytes.fm/250

View Details

See the full show notes for this episode on the website at pythonbytes.fm/249

View Details

See the full show notes for this episode on the website at pythonbytes.fm/248

View Details

See the full show notes for this episode on the website at pythonbytes.fm/247

View Details

See the full show notes for this episode on the website at pythonbytes.fm/246

View Details

See the full show notes for this episode on the website at pythonbytes.fm/245

View Details

See the full show notes for this episode on the website at pythonbytes.fm/244

View Details

See the full show notes for this episode on the website at pythonbytes.fm/243

View Details

See the full show notes for this episode on the website at pythonbytes.fm/242

View Details

See the full show notes for this episode on the website at pythonbytes.fm/241

View Details

See the full show notes for this episode on the website at pythonbytes.fm/240

View Details

See the full show notes for this episode on the website at pythonbytes.fm/239

View Details

See the full show notes for this episode on the website at pythonbytes.fm/238

View Details

See the full show notes for this episode on the website at pythonbytes.fm/237

View Details

See the full show notes for this episode on the website at pythonbytes.fm/236

View Details

See the full show notes for this episode on the website at pythonbytes.fm/235

View Details

See the full show notes for this episode on the website at pythonbytes.fm/234

View Details

See the full show notes for this episode on the website at pythonbytes.fm/233

View Details

See the full show notes for this episode on the website at pythonbytes.fm/232

View Details

See the full show notes for this episode on the website at pythonbytes.fm/231

View Details

See the full show notes for this episode on the website at pythonbytes.fm/230

View Details

See the full show notes for this episode on the website at pythonbytes.fm/229

View Details

See the full show notes for this episode on the website at pythonbytes.fm/228

View Details

See the full show notes for this episode on the website at pythonbytes.fm/227

View Details

See the full show notes for this episode on the website at pythonbytes.fm/226

View Details

See the full show notes for this episode on the website at pythonbytes.fm/225

View Details

See the full show notes for this episode on the website at pythonbytes.fm/224

View Details

See the full show notes for this episode on the website at pythonbytes.fm/223

View Details

See the full show notes for this episode on the website at pythonbytes.fm/222

View Details

See the full show notes for this episode on the website at pythonbytes.fm/221

View Details

See the full show notes for this episode on the website at pythonbytes.fm/220

View Details

See the full show notes for this episode on the website at pythonbytes.fm/219

View Details

See the full show notes for this episode on the website at pythonbytes.fm/218

View Details

See the full show notes for this episode on the website at pythonbytes.fm/217

View Details

See the full show notes for this episode on the website at pythonbytes.fm/216

View Details

See the full show notes for this episode on the website at pythonbytes.fm/215

View Details

See the full show notes for this episode on the website at pythonbytes.fm/214

View Details

See the full show notes for this episode on the website at pythonbytes.fm/213

View Details

See the full show notes for this episode on the website at pythonbytes.fm/212

View Details

See the full show notes for this episode on the website at pythonbytes.fm/211

View Details

See the full show notes for this episode on the website at pythonbytes.fm/210

View Details

See the full show notes for this episode on the website at pythonbytes.fm/209

View Details

See the full show notes for this episode on the website at pythonbytes.fm/208

View Details

See the full show notes for this episode on the website at pythonbytes.fm/207

View Details

See the full show notes for this episode on the website at pythonbytes.fm/206

View Details

See the full show notes for this episode on the website at pythonbytes.fm/205

View Details

See the full show notes for this episode on the website at pythonbytes.fm/204

View Details

See the full show notes for this episode on the website at pythonbytes.fm/203

View Details

See the full show notes for this episode on the website at pythonbytes.fm/202

View Details

See the full show notes for this episode on the website at pythonbytes.fm/201

View Details

See the full show notes for this episode on the website at pythonbytes.fm/200

View Details

See the full show notes for this episode on the website at pythonbytes.fm/199

View Details

See the full show notes for this episode on the website at pythonbytes.fm/198

View Details

See the full show notes for this episode on the website at pythonbytes.fm/197

View Details

See the full show notes for this episode on the website at pythonbytes.fm/196

View Details

See the full show notes for this episode on the website at pythonbytes.fm/195

View Details

See the full show notes for this episode on the website at pythonbytes.fm/194

View Details

See the full show notes for this episode on the website at pythonbytes.fm/193

View Details

See the full show notes for this episode on the website at pythonbytes.fm/192

View Details

See the full show notes for this episode on the website at pythonbytes.fm/191

View Details

See the full show notes for this episode on the website at pythonbytes.fm/190

View Details

See the full show notes for this episode on the website at pythonbytes.fm/189

View Details

See the full show notes for this episode on the website at pythonbytes.fm/188

View Details

See the full show notes for this episode on the website at pythonbytes.fm/187

View Details

See the full show notes for this episode on the website at pythonbytes.fm/186

View Details

See the full show notes for this episode on the website at pythonbytes.fm/185

View Details

See the full show notes for this episode on the website at pythonbytes.fm/184

View Details

See the full show notes for this episode on the website at pythonbytes.fm/183

View Details

See the full show notes for this episode on the website at pythonbytes.fm/182

View Details

See the full show notes for this episode on the website at pythonbytes.fm/181

View Details

See the full show notes for this episode on the website at pythonbytes.fm/180

View Details

See the full show notes for this episode on the website at pythonbytes.fm/179

View Details

See the full show notes for this episode on the website at pythonbytes.fm/178

View Details

See the full show notes for this episode on the website at pythonbytes.fm/177

View Details

See the full show notes for this episode on the website at pythonbytes.fm/176

View Details

See the full show notes for this episode on the website at pythonbytes.fm/175

View Details

See the full show notes for this episode on the website at pythonbytes.fm/174

View Details

See the full show notes for this episode on the website at pythonbytes.fm/173

View Details

See the full show notes for this episode on the website at pythonbytes.fm/172

View Details

See the full show notes for this episode on the website at pythonbytes.fm/171

View Details

See the full show notes for this episode on the website at pythonbytes.fm/170

View Details

See the full show notes for this episode on the website at pythonbytes.fm/169

View Details

See the full show notes for this episode on the website at pythonbytes.fm/168

View Details

See the full show notes for this episode on the website at pythonbytes.fm/167

View Details

See the full show notes for this episode on the website at pythonbytes.fm/166

View Details

See the full show notes for this episode on the website at pythonbytes.fm/165

View Details

See the full show notes for this episode on the website at pythonbytes.fm/164

View Details

See the full show notes for this episode on the website at pythonbytes.fm/163

View Details

See the full show notes for this episode on the website at pythonbytes.fm/162

View Details

See the full show notes for this episode on the website at pythonbytes.fm/161

View Details

See the full show notes for this episode on the website at pythonbytes.fm/160

View Details

See the full show notes for this episode on the website at pythonbytes.fm/159

View Details

See the full show notes for this episode on the website at pythonbytes.fm/158

View Details

See the full show notes for this episode on the website at pythonbytes.fm/157

View Details

See the full show notes for this episode on the website at pythonbytes.fm/156

View Details

See the full show notes for this episode on the website at pythonbytes.fm/155

View Details

See the full show notes for this episode on the website at pythonbytes.fm/154

View Details

See the full show notes for this episode on the website at pythonbytes.fm/153

View Details

See the full show notes for this episode on the website at pythonbytes.fm/152

View Details

See the full show notes for this episode on the website at pythonbytes.fm/151

View Details

See the full show notes for this episode on the website at pythonbytes.fm/150

View Details

See the full show notes for this episode on the website at pythonbytes.fm/149

View Details

See the full show notes for this episode on the website at pythonbytes.fm/148

View Details

See the full show notes for this episode on the website at pythonbytes.fm/147

View Details

See the full show notes for this episode on the website at pythonbytes.fm/146

View Details

See the full show notes for this episode on the website at pythonbytes.fm/145

View Details

See the full show notes for this episode on the website at pythonbytes.fm/144

View Details

See the full show notes for this episode on the website at pythonbytes.fm/143

View Details

See the full show notes for this episode on the website at pythonbytes.fm/142

View Details

See the full show notes for this episode on the website at pythonbytes.fm/141

View Details

See the full show notes for this episode on the website at pythonbytes.fm/140

View Details

See the full show notes for this episode on the website at pythonbytes.fm/139

View Details

See the full show notes for this episode on the website at pythonbytes.fm/138

View Details

See the full show notes for this episode on the website at pythonbytes.fm/137

View Details

See the full show notes for this episode on the website at pythonbytes.fm/136

View Details

See the full show notes for this episode on the website at pythonbytes.fm/135

View Details

See the full show notes for this episode on the website at pythonbytes.fm/134

View Details

See the full show notes for this episode on the website at pythonbytes.fm/133

View Details

See the full show notes for this episode on the website at pythonbytes.fm/132

View Details

See the full show notes for this episode on the website at pythonbytes.fm/131

View Details

See the full show notes for this episode on the website at pythonbytes.fm/130

View Details

See the full show notes for this episode on the website at pythonbytes.fm/129

View Details

See the full show notes for this episode on the website at pythonbytes.fm/128

View Details

See the full show notes for this episode on the website at pythonbytes.fm/127

View Details

See the full show notes for this episode on the website at pythonbytes.fm/126

View Details

See the full show notes for this episode on the website at pythonbytes.fm/125

View Details

See the full show notes for this episode on the website at pythonbytes.fm/124

View Details

See the full show notes for this episode on the website at pythonbytes.fm/123

View Details

See the full show notes for this episode on the website at pythonbytes.fm/122

View Details

See the full show notes for this episode on the website at pythonbytes.fm/121

View Details

See the full show notes for this episode on the website at pythonbytes.fm/120

View Details

See the full show notes for this episode on the website at pythonbytes.fm/119

View Details

See the full show notes for this episode on the website at pythonbytes.fm/118

View Details

See the full show notes for this episode on the website at pythonbytes.fm/117

View Details

See the full show notes for this episode on the website at pythonbytes.fm/116

View Details

See the full show notes for this episode on the website at pythonbytes.fm/115

View Details

See the full show notes for this episode on the website at pythonbytes.fm/114

View Details

See the full show notes for this episode on the website at pythonbytes.fm/113

View Details

See the full show notes for this episode on the website at pythonbytes.fm/112

View Details

See the full show notes for this episode on the website at pythonbytes.fm/111

View Details

See the full show notes for this episode on the website at pythonbytes.fm/110

View Details

See the full show notes for this episode on the website at pythonbytes.fm/109

View Details

See the full show notes for this episode on the website at pythonbytes.fm/108

View Details

See the full show notes for this episode on the website at pythonbytes.fm/107

View Details

See the full show notes for this episode on the website at pythonbytes.fm/106

View Details

See the full show notes for this episode on the website at pythonbytes.fm/105

View Details

See the full show notes for this episode on the website at pythonbytes.fm/104

View Details

See the full show notes for this episode on the website at pythonbytes.fm/103

View Details

See the full show notes for this episode on the website at pythonbytes.fm/102

View Details

See the full show notes for this episode on the website at pythonbytes.fm/101

View Details

See the full show notes for this episode on the website at pythonbytes.fm/100

View Details

See the full show notes for this episode on the website at pythonbytes.fm/99

View Details

See the full show notes for this episode on the website at pythonbytes.fm/98

View Details

See the full show notes for this episode on the website at pythonbytes.fm/97

View Details

See the full show notes for this episode on the website at pythonbytes.fm/96

View Details

See the full show notes for this episode on the website at pythonbytes.fm/95

View Details

See the full show notes for this episode on the website at pythonbytes.fm/94

View Details

See the full show notes for this episode on the website at pythonbytes.fm/93

View Details

See the full show notes for this episode on the website at pythonbytes.fm/92

View Details

See the full show notes for this episode on the website at pythonbytes.fm/91

View Details

See the full show notes for this episode on the website at pythonbytes.fm/90

View Details

See the full show notes for this episode on the website at pythonbytes.fm/89

View Details

See the full show notes for this episode on the website at pythonbytes.fm/88

View Details

See the full show notes for this episode on the website at pythonbytes.fm/87

View Details

See the full show notes for this episode on the website at pythonbytes.fm/86

View Details

See the full show notes for this episode on the website at pythonbytes.fm/85

View Details

See the full show notes for this episode on the website at pythonbytes.fm/84

View Details

See the full show notes for this episode on the website at pythonbytes.fm/83

View Details

See the full show notes for this episode on the website at pythonbytes.fm/82

View Details

See the full show notes for this episode on the website at pythonbytes.fm/81

View Details

See the full show notes for this episode on the website at pythonbytes.fm/80

View Details

See the full show notes for this episode on the website at pythonbytes.fm/79

View Details

See the full show notes for this episode on the website at pythonbytes.fm/78

View Details

See the full show notes for this episode on the website at pythonbytes.fm/77

View Details

See the full show notes for this episode on the website at pythonbytes.fm/76

View Details

See the full show notes for this episode on the website at pythonbytes.fm/75

View Details

See the full show notes for this episode on the website at pythonbytes.fm/74

View Details

See the full show notes for this episode on the website at pythonbytes.fm/73

View Details

See the full show notes for this episode on the website at pythonbytes.fm/72

View Details

See the full show notes for this episode on the website at pythonbytes.fm/71

View Details

See the full show notes for this episode on the website at pythonbytes.fm/70

View Details

See the full show notes for this episode on the website at pythonbytes.fm/69

View Details

See the full show notes for this episode on the website at pythonbytes.fm/68

View Details

See the full show notes for this episode on the website at pythonbytes.fm/67

View Details

See the full show notes for this episode on the website at pythonbytes.fm/66

View Details

See the full show notes for this episode on the website at pythonbytes.fm/65

View Details

See the full show notes for this episode on the website at pythonbytes.fm/64

View Details

See the full show notes for this episode on the website at pythonbytes.fm/63

View Details

See the full show notes for this episode on the website at pythonbytes.fm/62

View Details

See the full show notes for this episode on the website at pythonbytes.fm/61

View Details

See the full show notes for this episode on the website at pythonbytes.fm/60

View Details

See the full show notes for this episode on the website at pythonbytes.fm/59

View Details

See the full show notes for this episode on the website at pythonbytes.fm/58

View Details

See the full show notes for this episode on the website at pythonbytes.fm/57

View Details

See the full show notes for this episode on the website at pythonbytes.fm/56

View Details

See the full show notes for this episode on the website at pythonbytes.fm/55

View Details

See the full show notes for this episode on the website at pythonbytes.fm/54

View Details

See the full show notes for this episode on the website at pythonbytes.fm/53

View Details

See the full show notes for this episode on the website at pythonbytes.fm/52

View Details

See the full show notes for this episode on the website at pythonbytes.fm/51

View Details

See the full show notes for this episode on the website at pythonbytes.fm/50

View Details

See the full show notes for this episode on the website at pythonbytes.fm/49

View Details

See the full show notes for this episode on the website at pythonbytes.fm/48

View Details

See the full show notes for this episode on the website at pythonbytes.fm/47

View Details

See the full show notes for this episode on the website at pythonbytes.fm/46

View Details

See the full show notes for this episode on the website at pythonbytes.fm/45

View Details

See the full show notes for this episode on the website at pythonbytes.fm/44

View Details

See the full show notes for this episode on the website at pythonbytes.fm/43

View Details

See the full show notes for this episode on the website at pythonbytes.fm/42

View Details

See the full show notes for this episode on the website at pythonbytes.fm/41

View Details

See the full show notes for this episode on the website at pythonbytes.fm/40

View Details

See the full show notes for this episode on the website at pythonbytes.fm/39

View Details

See the full show notes for this episode on the website at pythonbytes.fm/38

View Details

See the full show notes for this episode on the website at pythonbytes.fm/37

View Details

See the full show notes for this episode on the website at pythonbytes.fm/36

View Details

See the full show notes for this episode on the website at pythonbytes.fm/35

View Details

See the full show notes for this episode on the website at pythonbytes.fm/34

View Details

See the full show notes for this episode on the website at pythonbytes.fm/33

View Details

See the full show notes for this episode on the website at pythonbytes.fm/32

View Details

See the full show notes for this episode on the website at pythonbytes.fm/31

View Details

See the full show notes for this episode on the website at pythonbytes.fm/30

View Details

See the full show notes for this episode on the website at pythonbytes.fm/29

View Details

See the full show notes for this episode on the website at pythonbytes.fm/28

View Details

See the full show notes for this episode on the website at pythonbytes.fm/27

View Details

See the full show notes for this episode on the website at pythonbytes.fm/26

View Details

See the full show notes for this episode on the website at pythonbytes.fm/25

View Details

See the full show notes for this episode on the website at pythonbytes.fm/24

View Details

See the full show notes for this episode on the website at pythonbytes.fm/23

View Details

See the full show notes for this episode on the website at pythonbytes.fm/22

View Details

See the full show notes for this episode on the website at pythonbytes.fm/21

View Details

See the full show notes for this episode on the website at pythonbytes.fm/20

View Details

See the full show notes for this episode on the website at pythonbytes.fm/19

View Details

See the full show notes for this episode on the website at pythonbytes.fm/18

View Details

See the full show notes for this episode on the website at pythonbytes.fm/17

View Details

See the full show notes for this episode on the website at pythonbytes.fm/16

View Details

See the full show notes for this episode on the website at pythonbytes.fm/15

View Details

See the full show notes for this episode on the website at pythonbytes.fm/14

View Details

See the full show notes for this episode on the website at pythonbytes.fm/13

View Details

See the full show notes for this episode on the website at pythonbytes.fm/12

View Details

See the full show notes for this episode on the website at pythonbytes.fm/11

View Details

See the full show notes for this episode on the website at pythonbytes.fm/10

View Details

See the full show notes for this episode on the website at pythonbytes.fm/9

View Details

See the full show notes for this episode on the website at pythonbytes.fm/8

View Details

See the full show notes for this episode on the website at pythonbytes.fm/7

View Details

See the full show notes for this episode on the website at pythonbytes.fm/6

View Details

See the full show notes for this episode on the website at pythonbytes.fm/5

View Details

See the full show notes for this episode on the website at pythonbytes.fm/4

View Details

See the full show notes for this episode on the website at pythonbytes.fm/3

View Details

See the full show notes for this episode on the website at pythonbytes.fm/2

View Details

See the full show notes for this episode on the website at pythonbytes.fm/1