Sphinx-Julia¶
Sphinx-Julia provides two separate extensions for sphinx:
- Julia Domain
- A sphinx domain for Julia.
- Julia Autodoc
- Automatic docstring extraction from Julia source files.
Installation¶
Requirements¶
For the autodoc functionality to work properly a working pyjulia (https://github.com/JuliaLang/pyjulia) installation has to be available. There exists a fall-back solution but its much slower.
PyPI - the Python Package Index¶
You can download the latest package from the official Python Package Index
Source¶
Development happens on github (https://github.com/bastikr/sphinx-julia.git) and the source code can be obtained usinge the command
>> git clone https://github.com/bastikr/sphinx-julia.git
Make sure sphinx can find the extensions by either adding this repository to the PYTHONPATH
e.g.
>> export PYTHONPATH=$PYTHONPATH:~/sphinx-julia
or alternatively adding the path directly in the sphinx config file conf.py
# conf.py
import sys
import os
sys.path.insert(0, os.path.abspath('~/sphinx-julia'))
Usage¶
To use these extensions you have to specify this in the conf.py
file by adding sphinxjulia.juliadomain
and sphinxjulia.juliaautodoc
to the extensions list. If you have docstrings in numpy or google style you can also add sphinx.ext.napoleon
which will give much nicer output.
extensions = [
'sphinxjulia.juliadomain',
'sphinxjulia.juliaautodoc',
'sphinx.ext.napoleon',
]
The directives provided by these extensions are explained in Julia Domain and Julia Autodoc. The documentation for the napoleon extension can be found at http://sphinx-doc.org/latest/ext/napoleon.html.