Python version support: CPython 2.7, 3.2+.
ansicolor is a library that makes it easy to use ansi color markup in command
line programs.
$ pip install ansicolorYou can also download tarballs from Github.
Read the documentation on Read the Docs!
Take a look at the demos to see what's possible.
$ python -m ansicolor.demos --color
$ python -m ansicolor.demos --highlight
$ python -m ansicolor.demos --diff# if you don't have `mkvirtualenv` & `workon` functions in your shell
$ sudo apt install virtualenvwrapper
# creating the virtual env the first time
$ mkvirtualenv ansicolor
(ansicolor) $ pip install -r dev-requirements.txt
# re-activating the virtual env next time
$ workon ansicolorAll the steps below assume you have an activated virtual env (even though the
(ansicolor) prompt is not shown).
The tests expect the environment variable TERM to be set, and to a value
that is not dumb. If this is not the case tests will fail.
The canonical setting is TERM=xterm to signal that a terminal supports
ANSI control codes just like xterm does.
$ py.test$ py.test --cov=ansicolor.ansicolor
$ coverage html
# open htmlcov/index.html in the browserWe use tox to run both the unit tests and the demos under several different
Python interpreter versions. Depending on which interpreters you have installed
(this is managed system-wide and not covered in this README) tox will most
likely give you a partial success.
# to run against all interpreters
$ tox
# to run only against selected interpreters
$ tox -e py27,py38$ flake8 ansicolor$ black ansicolor tests- Before starting work on a change/fix/whatever, make sure there is no
unfinished work on
developand mergemasterintodevelop. - Make all the changes on
develop.
Quality assurance (see steps above for how to):
- Make sure all tests are passing.
- Make sure test coverage has not declined.
- Make sure
toxrun succeeds on all (installed) interpreters. - Make sure
flake8checker passes. - Make sure
blackformatter has no changes to make.
Doc updates:
- Update
docs/src/changes.rst.
Doing a release:
- Bump version in
ansicolor/__init__.py. - Git tag the new version and push the tag. This allows users/packagers to download an auto-generated zip/tarball of the tagged release from Github.
python setup.py sdistpython setup.py bdist_wheeltwine upload dist/*
Finally:
- Merge
developintomaster.
Post-release verification:
pip install -U ansicolorfrom PyPI and use a tool that uses it.