Python 3.9 alpha in Fedora

The Python developers have already released five alpha versions of Python 3.9.0 and you can already try the latest one in Fedora! Test your Python code with 3.9 early to avoid surprises once the final 3.9.0 is out in October.

Install Python 3.9 on Fedora

If you run Fedora, you can install Python 3.9 from the official software repository with dnf:

$ sudo dnf install python3.9

In order to get the very latest pre-release, you might need to enable the updates-testing repository:

$ sudo dnf install --enablerepo=updates-testing python3.9

As more alphas, betas and release candidates of Python 3.9 will be released, the Fedora package will receive updates. No need to compile your own development version of Python, just install it and have it up to date. New features will be added until the first beta planned for mid May.

Test your projects with Python 3.9

Run the python3.9 command to use Python 3.9 or create virtual environments with the builtin venv module, tox or with pipenv and poetry. For example:

$ git clone https://github.com/benjaminp/six.git
Cloning into 'six'...
$ cd six/
$ tox -e py39
py39 run-test: commands[0] | python -m pytest -rfsxX
================== test session starts ===================
platform linux -- Python 3.9.0a5, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
collected 200 items                                      

test_six.py ...................................... [ 19%]
.................................................. [ 44%]
.................................................. [ 69%]
.................................................. [ 94%]
............                                       [100%]

================== 200 passed in 0.43s ===================
________________________ summary _________________________
  py39: commands succeeded
  congratulations :)

What’s new in Python 3.9

So far, the first five alphas were released, more features will come until the first beta. You can however already try out the new dictionary merge & update operators:

$ python3.9
Python 3.9.0a5 (default, Mar 24 2020, 00:00:00) 
[GCC 10.0.1 20200311 (Red Hat 10.0.1-0.9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> d = {'spam': 1, 'eggs': 2, 'cheese': 3}
>>> e = {'cheese': 'cheddar', 'aardvark': 'Ethel'}
>>> d | e
{'spam': 1, 'eggs': 2, 'cheese': 'cheddar', 'aardvark': 'Ethel'}
>>> e | d
{'cheese': 3, 'aardvark': 'Ethel', 'spam': 1, 'eggs': 2}
>>> d |= e
>>> d
{'spam': 1, 'eggs': 2, 'cheese': 'cheddar', 'aardvark': 'Ethel'}

And stay tuned for Python 3.9 as python3 in Fedora 33!

Source: https://fedoramagazine.org/python-3-9-alpha-in-fedora/

Leave a Reply

Your email address will not be published. Required fields are marked *