Archives For python

After several alpha, beta and rc tests, the Python programming language finally released version 3.10 today!

Python 3.10 will receive bug-fix updates in next 18 months. After that, it’s supported with 5-year security updates until October 2026.

What’s New in Python 3.10:

  • Pattern matching syntax, inspired by similar syntax found in Scala, Erlang, and other languages.
  • Support using enclosing parentheses for continuation across multiple lines in context managers
  • Allow writing union types as X | Y
  • Add optional length-checking to zip
  • Precise line numbers for debugging and other tools
  • Require OpenSSL 1.1.1 or newer
  • Remove Py_UNICODE encoder APIs
  • Add optional EncodingWarning
  • Explicit Type Aliases
  • Parameter Specification Variables

See the release note for more about Python 3.10.

How to Install Python 3.10 in Ubuntu:

The well trusted “deadsnakes” team PPA has made the packages for Ubuntu 20.04, Ubuntu 18.04, and derivatives, e.g., Linux Mint 20, Elementary OS 6 and Zorin OS 16.

1.) Firstly, open terminal by either searching from overview screen or pressing Ctrl+Alt+T on keyboard. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:deadsnakes/ppa

2.) Then refresh system cache and install the language via command:

sudo apt update && sudo apt install python3.10

Use Python 3.10 as default Python3:

It’s possible to make Python3 in Ubuntu to be Python3.10 via following commands. However, it causes issues, such as Gnome Terminal refuses to launch. Do it at your own risk!

  • Check current Python3 version:
    python3 --version
  • Use update-alternatives to create symbolic links to python3 (replace python3.8 in Ubuntu 16.04 with ):
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
    sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
  • And choose which one to use as Python3 via command:
    sudo update-alternatives --config python3

JetBrains announced the release of PyCharm 2021.2. Features Python 3.10 support, auto-reload for browser HTML preview.

Starting with the new release, users from Asian can enjoy the a fully localized UI in Chinese, Korean, or Japanese. And it’s going to end support for several packages, e.g., mako, buildout, web2py, in next release.

Before Python 3.10 goes stable, the IDE starts working for Python 3.10 support with following features:

  • Adjust to the upcoming Structural Pattern Matching, such as the Unused local symbols and Unreachable code inspections, smart code completion and syntax highlighting for the match and case keywords, and the Complete Current Statement action.
  • Complete match statements and their corresponding case blocks.
  • Supports type inference for isinstance and issubclass arguments with the new syntax type.

And other changes include:

  • Working in the Python console is now supported on both the client and the host side.
  • Code completion for fields and operators in the MongoDB console (Pro only).
  • Context live templates from the data editor with SQL scripts action (Pro only).
  • auto-reload for browser HTML preview (pro).
  • Auto-import for require() (pro).
  • New Onboarding Tour in the IDE Features Trainer plugin.
  • Test runner auto-detection
  • The Test Management plugin includes Python support and available for PyCharm Community.
  • New Test Data plugin to generate random data.

How to Install PyCharm 2021.2 in Ubuntu:

Jetbrains provides official Linux package. They are portable tarballs, available to download at the link below:

To make life easier, you can install the community edition from the unofficial PPA. And it supports for Ubuntu 20.04 and Ubuntu 21.04 so far.

1.) Open terminal from start menu, and run command to add the PPA:

sudo add-apt-repository ppa:xtradeb/apps

2.) Manually refresh system package cache, e.g., for Linux Mint:

sudo apt update

3.) Finally install PyCharm via command:

sudo apt install pycharm-community

Uninstall:

To remove the PPA, either run command in terminal:

sudo add-apt-repository --remove ppa:xtradeb/apps

or open “Software & Updates” and navigate to “Other Software” tab to remove the relevant line.

And remove PyCharm by running command in terminal:

sudo apt remove --autoremove pycharm-community