Python Monthly News

Python News: What's New From May 2024

by Bartosz Zaczyński Jun 10, 2024 community

May was packed with exciting updates and events in the Python community. This month saw the release of the first beta version of Python 3.13, the conclusion of PyCon US 2024, and the announcement of the keynote speakers for EuroPython 2024. Additionally, PEP 649 has been delayed until the Python 3.14 release, and the Python Software Foundation published its 2023 Annual Impact Report.

Get ready to explore the recent highlights!

The First Beta Version of Python 3.13 Released

After nearly a year of continuous development, the first beta release of Python 3.13 was made available to the general public. It marks a significant milestone in Python’s annual release cycle, officially kicking off the beta testing phase and introducing a freeze on new features. Beyond this point, Python’s core developers will shift their focus to only identifying and fixing bugs, enhancing security, and improving the interpreter’s performance.

While it’s still months before the final release planned for October 2024, as indicated by the Python 3.13 release schedule, third-party library maintainers are strongly encouraged to test their packages with this new Python version. The goal of early beta testing is to ensure compatibility and address any issues that may arise so that users can expect a smoother transition when Python 3.13 gets officially released later this year.

Although you shouldn’t use a beta version in any of your projects, especially in production environments, you can go ahead and try out the new version today. To check out Python’s latest features, you must install Python 3.13.0b1 using one of several approaches.

The quickest and arguably the most straightforward way to manage multiple Python versions alongside your system-wide interpreter is to use a tool like pyenv in the terminal:

Shell
$ pyenv install 3.13.0b1
$ pyenv shell 3.13.0b1
$ python
Python 3.13.0b1 (main, May 15 2024, 10:41:55) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

The highlighted line brings the first beta release of Python 3.13 onto your computer, while the following command temporarily sets the path to the python executable in your current shell session. As a result, the python command points to the specified Python interpreter.

Alternatively, you can use a Python installer, which you’ll find at the bottom of the downloads page, or run Python in an isolated Docker container to keep it completely separate from your operating system. However, for ultimate control, you can try building the interpreter from source code based on the instructions in the README file. This method will let you experiment with more advanced features, like turning off the GIL.

Unlike previous Python releases, which introduced a host of tangible syntactical features that you could get your hands on, this one mainly emphasizes internal optimizations and cleanup. That said, according to the official release summary document, there are a few notable new features that will be immediately visible to most Python programmers:

Some of these features don’t work on Windows at the moment because they rely on Unix-specific libraries, so you won’t see any difference unless you’re a macOS or Linux user. The good news is that Windows support is coming in the second beta release, which will arrive soon, thanks to Real Python team member Anthony Shaw.

Colorized Prompts in the Python 3.13 Standard REPL
Colorized Prompts in the Python 3.13 Standard REPL

Another feature, although much less visible, is preliminary support for mobile platforms. The current beta release can be made to run on iOS (PEP 730), and you can also expect Android (PEP 738) support in the near future.

Additionally, there will be a few experimental features for power users, including a just-in-time (JIT) compiler of the Python bytecode (PEP 744) and the ability to disable the global interpreter lock (PEP 703) on demand. These two enhancements are part of the interpreter’s performance improvements that can boost the code’s execution speed.

The document also mentions numerous deprecations and the removal of many dead batteries from the standard library. To learn more about these changes, you can refer to a detailed changelog, which is regularly updated.

Even though the core team is working hard toward releasing Python 3.13 on October 1st as planned, the development of Python 3.14 is already underway. Hugo van Kemenade will be the Python release manager for this next version.

PyCon US 2024 Comes to a Close in Pittsburgh

One of the biggest annual Python community gatherings, PyCon US, successfully wrapped up in May. This year’s conference took place in Pittsburgh, Pennsylvania, where it was originally scheduled to be held in 2020 and 2021. However, due to the COVID-19 pandemic, these events were conducted online instead. The conference enthusiastically returned to Pittsburgh this year, and next year’s conference will be held there as well.

This year’s event featured an array of talks, sprints, and workshops that brought the Python community together to celebrate and explore the language’s latest developments. All talks were recorded and will be published on PyCon’s official YouTube channel soon. The videos will appear in a dedicated playlist for convenient access.

