As always, October was an eventful month for the Python community this year. It brought the final Python 3.11 release, a few beta versions of the next major releases of popular Python libraries, and some exciting developments in the Python community.
Here’s a quick recap of the most interesting happenings from October 2022.
Free Download: Click here to download free sample code that demonstrates some of the new features of Python 3.11.
The Python 3.11 Release
By far, this month’s most exciting event was the release of Python 3.11, overshadowing a few other interesting news items. October was chosen for the annual Python releases a few years ago, giving a stable and predictable release cycle for Python.
The release date of Python 3.11 was originally planned for October 3. Unfortunately, it was delayed due to unexpected problems that were blocking the previous release candidate about a month before. The world had to wait an additional three weeks, until October 24, to finally witness the next major Python release:
This version packs many new features and promises significant performance improvements, an effort that’ll continue in future versions to achieve even better results. The What’s New In Python 3.11 article gives an overview of what has changed since the previous version of the language. The Python 3.11 changelog provides more details with links to the individual GitHub issues and their corresponding code commits.
In short, these are arguably the most worthwhile new features in Python 3.11:
- Even Better Error Messages
- Asynchronous Task and Exception Groups
- TOML and tomllib
- Type Checking Enhancements
- Faster Startup and Code Execution
- Zero-Cost Exceptions
To dive deeper and have a hands-on experience with Python 3.11, head over to our dedicated tutorial or video course about the new features, where you can make your way through the most important language improvements with code examples.
Even though Python 3.11 has just been released, it’s going to be a while before companies and cloud service providers start using it in production on a larger scale. Upgrading the runtime environment is always risky and can lead to downtime, data loss, or other unforeseen problems. That’s precisely why the US army refuses to upgrade their old-school software on mission-critical equipment.
At the same time, it’s worth mentioning that some major Python libraries, especially those in the data science field, began supporting Python 3.11 and tested it thoroughly before the official release. This ensures that users can make a safe switch to Python 3.11 and start taking advantage of the new language features without having to wait for their package dependencies to catch up.
What’s your favorite new feature in Python 3.11?
Updates From the Python Ecosystem
The Python ecosystem keeps moving forward with new releases each month. The pytest 7.2.0 release is now available, and SQLAlchemy 2.0 has finally been released in the beta version. The NetworkX library has also released a beta version of its next major version.
In late October, the open-source community released a new minor release of pytest, one of the most widespread testing libraries in Python. This version brings a few quality-of-life improvements.
Most notably, pytest will no longer recognize unit tests written for nose, which used to be another popular testing library. Because its development stalled several years ago and the maintenance of the pytest-nose compatibility layer is getting more expensive as pytest evolves, the developers of pytest decided to abandon it.
As a result, you should stop using the
.teardown() methods in your class-based unit tests in pytest. While they’ll continue to work under the deprecation schedule, they’re no longer recommended. The setup and teardown methods native to pytest have slightly different names but otherwise should behave the same way.
Additionally, pytest will recognize an alternative to the
pytest.ini configuration file, which may now be hidden on Unix-like operating systems. This means optionally starting the name of the file with a leading dot:
# .pytest.ini [pytest] python_functions = should_*
Another noteworthy change is that the
testpaths configuration option will support Unix-style pathname pattern expansion using Python’s
[pytest] testpaths = src/*/unit_tests src/*/integration_tests src/*/system_tests **/tests
The asterisk symbol (
*) matches any number of characters, while a double asterisk (
**) matches directories recursively. This feature can become especially handy in a large repository, known as a monorepo, which includes multiple projects that follow the same directory structure.
To learn more about this new pytest release, check out the full changelog on the official website. There are many more improvements, bug fixes, and updates that might be interesting to you.
SQLAlchemy 2.0 Beta
A preview of SQLAlchemy 2.0 was released in October, signifying a long-awaited departure from legacy interfaces and a move toward using modern Python patterns. The interest, as measured by the number of daily downloads of this new release, has exceeded expectations. A follow-up release with several bug fixes came just a week later.
For years, SQLAlchemy has been a wildly popular framework providing low-level abstractions and a high-level object-relational mapper (ORM) for moving data between Python and various relational databases in a consistent manner. At the same time, it exposes behaviors unique to particular kinds of databases. The framework helps automate repetitive SQL boilerplate statements, which are unavoidable in most applications.
The complete set of features and the architecture of SQLAlchemy 2.0 have been long available in the transitional 1.4 series, which provided a bridge between the old and the new interfaces. Anyone using the current stable release of the framework can enable the SQLAlchemy 2.0 deprecations mode to get notified about all kinds of incompatibilities and issues before making the final switch to the next generation of SQLAlchemy.
So, what are the major changes in SQLAlchemy 2.0 beta?
The first and most important change is dropping support for Python 2 along with cleaning some old cruft from the codebase, making the framework easier to maintain going forward. SQLAlchemy will only run on Python 3.7 or later and will take advantage of modern syntactic constructs like context managers for managing its resources.
Another notable improvement is the addition of an asynchronous layer on top of the classic blocking query API in SQLAlchemy. The integration with Python’s async IO will enable the framework to run in asynchronous web applications, which couldn’t previously benefit from SQLAlchemy unless SQLAlchemy was wrapped in a thread pool. This should also expose the framework to people who previously haven’t considered it because of its blocking nature.
A new caching mechanism of the compiled SQL statements will make the code run more quickly. It’ll allow for further improvements in the core engine, which weren’t possible before due to limited execution time.
Last but not least, the framework will introduce new unified APIs to narrow down the alternative ways of achieving the same objective in a more verbose and explicit style of coding. The idea is that the programmer should always know what they’re doing and why they’re doing it instead of being isolated from the underlying SQL. Legacy interfaces, which have long been deprecated but remained in use, will be removed.
The official documentation provides detailed instructions on migrating your code to the next generation of SQLAlchemy. Remember that SQLAlchemy 2.0 is still in development and isn’t ready for production, so don’t take the plunge by upgrading just yet!
NetworkX 3.0 Beta
Another beta release was announced last month. NetworkX, a popular data science library for the creation and analysis of graphs and networks in Python, got a new major version. The NetworkX 3.0 Beta release is a significant undertaking that addresses years of technical debt through the careful removal of old code. As a side effect, the core of the library no longer depends on any third-party packages.
Streamlining and modernizing the library’s code will lower the bar for new contributors to get involved and will improve its performance. Additionally, NetworkX 3.0 will be more tighly integrated with other popular scientific libraries, such as NumPy, Matplotlib, pandas, and SciPy. Algorithms that previously have been implemented in NetworkX will now benefit from these integrations.
Python Community Highlights
The Python community was busy last month. PyCon US 2023 is now accepting proposals, the Python Developers Survey 2022 is now open, and a new Python release manager has been appointed. In addition, Al Sweigart has released a new book.
PyCon US 2023: Call for Proposals
The arrangements for the biggest annual Python conference have begun, and Pythonistas from around the world are eagerly anticipating the event. Just like the conference earlier this year, PyCon US 2023 will return to Salt Lake City and will be held both in person, in compliance with health and safety guidelines, and online. Next year’s convention will take place April 19 to 27 and will mark the twentieth anniversary of PyCon US:
At PyCon, anyone can give a speech or actively participate in the conference in other ways, regardless of their experience level. You can submit your proposal by choosing from the following presentation types:
- Talks: The traditional conference talks, usually thirty minutes long, held during the main conference days, from April 21 to 23
- Charlas: Talks given in Spanish during the first two main days of the conference, on April 21 and 22
- Tutorials: Workshop sessions running for about three hours each, either in the morning or afternoon during the two days preceding the main conference, April 19 and 20
- Posters: Presentation of a topic on a poster board displayed during the open Expo Hall hours on April 21 and 22, as well as during the Job Fair on April 23
The deadline for the individual submissions is December 9, 2022.
To stay up-to-date, you can read the PyCon US blog or follow PyCon US on Twitter for important announcements. If you’re planning to attend, then definitely check out Real Python’s PyCon US guide to learn how to get the most out of the conference.
We’ll be there in April next year, so be sure to stop by Real Python’s booth and shake hands with us. In the meantime, you can get a taste of what’s to come by reading our summaries of PyCon US 2019 and PyCon US 2022.
Python Developers Survey 2022
For the sixth year in a row, the Python Software Foundation (PSF) is conducting the official Python Developers Survey to get insights into the Python community and learn about its evolution. Specifically, the survey helps gather feedback on the state of the Python language and its ecosystem, as well as how they’re both used by people like you. You can review last year’s results if you’re interested.
The survey is adaptive, so the exact number of questions and their scope will depend on your earlier choices. However, filling it out should take no longer than ten to fifteen minutes:
The questions touch on diverse topics, ranging from your role and experience, through software development practices, to which tools and libraries your organization uses and how often. Most of the questions are multiple-choice, some are mutually exclusive, and only a few ask you to write a short answer in your own words.
Note: Just like in previous years, PSF partnered with JetBrains to handle the technical aspects like hosting the survey and people’s responses. JetBrains is the company behind PyCharm, which is a popular Python IDE.
If you have spare few minutes, then consider contributing your answers. They really matter! Note that this year, there will be a gift card lottery, so make sure you enter your email address at the end of the survey to enter the drawing!
New Python Release Manager
It’s been an unofficial rule that the same person manages two consecutive Python releases. The last two releases were handled by Pablo Galindo Salgado, a core CPython developer serving on the Python Steering Council, who spearheaded the novel idea of live streaming the release process to the public. The Python 3.11 release was streamed on YouTube and is still available for you to watch:
Wearing funny hats has become a key part of those Python release parties. We hope the tradition will continue!
However, after two consecutive years, it’s time for a change. Thank you, Pablo! The releases of Python 3.12 and Python 3.13 will be managed by Thomas Wouters, featured in the picture above, who’s another seasoned core developer on the Python Steering Council. Additionally, he’s a member of the Python Software Foundation (PSF) board of directors.
Thomas has already tried his hand at releasing the first alpha version of Python 3.12 right after the release of 3.11. You can grab its fresh source code from the corresponding
v3.12.0a1 tag on GitHub. Alternatively, you may install Python 3.12 alpha 1 through Docker or pyenv if you’d like to give it a go. Be warned, however, that it’s still a very early preview release that doesn’t include substantial changes.
Good luck in your new role, Thomas! We’re curious about the new features and improvements that Python 3.12 will bring.
New Free Book From Al Sweigart
Al Sweigart is a prolific technical writer with several books on Python, including such popular titles as Automate the Boring Stuff with Python, which you can get on Amazon. At the same time, the author generously makes all of his books available for free under a Creative Commons license in electronic form on his website.
His latest book, Python Programming Exercises, Gently Explained, takes a practical approach to teaching Python to beginners by solving forty-two code challenges:
If you’re stuck in your Python journey, then these programming exercises might be the perfect resource to help you move on. By the way, the number of exercises in the book isn’t arbitrary. The number 42 is an inside joke among programmers, who tend to use it as a placeholder value for numbers, much like the word foobar for strings.
Lastly, if you meet the author of the book at PyCon US, then don’t hesitate to have a chat with him! Al is a very approachable and friendly person, who will surely be interested in talking with you.
What’s Next for Python?
What’s your favorite piece of Python news from October? Did we miss anything notable? Are you going to upgrade to Python 3.11, or is it still too early for you? Have you taken part in the Python Developers Survey 2022 yet? Do you plan to attend next year’s PyCon US conference? Let us know in the comments!
Free Download: Click here to download free sample code that demonstrates some of the new features of Python 3.11.