Skip to content

Commit

Permalink
Automate generation of python documentation (microsoft#6909)
Browse files Browse the repository at this point in the history
Co-authored-by: xavier dupré <xavier.dupre@gmail.com>
xadupre and sdpython authored Mar 12, 2021
1 parent f7df2f8 commit 694389a
Showing 2 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ stages:
Repository: onnxruntimecpubuild

- task: CmdLine@2
displayName: 'Build Python Wheel'
inputs:
script: |
mkdir -p $HOME/.onnx
@@ -106,8 +107,32 @@ stages:
Contents: 'Release/dist/*.whl'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: CmdLine@2
displayName: 'Build Python Documentation'
inputs:
script: |
mkdir -p $HOME/.onnx
docker run --rm \
--volume /data/onnx:/data/onnx:ro \
--volume $(Build.SourcesDirectory):/onnxruntime_src \
--volume $(Build.BinariesDirectory):/build \
--volume /data/models:/build/models:ro \
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
onnxruntimecpubuild \
bash /onnxruntime/tools/doc/builddoc.sh $(PythonManylinuxDir)/bin/ $(Build.SourcesDirectory) $(Build.BinariesDirectory)
workingDirectory: $(Build.SourcesDirectory)

- task: CopyFiles@2
displayName: 'Copy Python Documentation to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.BinariesDirectory)'
Contents: '*.zip'
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: ONNXRuntime python wheel'
displayName: 'Publish Artifact: ONNXRuntime python wheel and documentation'
inputs:
ArtifactName: onnxruntime

11 changes: 8 additions & 3 deletions tools/doc/builddoc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# This script must be executed from this folder.
pip install -r ../../docs/python/requirements.txt
python -m sphinx -j2 -v -T -b html -d ../../build/docs/_doctrees/html ../../docs/python ../../build/docs/html
python -u rename_folders.py ../../build/docs/html
# $1 python path
# $2 source folder
# $3 build folder
$1/python -m pip install -r $2/docs/python/requirements.txt
export PYTHONPATH=$3/Release/Release:$PYTHONPATH
$1/python -m sphinx -j2 -v -T -b html -d $3/docs/_doctrees/html $2/docs/python $3/docs/html
$1/python -u rename_folders.py $3/docs/html
zip -r $3/python_doc.zip $3/docs/html

0 comments on commit 694389a

Please sign in to comment.