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