Skip to content

Commit 6168134

Browse files
authored
Sphinx fixes (against doc-prod) (#2687)
* add sphinx apidoc to circleci artifacts * added bison to try to fix ci * build the doc on python 3.7 (lazy import) * use local plotly for all branches (pip install -e . is required because of our tweaks in the source code)
1 parent 6c156bf commit 6168134

File tree

3 files changed

+27
-8
lines changed

3 files changed

+27
-8
lines changed

.circleci/config.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ jobs:
374374
docker:
375375
# specify the version you desire here
376376
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
377-
- image: circleci/python:3.6.8-node
377+
- image: circleci/python:3.7-stretch-node-browsers
378378

379379
working_directory: ~/project
380380

@@ -400,12 +400,13 @@ jobs:
400400
. venv/bin/activate
401401
npm install [email protected]
402402
npm install orca
403+
pip install -U pip
403404
pip uninstall -y plotly
404405
pip install -r requirements.txt
405406
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
406407
pip uninstall -y plotly
407408
cd ../packages/python/plotly
408-
python3 setup.py install
409+
pip install -e .
409410
cd ../../../doc
410411
fi
411412
echo 'export PATH="/home/circleci/project/doc/node_modules/.bin:$PATH"' >> $BASH_ENV
@@ -463,6 +464,15 @@ jobs:
463464
command: |
464465
cd doc
465466
. venv/bin/activate
467+
# For the API doc, we need to use the local version of plotly
468+
# since we are tweaking the source because of
469+
# graph_objs/graph_objects
470+
if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then
471+
pip uninstall -y plotly
472+
cd ../packages/python/plotly
473+
pip install -e .
474+
cd ../../../doc
475+
fi
466476
cd apidoc
467477
make html
468478
if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then
@@ -478,12 +488,14 @@ jobs:
478488
rm -rf .git
479489
cd ../..
480490
fi
481-
482491
cd ../..
483492
484493
- store_artifacts:
485494
path: doc/build
486495
destination: doc/build
496+
- store_artifacts:
497+
path: doc/apidoc/_build/
498+
destination: doc/apidoc/_build/
487499

488500
workflows:
489501
version: 2

doc/apidoc/Makefile

+11-4
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,24 @@ help:
2222
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*.py
2323
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*.py
2424
sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*/*/*/*.py
25+
# Copy _plotly_utils file so that they appear in the API doc
2526
cp ../../packages/python/plotly/_plotly_utils/colors/sequential.py ../../packages/python/plotly/_plotly_utils/colors/diverging.py ../../packages/python/plotly/_plotly_utils/colors/qualitative.py ../../packages/python/plotly/_plotly_utils/colors/cyclical.py ../../packages/python/plotly/_plotly_utils/colors/colorbrewer.py ../../packages/python/plotly/_plotly_utils/colors/carto.py ../../packages/python/plotly/_plotly_utils/colors/cmocean.py ../../packages/python/plotly/plotly/colors
2627
cp ../../packages/python/plotly/_plotly_utils/colors/sequential.py ../../packages/python/plotly/_plotly_utils/colors/diverging.py ../../packages/python/plotly/_plotly_utils/colors/qualitative.py ../../packages/python/plotly/_plotly_utils/colors/cyclical.py ../../packages/python/plotly/_plotly_utils/colors/colorbrewer.py ../../packages/python/plotly/_plotly_utils/colors/carto.py ../../packages/python/plotly/_plotly_utils/colors/cmocean.py ../../packages/python/plotly/plotly/express/colors
28+
# Run sphinx-apidoc script to create hierarchy of rst files to generate
29+
# docstrings. The first path is the one to process, the following ones
30+
# are excluded from the search.
31+
rm -rf _build generated
2732
sphinx-apidoc -M -o generated ../../packages/python/plotly/plotly ../../packages/python/plotly/plotly/validators ../../packages/python/plotly/plotly/tests ../../packages/python/plotly/plotly/matplotlylib/ ../../packages/python/plotly/plotly/offline ../../packages/python/plotly/plotly/api
33+
# Run sphinx-build to build html pages from the rst pages
2834
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2935
git checkout -- ../../packages/python/plotly/plotly/graph_objs
36+
# Remove files which were added only for docstring generation
3037
rm ../../packages/python/plotly/plotly/colors/diverging.py ../../packages/python/plotly/plotly/colors/sequential.py ../../packages/python/plotly/plotly/colors/qualitative.py ../../packages/python/plotly/plotly/colors/cyclical.py ../../packages/python/plotly/plotly/colors/colorbrewer.py ../../packages/python/plotly/plotly/colors/carto.py ../../packages/python/plotly/plotly/colors/cmocean.py
3138
rm ../../packages/python/plotly/plotly/express/colors/diverging.py ../../packages/python/plotly/plotly/express/colors/sequential.py ../../packages/python/plotly/plotly/express/colors/qualitative.py ../../packages/python/plotly/plotly/express/colors/cyclical.py ../../packages/python/plotly/plotly/express/colors/colorbrewer.py ../../packages/python/plotly/plotly/express/colors/carto.py ../../packages/python/plotly/plotly/express/colors/cmocean.py
3239
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
3340
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
34-
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html
35-
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv
36-
sed -i 's/graph_objs/graph_objects/g' _build/html/*.js
37-
sed -i 's/graph_objs/graph_objects/g' _build/html/generated/*.html
41+
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html
42+
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv
43+
sed -i 's/graph_objs/graph_objects/g' _build/html/*.js
44+
sed -i 's/graph_objs/graph_objects/g' _build/html/generated/*.html
3845
sed -i 's/graph_objs/graph_objects/g' _build/html/generated/generated/*.html

doc/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ recommonmark
2323
pathlib
2424
python-frontmatter
2525
datashader
26-
pyarrow
26+
pyarrow
2727
cufflinks==0.17.3

0 commit comments

Comments
 (0)