This year’s keynote speakers included:

The conference also featured a bustling Expo Hall, where companies and organizations showcased their latest Python-related products and services. Attendees had the opportunity to network, collaborate on projects, and participate in various community events, making it a memorable experience for all.

EuroPython 2024 Keynote Speakers Announced

EuroPython 2024 has unveiled an impressive lineup of keynote speakers for this year’s conference, set to take place in Prague this July. This announcement promises an exciting range of topics and expertise from some of the most influential figures in the Python community:

  • Anna Přistoupilová: Award-winning bioinformatics scientist specializing in genome analysis to help understand rare genetic diseases
  • Armin Ronacher: Creator of popular Python libraries and frameworks, including Flask, Jinja, Click, and Rye
  • Carol Willing: Python core developer, PSF fellow, and a three-time steering council member
  • Łukasz Langa: CPython developer in residence, former Python release manager, and the original creator of Black
  • Mai Giménez: Researcher and engineer at Google DeepMind with expertise in large language and multimodal models
  • Tereza Iofciu: Seasoned data professional with fifteen years of experience and co-host of the Hidden Figures podcast

This diverse group of speakers underscores Python’s broad applications and vibrant community, promising all attendees a rich and educational experience. Whether you’re a seasoned developer, a data scientist, or just starting your journey with Python, the conference offers a unique opportunity to learn, network, and be inspired by the best in the field.

Are you planning to attend EuroPython 2024 in Prague? Let us know in the comments!

PEP 649 Delayed Until the Python 3.14 Release

Shortly before releasing the first beta version of Python 3.13, it became abundantly clear that the development team wouldn’t be able to deliver PEP 649 in time, which was originally planned for that release. Instead, the steering council has decided to delay its implementation until Python 3.14, giving the developers ample time to refine it.

The proposal aims to introduce a deferred evaluation of annotations by means of a powerful metaprogramming technique known as Python descriptors. Up until now, annotated classes, modules, and callable objects have provided the .__annotations__ dictionary with expressions evaluated eagerly at definition time:

Python
>>> def forty_two() -> int:
...     print("Calling forty_two()")
...     return 42
...

>>> def function(param: forty_two()) -> 2 + 2:
...     pass
...
Calling forty_two()

>>> function.__annotations__
{'param': 42, 'return': 4}

An annotation can be any valid Python expression, including a function call or an arithmetic expression like in the example above. Notice that the highlighted line appears on the screen as soon as you finish defining your annotated function, confirming the eager evaluation of annotations.

To avoid circular imports and to deal with forward type declarations, you’d occasionally have to enclose the type at hand in a string literal. Alternatively, you could enable the postponed evaluation of annotations (PEP 563) by using a future import:

Python
>>> from __future__ import annotations

>>> def forty_two() -> int:
...     print("Calling forty_two()")
...     return 42
...

>>> def function(param: forty_two()) -> 2 + 2:
...     pass
...

>>> function.__annotations__
{'param': 'forty_two()', 'return': '2 + 2'}

When this import statement appears at the top of your module or script, it decompiles all expressions back into strings. Still, your annotations must be valid Python expressions to begin with, which is different than manually annotating a few string literals.

If your annotations involve expensive computation, then this approach can improve performance and reduce startup time. It lets you choose the best moment to evaluate those annotations:

Python
>>> import inspect
>>> inspect.get_annotations(function, eval_str=True)
Calling forty_two()
{'param': 42, 'return': 4}

>>> import typing
>>> typing.get_type_hints(function)
Calling forty_two()
{'param': 42, 'return': 4}

>>> eval(function.__annotations__["param"])
Calling forty_two()
42

All three approaches allow you to retrieve and evaluate your annotations, but the get_type_hints() function is particularly well-suited to resolving complex type hints involving forward declarations.

That’s fine for the most common use case of type hinting, which relies on static type information processed by external tools like mypy. Unfortunately, the postponed evaluation mechanism doesn’t play well with libraries that use the annotation syntax at runtime. For example, Pydantic and FastAPI take advantage of annotations to perform tasks such as data validation, serialization, and dependency injection.

