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

#307: Your Python just got faster (3.11 is out!)

Published Wed, Oct 26, 2022, recorded Wed, Oct 26, 2022
Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

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:

Joke: i heard you like getters


Want to go deeper? Check our projects