Documentation for a newer release is available. View Latest

Python

Performance do Python Melhorada

Depending on the workload, up to 27% improved performance is now observed in Python-based software. The improved performance is accomplished by building the Python interpreter with -fno-semantic-interposition. Because there is no semantic interposition now, the internal symbol look-ups from libpython to libpython library are direct and faster.

As a consequence, if Fedora users need to use LD_PRELOAD to override symbols in libpython, the recommended way is to build a custom Python build without -fno-semantic-interposition. However, it is still possible to use LD_PRELOAD to override symbols in other libraries (for example in glibc).

Python 2 foi removido

O upstream do Python parou de oferecer suporte para o Python 2 em 1 de Janeiro de 2020. Por essa razão, o Fedora 32 remove os pacotes do Python 2.

Os seguintes pacotes não estão mais disponíveis:

  • O pacote python2 e todos os seus subpacotes.

  • Todos os pacotes que precisam do Python 2 para executar.

  • Todos os pacotes que precisam do Python 2 para sua build.

O Fedora 32 ainda provê um pacote legado python27. Esse pacote é destinado a desenvolvedores que ainda precisam oferecer suporte para Python 2 e para usuários que ainda precisarem utilizar software que depende do Python 2.

O pacote python27 possui várias limitações quando comparado com o pacote python2 original:

  • Esse pacote não possui subpacotes. Todo o conteúdo é armazenado em um único pacote.

  • O pacote não provê uma build de debug, que era préviamente disponível como python2-debug.

  • O pacote não provê o binário /usr/bin/python.

  • Any special backwards compatible Provides are removed (this package is not intended to be depended upon).

Suporte para Nose foi depreciado

O suporte para Nose não será mais mantido. No entando, o pacote python3-nose continua disponível nos repositórios oficiais do Fedora por enquanto. Não existe uma versão específica para a remoção do pacote python3-nose.

Usuários e desenvolvedores de pacotes dependentes são encorajados a mudar para python3-pytest ou python3-nose2.

Sobre migração de pacotes pip instalados por usuários

When you upgrade from Fedora 30 or 31 to Fedora 32, the main Python interpreter version changes from 3.7 to 3.8. If you have any Python packages installed using pip, you must complete the following procedure to migrate them to the new version:

  1. Install the previously main Python version:

    sudo dnf install python3.7
  2. Get pip for the previously main Python version:

    python3.7 -m ensurepip --user
  3. Observe the installed packages:

    python3.7 -m pip list
  4. Save the list with specific versions:

    python3.7 -m pip freeze > installed.txt
  5. Install the same packages for the now default version:

    python3 -m pip install --user -r installed.txt
  6. Uninstall user-installed packages for 3.7; this ensures proper removal of files in ~/.local/bin:

    python3.7 -m pip uninstall $(python3.7 -m pip list --user | cut -d" " -f1)
  7. Optionally, clean up the now empty directory structure:

    rm -rf ~/.local/lib/python3.7/
  8. Optionally, remove the unneeded Python version:

    sudo dnf remove python3.7

Additionally, if you have any pip packages installed using sudo, run the following commands before running the final step above which removes `python3.7`, or install it again temporarily:

  1. Get pip for the previously main Python version for root:

    sudo python3.7 -m ensurepip
  2. Observe the system-installed packages:

    sudo python3.7 -m pip list
  3. Uninstall installed packages for 3.7; this ensures proper removal of files in /usr/local/bin:

    sudo python3.7 -m pip uninstall $(python3.7 -m pip list | cut -d" " -f1)
  4. Optionally, clean up now empty directory structure:

    sudo rm -rf /usr/local/lib*/python3.7/

If you followed the first procedure, the packages are already installed for your user account, which is the preferred option. Avoid using sudo pip in the future; these instructions are only intended to recover users who already used sudo pip in the past.