How To Install python-protocols on Ubuntu 18.04

In this tutorial we learn how to install python-protocols on Ubuntu 18.04. python-protocols is Open Protocols and Component Adaptation for Python

Introduction

In this tutorial we learn how to install python-protocols on Ubuntu 18.04.

What is python-protocols

python-protocols is:

Do you hate having to write lots of if-then logic to test what type something is? Wouldn’t it be nice if you could just declare “I want this object to have this behavior” and magically convert whatever value you have, to the type you need? PyProtocols lets you do just that, cleanly, quickly, and robustly – even with built-in types or other people’s classes.

PyProtocols extends the PEP 246 adapt() function with a new “declaration API” that lets you easily define your own protocols and adapters, and declare what adapters should be used to adapt what types, objects, or protocols. In addition to its own Interface type, PyProtocols can also use Twisted and Zope’s Interface types too. (Of course, since Twisted and Zope interfaces aren’t as flexible, only a subset of the PyProtocols API works with them. Specific limitations are listed in the documentation.)

There are three methods to install python-protocols on Ubuntu 18.04. 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-protocols 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-protocols using apt-get by running the following command:

sudo apt-get -y install python-protocols

Install python-protocols Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-protocols

Install python-protocols 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 Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install python-protocols

How To Uninstall python-protocols on Ubuntu 18.04

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

sudo apt-get remove python-protocols

Uninstall python-protocols And Its Dependencies

To uninstall python-protocols and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-protocols

Remove python-protocols Configurations and Data

To remove python-protocols configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-protocols

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

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

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

References

Summary

In this tutorial we learn how to install python-protocols package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.