summaryrefslogtreecommitdiff
path: root/README.rst
blob: 3f649431631a3917cc1bad565dc585f9adf2d00d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
ansicolor
=========

.. image:: https://badge.fury.io/py/ansicolor.png
        :target: https://badge.fury.io/py/ansicolor

.. image:: https://travis-ci.org/numerodix/ansicolor.png?branch=master
    :target: https://travis-ci.org/numerodix/ansicolor

.. image:: https://pypip.in/wheel/ansicolor/badge.png
    :target: https://pypi.python.org/pypi/ansicolor/

.. image:: https://pypip.in/license/ansicolor/badge.png
        :target: https://pypi.python.org/pypi/ansicolor/

Python version support: CPython 2.7, 3.2+.


Introduction
------------

``ansicolor`` is a library that makes it easy to use ansi color markup in command
line programs.


Installation
------------

.. code:: bash

    $ pip install ansicolor


Documentation
-------------

Read the `documentation`_ on Read the Docs!


Going further
-------------

Take a look at the ``demos`` to see what's possible.

.. code:: bash

    $ python -m ansicolor.demos --color
    $ python -m ansicolor.demos --highlight
    $ python -m ansicolor.demos --diff


.. _`documentation`: https://ansicolor.readthedocs.org/



Maintenance tasks
-----------------


Setting up a development environment (Ubuntu)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code:: bash

    # 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 ansicolor

All the steps below assume you have an activated virtual env (even though the
``(ansicolor)`` prompt is not shown).


Running unit tests
^^^^^^^^^^^^^^^^^^

.. code:: bash

    $ py.test


Measuring code coverage
^^^^^^^^^^^^^^^^^^^^^^^

.. code:: bash

    $ py.test --cov=ansicolor.ansicolor
    $ coverage html
    # open htmlcov/index.html in the browser


Running all possible tests under tox
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We 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.

.. code:: bash

    # to run against all interpreters
    $ tox

    # to run only against selected interpreters
    $ tox -e py27,py38


Checking code style
^^^^^^^^^^^^^^^^^^^

.. code:: bash

    $ flake8 ansicolor