[doc] move python tests from python/README.md to doc/python_module.rst
[aubio.git] / doc / python_module.rst
1 .. _python-install:
2
3 Installing aubio for Python
4 ===========================
5
6 The aubio extension for Python is available for Python 2.7 and Python 3.
7
8 Installing aubio with pip
9 -------------------------
10
11 aubio can now be installed using ``pip``:
12
13 .. code-block:: console
14
15     $ pip install aubio
16
17 Building the module
18 -------------------
19
20 From ``aubio`` source directory, run the following:
21
22 .. code-block:: console
23
24     $ ./setup.py clean
25     $ ./setup.py build
26     $ sudo ./setup.py install
27
28
29 .. _py-doubleprecision:
30
31 Double precision
32 ----------------
33
34 This module can be compiled in double-precision mode, in which case the
35 default type for floating-point samples will be 64-bit. The default is
36 single precision mode (32-bit, recommended).
37
38 To build the aubio module with double precision, use the option
39 `--enable-double` of the `build_ext` subcommand:
40
41 .. code:: bash
42
43     $ ./setup.py clean
44     $ ./setup.py build_ext --enable-double
45     $ pip install -v .
46
47 **Note**: If linking against `libaubio`, make sure the library was also
48 compiled in :ref:`doubleprecision` mode.
49
50
51 Checking your installation
52 --------------------------
53
54 Once the python module is installed, its version can be checked with:
55
56 .. code-block:: console
57
58     $ python -c "import aubio; print(aubio.version, aubio.float_type)"
59
60 The command line `aubio` is also installed:
61
62 .. code-block:: console
63
64     $ aubio -h
65
66
67 Python tests
68 ------------
69
70 A number of Python tests are provided in the `python tests`_. To run them,
71 install `nose2`_ and run the script ``python/tests/run_all_tests``:
72
73 .. code-block:: console
74
75     $ pip install nose2
76     $ ./python/tests/run_all_tests
77
78 .. _demo_filter.py: https://github.com/aubio/aubio/blob/master/python/demos/demo_filter.py
79 .. _python tests: https://github.com/aubio/aubio/blob/master/python/tests
80 .. _nose2: https://github.com/nose-devs/nose2