README.rst 2.65 KB
Newer Older
1
2
3
Documentation
=============

4
Documentation for LightGBM is generated using `Sphinx <https://www.sphinx-doc.org/>`__
5
and `Breathe <https://breathe.readthedocs.io/>`__, which works on top of `Doxygen <https://www.doxygen.nl/index.html>`__ output.
6

7
List of parameters and their descriptions in `Parameters.rst <./Parameters.rst>`__
8
is generated automatically from comments in `config file <https://github.com/microsoft/LightGBM/blob/master/include/LightGBM/config.h>`__
9
by `this script <https://github.com/microsoft/LightGBM/blob/master/.ci/parameter-generator.py>`__.
10

11
12
13
14
15
After each commit on ``master``, documentation is updated and published to `Read the Docs <https://lightgbm.readthedocs.io/>`__.

Build
-----

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
It is not necessary to re-build this documentation while modifying LightGBM's source code.
The HTML files generated using ``Sphinx`` are not checked into source control.
However, you may want to build them locally during development to test changes.

Docker
^^^^^^

The most reliable way to build the documentation locally is with Docker, using `the same images Read the Docs uses <https://hub.docker.com/r/readthedocs/build>`_.

Run the following from the root of this repository to pull the relevant image and run a container locally.

.. code:: sh

    docker run \
        --rm \
        --user=0 \
        -v $(pwd):/opt/LightGBM \
        --env C_API=true \
        --env CONDA=/opt/miniforge \
        --env READTHEDOCS=true \
        --workdir=/opt/LightGBM/docs \
        --entrypoint="" \
38
        readthedocs/build:ubuntu-20.04-2021.09.23 \
39
40
41
42
43
44
45
46
47
48
49
50
        /bin/bash build-docs.sh

When that code completes, open ``docs/_build/html/index.html`` in your browser.

.. note::

    The navigation in these locally-built docs does not link to the local copy of the R documentation. To view the local version of the R docs, open ``docs/_build/html/R/index.html`` in your browser.

Without Docker
^^^^^^^^^^^^^^

You can build the documentation locally without Docker. Just install Doxygen and run in ``docs`` folder
51
52
53

.. code:: sh

54
    pip install breathe sphinx 'sphinx_rtd_theme>=0.5'
55
    make html
56

57
Note that this will not build the R documentation.
58
Consider using common R utilities for documentation generation, if you need it.
59
Or use the Docker-based approach described above to build the R documentation locally.
60

61
62
Optionally, you may also install ``scikit-learn`` and get richer documentation for the classes in ``Scikit-learn API``.

63
If you faced any problems with Doxygen installation or you simply do not need documentation for C code, it is possible to build the documentation without it:
64
65
66

.. code:: sh

67
    pip install sphinx 'sphinx_rtd_theme>=0.5'
68
    export C_API=NO || set C_API=NO
69
    make html