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

#404: The Lost Episode

Published Mon, Oct 7, 2024, recorded Mon, Oct 7, 2024
Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

About the show

Sponsored by ScoutAPM: pythonbytes.fm/scout

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: 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:
  • “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 sparkles
  • Be sure to set your favorite editor in the ENV variables

Extras

Michael:

Joke: Funny 404 pages


Want to go deeper? Check our projects