The PJSIP docs at https://docs.pjsip.org is hosted by the Read the Docs (RTD) service. It contains:
- reference manuals (was at pjsip.org/docs/latest/...
- pjsua2 book (was at pjsip.org/docs/book-latest)
- (TODO) wiki (previously at https://trac.pjsip.org/repos/)
The PJSIP's RTD settings page is at https://readthedocs.org/projects/pjsip/. Here you can control various aspects of the RTD page. Some will be explained below.
The documentation repository is at https://github.com/pjsip/pjproject_docs (you're reading the README of that repository).
docs/
source/
conf.py
: Sphinx conf*.rst
: hand-written documentationpjproject/
: Git submodule for pjprojectapi/
*.rst
: hand-written index files for API referencegenerated/
: output directory ofbreathe-apidoc
pjsua2/
*.rst
: PJSUA2 book (was pjsip-book)
build/
: output files will be placed here
There are two ways to build PJSIP RTD docs: locally, and in the RTD server. You build the docs locally only when developing the documentation itself, i.e. to preview the results locally.
For the live version, the docs are built in the RTD server automatically whenever changes are pushed to pjproject_docs repository (note: not the pjproject repository!)
These are for generating the docs locally. For RTD, the required installations are already specified in readthedocs.yml
and requirements.txt
.
Note that local installation is not required for releasing new documentation version (new pjproject version). You only need a text editor for that. This will be explained in later section.
Also note that these are only tested on Linux at the moment. Macs should work, and Windows is supported in the codes, but both haven't been tested yet.
You need at least Doxygen 1.8.1 because Doxygen 1.5.1 is not suitable for Breathe.
We need Python version 3.7 or newer. It's also recommended co create virtualenv
environment to avoid cluttering your main Python installation.
$ git clone https://github.com/pjsip/pjproject_docs.git
$ cd pjproject_docs
$ git submodule update --init --recursive
Note: the last command is for fetching the pjproject
submodule in docs/source/pjproject
directory.
Run this command (maybe inside your virtualenv) to install the required Python modules:
$ pip install -r requirements.txt
Check that the tools are available on the PATH by running the following:
$ doxygen -v
$ sphinx-build --version
$ breathe-apidoc --version
You build the docs locally when you are developing them in order to test locally first before updating the live docs.
Here are the steps to do it. Make sure you have followed the steps in Installation above. If you created a virtualenv environment, activate that environment.
Subsequently, to update pjproject_docs
and the pjproject
submodule:
$ cd pjproject_docs
$ git pull --recurse-submodules
Bash:
$ export READTHEDOCS=True
Windows:
C:> SET READTHEDOCS=True
Note: setting the READTHEDOCS
environment variable causes the build system to
regenerate Doxygen XML and breathe API docs. If this is unset, breathe will generate
documentation from existing Doxygen XML files.
$ cd docs
$ make clean html
The result is docs/build/html/index.html
. You can open this in the browser.
Just for information, when running Sphinx's make html
, or when building the doc in RTD server, the following processes happen:
docs/source/conf.py
is read by sphinx- if
READTHEDOCS
environment variable is set to True,doxygen
is run byconf.py
. This outputs Doxygen XML files in variouspjproject/**/docs
directories. breathe-apidoc
is run byconf.py
. This script reads Doxygen's XML files and outputs.rst
documentation for all files indocs/source/api/generated
directory.- Sphinx then processes the
.rst
files and build a nice documentation.
The live (RTD) docs in https://docs.pjsip.org are generated automatically whenever changes are pushed to the pjproject_docs
repository.
You can see the live building process, as well as logs of all previous build processes from the Builds page (https://readthedocs.org/projects/pjsip/builds/). This comes handy when the build failed to investigate what went wrong.
You can also manually trigger rebuilding of the doc by clicking Build Version from that page, but this shouldn't be necessary unless you modify something in the RTD settings and want to regenerate the docs.
RTD supports multiple versions of the docs. It does so by analyzing the Git tags of the pjproject_docs repository.
As an overview, by default RTD only supports latest
version of the doc, which corresponds to latest commit in Git master
. If there is a Git tag in the repository, RTD will create stable
version of the doc, which corresponds to the latest Git tag of the repository. If you wish to show the individual version, activate the version from https://readthedocs.org/projects/pjsip/versions/.
For more info please see https://docs.readthedocs.io/en/stable/versions.html
Follow the steps below to create new documentation version.
$ cd pjproject_docs
$ git pull --recurse-submodules
Bash:
$ export READTHEDOCS=True
Windows:
C:> SET READTHEDOCS=True
- Edit
docs/source/conf.py
- Modify
pjproject_tag
to match the PJPROJECT Git tag which documentation is to be built. Example:pjproject_tag = '2.10'
- Save and close
You need to have local installation to do this. Build the docs by running these:
$ cd docs
$ make clean html
Then open docs/build/html/index.html
to preview the result.
$ cd pjproject_docs
$ git add -u
$ git commit -m 'Setting pjproject version to 2.10'
$ git tag 2.10
Push the tags first then the code.
$ cd pjproject_docs
$ git push --tags
$ git push
The last command would trigger a building process for version latest
in RTD.
Open https://readthedocs.org/projects/pjsip/builds/, there should be one that is currently
building (i.e. for latest
version).
You may wait until it is finished (it will take approximately 15 minutes) to make sure that everything is okay, or otherwise continue to the next steps (but it will cause more than one build processes to be started by RTD, which is okay).
Go to https://readthedocs.org/projects/pjsip/versions/, and activate the new version and make it active and public.
This will trigger a new build process for that version.
Wait until all build processes are finished.
After a version is released, if you want to generate a documentation for the latest master (i.e. before next version is released), you need to do the following.
- Edit
docs/source/conf.py
- Set
pjproject_tag
master
, e.g.:pjproject_tag = 'master'
- Save and close
$ cd pjproject_docs
$ git add -u
$ git commit -m ..
$ git push
Note that you must not add any tags to the pjproject_docs
repository.
There should be a build process for the latest version.
If the building fails, these are the steps to recreate the documentation.
-
Investigate the error by looking at the build logs (in the Builds page)
-
Fix the error.
-
If the error is in the
latest
version, you just need to commit, push, and watch the building process in RTD. -
If the error is in the tagged version (e.g.
2.10
, etc.), then you need to delete the tag first:$ git tag -d <the tag> $ git push --delete origin <the tag>
To clean up the build
directory:
$ cd docs
$ make clean
For reference: