How To Install python3-dacite on Kali Linux

In this tutorial we learn how to install python3-dacite on Kali Linux. python3-dacite is Simple creation of data classes from dictionaries

Introduction

In this tutorial we learn how to install python3-dacite on Kali Linux.

What is python3-dacite

python3-dacite is:

Passing plain dictionaries as a data container between your functions or methods isn’t a good practice. Of course you can always create your custom class instead, but this solution is an overkill if you only want to merge a few fields within a single object.

Fortunately Python has a good solution to this problem - data classes. Thanks to @dataclass decorator you can easily create a new custom type with a list of given fields in a declarative manner. Data classes support type hints by design.

However, even if you are using data classes, you have to create their instances somehow. In many such cases, your input is a dictionary - it can be a payload from a HTTP request or a raw data from a database. If you want to convert those dictionaries into data classes, dacite is your best friend.

This library was originally created to simplify creation of type hinted data transfer objects (DTO) which can cross the boundaries in the application architecture.

It’s important to mention that dacite is not a data validation library. There are dozens of awesome data validation projects and it doesn’t make sense to duplicate this functionality within dacite. If you want to validate your data first, you should combine dacite with one of data validation library.

There are three methods to install python3-dacite on Kali Linux. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python3-dacite Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install python3-dacite

Install python3-dacite Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python3-dacite

Install python3-dacite Using aptitude

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

sudo aptitude update

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

sudo aptitude -y install python3-dacite

How To Uninstall python3-dacite on Kali Linux

To uninstall only the python3-dacite package we can use the following command:

sudo apt-get remove python3-dacite

Uninstall python3-dacite And Its Dependencies

To uninstall python3-dacite and its dependencies that are no longer needed by Kali Linux, we can use the command below:

sudo apt-get -y autoremove python3-dacite

Remove python3-dacite Configurations and Data

To remove python3-dacite configuration and data from Kali Linux we can use the following command:

sudo apt-get -y purge python3-dacite

Remove python3-dacite configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python3-dacite

Dependencies

python3-dacite have the following dependencies:

References

Summary

In this tutorial we learn how to install python3-dacite package on Kali Linux using different package management tools: apt, apt-get and aptitude.