summaryrefslogtreecommitdiff
path: root/doc/install.rst
blob: f3e015e463186d052daac6a4d216c3f002281d96 (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
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

.. _install:

============
Installation
============

.. highlight:: console

.. _coverage_pypi: https://pypi.org/project/coverage/
.. _setuptools: https://pypi.org/project/setuptools/


You can install coverage.py in the usual ways. The simplest way is with pip::

    $ pip install coverage

.. ifconfig:: prerelease

    To install a pre-release version, you will need to specify ``--pre``::

        $ pip install --pre coverage

    or the exact version you want to install:

    .. parsed-literal::

        $ pip install |coverage-equals-release|

.. _install_extension:

C Extension
-----------

Coverage.py includes a C extension for speed. It is strongly recommended to use
this extension: it is much faster, and is needed to support a number of
coverage.py features.  Most of the time, the C extension will be installed
without any special action on your part.

You can determine if you are using the extension by looking at the output of
``coverage --version``:

.. parsed-literal::

    $ coverage --version
    Coverage.py, version |release| with C extension
    Documentation at |doc-url|

The first line will either say "with C extension," or "without C extension."

If you are missing the extension, first make sure you have the latest version
of pip in use when installing coverage.

If you are installing on Linux, you may need to install the python-dev and gcc
support files before installing coverage via pip.  The exact commands depend on
which package manager you use, which Python version you are using, and the
names of the packages for your distribution.  For example::

    $ sudo apt-get install python-dev gcc
    $ sudo yum install python-devel gcc

    $ sudo apt-get install python3-dev gcc
    $ sudo yum install python3-devel gcc

A few features of coverage.py aren't supported without the C extension, such
as concurrency and plugins.


Checking the installation
-------------------------

If all went well, you should be able to open a command prompt, and see
coverage.py installed properly:

.. parsed-literal::

    $ coverage --version
    Coverage.py, version |release| with C extension
    Documentation at |doc-url|

You can also invoke coverage.py as a module:

.. parsed-literal::

    $ python -m coverage --version
    Coverage.py, version |release| with C extension
    Documentation at |doc-url|