Debian Codegraph @

docs/install.rst

raw
1 Installing
2 ==========
3
4 Using pip
5 ---------
6
7 Bonsai can be simply installed with Pip::
8
9 $ pip install bonsai
10
11 Install from source on Linux
12 ----------------------------
13
14 These notes illustrate how to compile Bonsai on Linux.
15
16 .. _requirements:
17
18 Bonsai is a C wrapper to the OpenLDAP libldap2 library. To install it
19 from sources you will need:
20
21 - A C compiler (The module is tested with gcc).
22
23 - The Python 3 header files. They are usually installed in a package such as
24 **python3-dev**.
25
26 - The libldap header files. They are usually installed in a package such as
27 **libldap2-dev**.
28
29 - The libsasl header files. They are usually installed in a package such as
30 **libsasl2-dev**.
31
32 - The Bonsai source files. You can download it from the project's `GitHub site`_.
33
34 - Optionally for additional functions the Kerberos header files. They are
35 usually installed in a package such as **libkrb5-dev** or **heimdal-dev**.
36
37 .. _github site: https://github.com/noirello/bonsai
38
39 Once you downloaded and unpackaged the Bonsai source files, you can run the
40 following command to compile and install the package::
41
42 $ python3 setup.py build
43 $ sudo python3 setup.py install
44
45 Install from source on Windows
46 ------------------------------
47
48 Bonsai uses WinLDAP on Microsoft Windows. To install it from sources you will
49 need a C compiler and the Bonsai source files. After you downloaded and
50 unpackaged the sources, you can run::
51
52 $ python setup.py build
53 $ python setup.py install
54
55 .. note::
56 Compiling the package with MinGW is no longer recommended.
57
58 Install from source on macOS
59 ----------------------------
60
61 Because macOS is shipped with an older version of libldap which lacks of
62 several features that Bonsai relies on, a newer library needs to be installed
63 before compiling the module.
64
65 Install `openldap` homebrew-core formula::
66
67 $ brew install openldap
68
69 Modify the `setup.cfg` in the root folder to customize the library and headers
70 directory:
71
72 .. code-block:: ini
73
74 [build_ext]
75 include_dirs=/usr/local/opt/openldap/include
76 library_dirs=/usr/local/opt/openldap/lib
77
78 Or with Apple Silicon:
79
80 .. code-block:: ini
81
82 [build_ext]
83 library_dirs = /opt/homebrew/opt/openldap/lib
84 include_dirs = /usr/include/sasl:/opt/homebrew/opt/openldap/include
85
86
87 and then you can follow the standard build commands::
88
89 $ python setup.py build
90 $ python setup.py install
91
92 .. note::
93 More directories can be set for include and library dirs (e.g. path to the
94 Kerberos headers and libraries) by separating the paths with `:` in the
95 `setup.cfg` file.
96
97 After installing Bonsai, you can learn the basic usage in the :doc:`tutorial`.