Python Monthly News

Python News: What's New From March 2024

by Geir Arne Hjelle Apr 08, 2024 community

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:

Shell
$ PYTHON_GIL=0 python
$ python -Xgil=0

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.

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:

Shell
$ python -m pip install --pre numpy

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

Python
>>> import numpy as np
>>> np.__version__
'2.0.0rc1'

>>> np.inf
inf
>>> np.Infinity
Traceback (most recent call last):
    ...
    AttributeError: `np.Infinity` was removed in the NumPy 2.0 release.
    Use `np.inf` instead. Did you mean: 'isfinite'?

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!

🐍 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 Geir Arne Hjelle

Geir Arne is an avid Pythonista and a member of the Real Python tutorial team.

» More about Geir Arne

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