How To Install python-astroid on Debian 9

In this tutorial we learn how to install python-astroid on Debian 9. python-astroid is rebuild a new abstract syntax tree from Pythons AST

Introduction

In this tutorial we learn how to install python-astroid on Debian 9.

What is python-astroid

python-astroid is:

The aim of this module is to provide a common base representation of Python source code for projects such as pychecker, pyreverse, pylint… Well, actually the development of this library is essentially governed by pylint’s needs. It used to be called logilab-astng.

It provides a compatible representation which comes from the _ast module. It rebuilds the tree generated by the builtin _ast module by recursively walking down the AST and building an extended ast. The new node classes have additional methods and attributes for different usages. They include some support for static inference and local name scopes. Furthermore, astroid builds partial trees by inspecting living objects.

Main modules are:

  • bases, node_classses and scoped_nodes contain the classes for the different type of nodes of the tree.

  • the manager contains a high level object to get astroid trees from source files and living objects. It maintains a cache of previously constructed tree for quick access.

python-astroid is the new name of former python-logilab-astng library.

There are three methods to install python-astroid on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-astroid Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-astroid using apt-get by running the following command:

sudo apt-get -y install python-astroid

Install python-astroid Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-astroid using apt by running the following command:

sudo apt -y install python-astroid

Install python-astroid Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-astroid using aptitude by running the following command:

sudo aptitude -y install python-astroid

How To Uninstall python-astroid on Debian 9

To uninstall only the python-astroid package we can use the following command:

sudo apt-get remove python-astroid

Uninstall python-astroid And Its Dependencies

To uninstall python-astroid and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove python-astroid

Remove python-astroid Configurations and Data

To remove python-astroid configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge python-astroid

Remove python-astroid configuration, data, and all of its dependencies

We can use the following command to remove python-astroid configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-astroid

Dependencies

python-astroid have the following dependencies:

References

Summary

In this tutorial we learn how to install python-astroid package on Debian 9 using different package management tools: apt, apt-get and aptitude.