What’s New From March 2024 – Real Python

While many people went hunting for Easter eggs, the Python community stayed active through March 2024. The free-threaded Python project reached a new milestone, and you can now experiment with disabling the GIL in your interpreter.
The Python Software Foundation does a great job supporting the language with limited resources. They’ve now announced a new position that will support users of PyPI. NumPy is an old workhorse in the data science space. The library is getting a big facelift, and the first release candidate of NumPy 2 is now available.
Dive in to learn more about last month’s most important Python news.
Free-Threaded Python Reaches an Important Milestone
Python’s global interpreter lock (GIL) has been part of the CPython implementation since the early days. The lock simplifies a lot of the code under the hood of the language, but also causes some issues with parallel processing.
Over the years, there have been many attempts to remove the GIL. However, until PEP 703 was accepted by the steering council last year, none had been successful.
The PEP describes how the GIL can be removed based on experimental work done by Sam Gross. It suggests that what’s now called free-threaded Python is activated through a build option. In time, this free-threaded Python is expected to become the default version of CPython, but for now, it’s only meant for testing and experiments.
When free-threaded Python is ready for bigger audiences, the GIL will still be enabled by default. You can then set an environment variable or add a command-line option to try out free-threaded Python:

These options have now been included in CPython’s main branch. In March 2024, gh-116167 was implemented and merged. If you want to try out the free-threaded Python for yourself, you need to clone and build CPython with the –disable-gil flag passed to configure.

Note: The official pre-releases that you can download from python.org are currently not built with the –disable-gil flag enabled. If you try to disable the GIL on the latest Python 3.13.0a5, you’ll get the following message:

For now, you need to build Python yourself to experiment with disabling the GIL.

While you can play with free-threaded Python, be aware that there are many known issues that are still being worked on. We’re excited to follow the continuing development of the project.
PSF Announces a PyPI Support Specialist Position
The Python Package Index (PyPI) currently hosts more than half a million packages. The repository is the main hub for distributing Python packages. It’s an enormously important part of the Python ecosystem, with more than a billion downloads every day.
Since its launch in 2003, PyPI has been run on a mostly volunteer basis with some staff support from the Python Software Foundation (PSF). Last year, the PSF hired Mike Fiedler as a safety and security engineer for PyPI.
In addition to security concerns, the PSF also handles communication with users and account issues that arise. To improve this support, they’re hiring for a new PyPI Support Specialist position.
The main responsibilities of the new role will be to interact with PyPI users and process support requests in the following areas:

Account recovery
Project name requests
Organization requests
Project limit requests
Malware/spam/abuse reports
End-user support

The position is 100% remote, and applicants from around the world are welcome to apply before the May 1, 2024 deadline.
NumPy 2 Release Candidate Available
NumPy is a fundamental package in the data science space. The library provides in-memory N-dimensional arrays and many functions for fast operations on those arrays.
You can work with NumPy arrays directly, although often you’ll instead interact with libraries like pandas, SciPy, or NetworkX that rely on NumPy under the hood.
NumPy has a long and successful history and has arguably been one important reason for Python’s success as a data analysis tool. To improve on many of the internals of the library, NumPy 2 will be backward incompatible.
Many of the changes will happen in NumPy’s C-API, which will typically only affect other library developers. If your code only uses NumPy arrays and corresponding functions, you won’t notice these changes. Instead, you should be aware that some constants and functions are renamed and deprecated.
For example, you can express infinity as either np.inf, np.Infinity, or np.PINF. In NumPy 2, only np.inf will be available. To help you find these kinds of issues, you can use Ruff and the special linter rule NPY201.
If you want to experiment with the new version of NumPy, you can install the release candidate by creating a new virtual environment and running the following pip command:

The –pre flag specifies that you want the latest pre-release available. You can then play with the new release in your REPL:

In this example, you check the version of NumPy and note that np.Infinity has been removed.
To learn more about the new version, have a look at the migration guide or dive into the NumPy Enhancement Proposals.
What’s Next for Python?
All new features that are slated for Python 3.13 must be implemented before the first beta version is released in May 2024. It’s exciting to follow the flurry of development happening up to the deadline.
The last month provided several new developments for you to follow. You can now build a free-threaded version of Python and experiment with disabling the GIL. If you’re a NumPy user, you can test the first release candidate of NumPy 2 and ensure that it works with your code.
What’s your favorite Python news story from March? Let us know in the comments. Happy Pythoning!