How To Install python-pretty-yaml on Debian 10

Learn how to install python-pretty-yaml on Debian 10 with this tutorial. python-pretty-yaml is module to produce pretty and readable YAML-serialized data (Python 2)

Introduction

In this tutorial we learn how to install python-pretty-yaml on Debian 10.

What is python-pretty-yaml

python-pretty-yaml is:

YAML is generally nice and easy format to read if it was written by humans. PyYAML can a do fairly decent job of making stuff readable. pyaml tries to improve on that a bit, with the following tweaks:

  • Most human-friendly representation options in PyYAML get picked as defaults.
  • Does not dump “null” values, if possible, replacing these with just empty strings, which have the same meaning but reduce visual clutter and are easier to edit.
  • Dicts, sets, OrderedDicts, defaultdicts, namedtuples, etc are representable and get sorted on output (OrderedDicts and namedtuples keep their ordering), so that output would be as diff-friendly as possible, and not arbitrarily depend on Python internals.
  • It appears that at least recent PyYAML versions also do such sorting for Python dicts.
  • List items get indented, as they should be.
  • bytestrings that can’t be auto-converted to unicode raise error, as yaml has no “binary bytes” (i.e. unix strings) type.
  • Attempt is made to pick more readable string representation styles, depending on the value.
  • “force_embed” option to avoid having &id stuff scattered all over the output (which might be beneficial in some cases, hence the option).
  • “&id” anchors, if used, get labels from the keys they get attached to, not just use meaningless enumerators.
  • “string_val_style” option to only apply to strings that are values, not keys.
  • Has an option to add vertical spacing (empty lines) between keys on different depths, to make output much more seekable.

This package installs the Python 2 version.

There are three methods to install python-pretty-yaml on Debian 10. 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-pretty-yaml 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-pretty-yaml using apt-get by running the following command:

sudo apt-get -y install python-pretty-yaml

Install python-pretty-yaml Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-pretty-yaml

Install python-pretty-yaml 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-pretty-yaml using aptitude by running the following command:

sudo aptitude -y install python-pretty-yaml

How To Uninstall python-pretty-yaml on Debian 10

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

sudo apt-get remove python-pretty-yaml

Uninstall python-pretty-yaml And Its Dependencies

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

sudo apt-get -y autoremove python-pretty-yaml

Remove python-pretty-yaml Configurations and Data

To remove python-pretty-yaml configuration and data from Debian 10 we can use the following command:

sudo apt-get -y purge python-pretty-yaml

Remove python-pretty-yaml configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python-pretty-yaml

Dependencies

python-pretty-yaml have the following dependencies:

References

Summary

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