How to migrate from ansicolor to ansicolors

The ansicolor package in Python has not been updated in a long time and doesn’t have any documentation on PyPI. Therfore, I migrated my Python scripts to ansicolors (with an s at the end). Only a few steps are neccessary:

First, replace

how-to-migrate-from-ansicolor-to-ansicolors.py
from ansicolor import red

by

ansicolors_usage_example.py
from colors import red

Additionally, bold=True is called style="bold" in ansicolors, hence you need to replace

ansicolors_style_change_example.py
red("msg", bold=True)

by

ansicolors_style_new.py
red("msg", style="bold")

Check out similar posts by category: Python