Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#410: Entering the Django core

Published Mon, Nov 18, 2024, recorded Mon, Nov 18, 2024
Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

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 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: Thoughts on Django’s Core

  • Carlton Gibson
  • Great discussion on
    • Django and Core vs Plugins
    • Sustainability with limited people
    • Keeping core small
    • The release cycle
    • eembrace plugins vs endorsing plugins.

Michael #2: futurepool

  • via Pat Decker
  • Takes the concept of multiprocessing Pool to the async/await world.
  • Create a pool then delegate the work:

    async with FuturePool(2) as fp:
      result = await fp.map(async_pool_fn, range(10))
    
  • I would LOVE to see something like this in a broader background asyncio worker pool concept.

  • But that concept doesn’t exist in asyncio in Python and that’s a failing of the framework IMO.

Brian #3: Don't return named tuples in new APIs

  • Brett Cannon
  • First off, I’m grateful for any post that talks about APIs and the API is a module, class, or package API and not a Web/REST API. The term API existed long before the internet.
  • “e.g., get_mouse_position() very likely has a two-item tuple of X and Y coordinates of the screen”
  • “it actually makes your API more complex for both you and your users to use. For you, it doubles the data access API surface for your return type as you have to now support index-based and attribute-based data access forever (or until you choose to break your users and change your return type so it doesn't support both approaches)”
  • “… you probably don't want people doing with your return type, like slicing, iterating over all the items …”
  • Alternatives
    • class
    • dataclass
    • dictionary
    • TypedDict
    • SimpleNamespace
  • “My key point in all of this is to prefer readability and ergonomics over brevity in your code. That means avoiding named tuples except where you are expanding to tweaking an existing API where the named tuple improves over the plain tuple that's already being used.”

Michael #4: Ziglang: Migrating from AWS to Self-Hosting

  • The Rust Foundation for example, reports that they spent $404,400 on infrastructure costs in 2023.
  • Zig lang has decided to use a single big cloud machine + mirrors

Extras

Brian:

  • Changing the Python Test community
    • Was started to answer questions for Test & Code listeners years ago.
    • Primarily pytest questions
    • Used to be Slack. Then moved to Podia forum.
    • Now I’m trying to work out a Discord solution that is both sustainable and usable.

Michael:

Joke: Breaking: JavaScript Developer Commits to Framework for Record-Breaking 3 Weeks


Want to go deeper? Check our projects