In cases where annotations are used at runtime, eager evaluation is usually preferred. The new approach aims to combine the benefits of both eager and postponed evaluation, providing a more flexible and robust solution. Depending on the situation, it’ll be possible to change the evaluation behavior as desired.

To make that possible, the .__annotations__ attribute will be rewritten as a Python descriptor that lazily calls a new .__annotate__() function and caches its return value:

Python
>>> def forty_two() -> int:
...     print("Calling forty_two()")
...     return 42
...
... def function(param: forty_two()) -> 2 + 2:
...     pass

>>> function.__annotations__
Calling forty_two()
{'param': 42, 'return': 4}

>>> function.__annotations__
{'param': 42, 'return': 4}

With PEP 649 in place, the annotations won’t be evaluated until you access the corresponding .__annotations__ attribute for the first time. The subsequent accesses will return the cached dictionary without reevaluating the annotations again. That’s the default behavior.

At the same time, tools will be able to call the low-level .__annotate__() function at runtime, either directly or indirectly through helper functions. The new function will accept a positional argument, which must take one of three values:

Python
>>> import inspect

>>> function.__annotate__(inspect.VALUE)
Calling forty_two()
{'param': 42, 'return': 4}

>>> function.__annotate__(inspect.FORWARDREF)
Traceback (most recent call last):
  ...
NotImplementedError

>>> function.__annotate__(inspect.SOURCE)
Traceback (most recent call last):
  ...
NotImplementedError

Out of the box, the default implementation generated by Python will only support the VALUE format, while the remaining FORWARDREF and SOURCE formats will be left for third-party libraries to support.

In summary, the delay of PEP 649 provides the Python development team with the necessary time to refine an impactful and important new feature.

The PSF’s 2023 Annual Impact Report Published

The Python Software Foundation (PSF) has released its long-awaited Annual Impact Report for 2023. The document sheds light on the foundation’s primary activities, achievements, financials, and infrastructural updates over the past year. The PSF also celebrates the milestone of last year’s 20th anniversary of PyCon US while distributing a generous amount of nearly $700,000 in grants.

The report has been flavored with thoughtful notes and letters from key members, including the Executive Director, Deb Nicholson, PyCon US Chair, Marietta Wijaya, and PSF Board of Director Chair, Dawn Wages. Additionally, it features updates on the significant contributions from their Developers-in-Residence Łukasz Langa and Seth Larson, along with introductions to new members.

The PSF also proudly showcases their fiscal sponsorees, marking the inclusion of seven new organizations this year. Furthermore, the achievements of their PyPI Safety & Security Engineer, Mike Fiedler, have been rightfully highlighted. To enhance Python’s security, the PSF was authorized as a CVE Numbering Authority (CNA) and rolled out two-factor authentication for all Python Package Index (PyPI) users.

You can visit the official PSF website for a deeper insight into the foundation’s work.

What’s Next for Python?

As we look ahead, the excitement in the Python community shows no signs of slowing down. With the first beta of Python 3.13 now available, developers are encouraged to dive in and provide feedback. The recent PyCon US 2024 has left us with a wealth of new ideas and inspiration, and the anticipation for EuroPython 2024 is building with the announcement of its keynote speakers.

Stay tuned for more developments and innovations in the Python ecosystem. Happy Pythoning!

🐍 Python Tricks 💌

Get a short & sweet Python Trick delivered to your inbox every couple of days. No spam ever. Unsubscribe any time. Curated by the Real Python team.

Python Tricks Dictionary Merge

About Bartosz Zaczyński

Bartosz is a bootcamp instructor, author, and polyglot programmer in love with Python. He helps his students get into software engineering by sharing over a decade of commercial experience in the IT industry.

» More about Bartosz

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Master Real-World Python Skills With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

Master Real-World Python Skills
With Unlimited Access to Real Python

Locked learning resources

Join us and get access to thousands of tutorials, hands-on video courses, and a community of expert Pythonistas:

Level Up Your Python Skills »

What Do You Think?

Rate this article:

What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment below and let us know.

Commenting Tips: The most useful comments are those written with the goal of learning from or helping out other students. Get tips for asking good questions and get answers to common questions in our support portal.


Looking for a real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

Keep Learning

Related Topics: community