ESPnet document generation
Less than 1 minute
ESPnet document generation
Install
We use sphinx to generate HTML documentation.
# Clean conda env for docs
$ cd <espnet_root>
$ conda create -p ./envs python=3.10
$ conda activate ./envs
# Requirements
$ pip install -e ".[all]"
$ pip install -e ".[doc]"
$ conda install conda-forge::ffmpeg
$ conda install conda-forge::nodejs==22.6.0
# (Optional requirement) To use flake8-docstrings
$ pip install -U flake8-docstrings
If you used the above clean conda environment, you have write your own . tools/activate_python.sh
. The example will be:
#!/usr/bin/env bash
# You might check $CONDA_EXE to find the <conda_root>
. <conda_root>/miniconda/etc/profile.d/conda.sh && conda activate <espnet_root>/envs
Style check using flake8-docstrings
You can check that your docstring style is correct by ci/test_flake8.sh
using flake8-docstrings. Note that many existing files have been added to the black list in the script to avoid this check by default. You can freely remove files that you wanna improve.
# in ci/test_flake8.sh
# you can improve poorly written docstrings from here
flake8_black_list="\
espnet/__init__.py
espnet/asr/asr_mix_utils.py
espnet/asr/asr_utils.py
espnet/asr/chainer_backend/asr.py
...
"
# --extend-ignore for wip files for flake8-docstrings
flake8 --extend-ignore=D test utils doc ${flake8_black_list}
# white list of files that should support flake8-docstrings
flake8 espnet --exclude=${flake8_black_list//$'\n'/,}
DO NOT ADD NEW FILES TO THIS BLACK LIST!
Generate HTML
You can generate and test the webpage using sphinx Makefile.
$ cd <espnet_root>
$ ./ci/doc.sh
$ npm run docs:dev
Deploy
When your PR is merged into master
branch, our CI will automatically deploy your sphinx html into https://espnet.github.io/espnet/.