Skip to content

Commit

Permalink
Build docs from individual source elements (Qiskit#551)
Browse files Browse the repository at this point in the history
* execute install code snippets

* copy terra docs into sphinx apidocs

* ignore init

* new location

* updates

* Add support for building api docs from in-repo

This commit adds support for pulling in the source from each repo based
on how it's installed. If we have the metapackage (or releases of the
elements) installed this is a simple operation just pull it from git at
the installed version and copy it to the right place. However, the extra
complexity comes from supporting installs from arbitrary git versions.
We need to be able to checkout an installed copy at a particular sha1
and also copy from a local editable install. This attempts to do this
by parsing how a dev version is installed and either copying it from the
local repo (if it's an editable install) or cloning that sha1 from
github if it's a random checkout installed normally.

My personal opinion is that we we should restrict the meta-repo's docs
to only be responsible for building a combined view from releases.
Building and reviewing unreleased versions of the docs end up becoming
the domain of each individual element. This both simplifies the building
story but also reduces the complexity for translations. It becomes a
much more static target for strings to translate. The per repo docs are
mostly self contained and the only reason we need to copy them into the
meta-repo is for a uniform ToC and navigation side bar. In my ideal
workflow we'd just individually generate each repo's docs and upload the
static content to a known place on qiskit.org/documentation. But that
would take more rework of how the meta-docs are structure, and how we
link things together.

* Only support released workflow

This commit switches the docs rst pull from supporting arbitrary git
versions and local install scenarios to just be the meta-package
released element versions. We should rely on each individual element to
test docs builds prior to release so that we know the combined output
will build sucessfully.

* Add support for building docs from master with DOCS_FROM_MASTER

This commit adds a new option to building the docs from distributed
elements. If you specify DOCS_FROM_MASTER=1 as an env variable, for
example when running `DOCS_FROM_MASTER=1 tox -edocs`, it will clone the
individual repos at master and use the apidocs rst from each element to
build the docs. In this mode if there is an existing docs/apidoc tree
(like there currently is) the docs build will preserve that but not use
it during the build process, instead deferring to the master version of
the individual elements docs.

* Install qiskit elements from master when needed

If DOCS_FROM_MASTER is set the rst harvesting extension would pull the
code from master but this could be out of sync with what's in the
release packages. This causes an issue at build time if we have autodocs
that reference modules that have been moved or don't exist in a release.
This is especially an issue for the case where:
DOCS_FROM_MASTER=1 tox -edocs is used because tox will build a venv from
the releases of the elements and not master. This commit works around
this issue by running pip and installing the elements from master when
DOCS_FROM_MASTER is set.

* remove old apidocs

* Update for aer doc rename

Corresponds to Aer PR Qiskit#443

* fix copying bug

* top-level api docs

* Fix docs from master build

Passing all the requirements to a single pip command was error prone and
unreliable. To address this a separate pip command is used for
installing each element from github. This also adjusts the order the
elements are installed to ensure we upgrade terra first since it is the
dependency of all the other elements.

* Remove apidoc and move ignis to apidoc_legacy

* Remove duplicate functions from rebase issue

* Remove ignis from copy from source list

* Update index.rst

* Explicitly call load_api_sources()

Having load_api_sources() run as part of the sphinx app api state
machine in the build-inited phase was too late. This was preventing the
stubs from being generated as part of a normal build causing all the
docs builds to fail for everything. This commit fixes that by explicitly
calling the function as the first step in the setup() function for the
sphinx app. This means that copying the sources over from the elements
is always the first thing we do as part of a sphinx build now.

* Add gitignore

* gitignore

* Fix small typo in apidoc gitignore

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: SooluThomas <soolu.elto@gmail.com>
  • Loading branch information
3 people authored Feb 12, 2020
1 parent 568c4ed commit 337fc9e
Show file tree
Hide file tree
Showing 76 changed files with 100 additions and 998 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ instance/

# Sphinx documentation
docs/_build/
docs/**/autodoc
docs/api
docs/stubs
stubs/

# PyBuilder
target/
Expand Down Expand Up @@ -135,5 +136,5 @@ src/qasm-simulator-cpp/test/qubit_vector_tests
html/
qiskit-terra/

# docs api
docs/api
# element api docs
docs/apidoc
13 changes: 0 additions & 13 deletions docs/apidoc/aqua/algorithms/adaptive/adaptive.rst

This file was deleted.

24 changes: 0 additions & 24 deletions docs/apidoc/aqua/algorithms/algorithms.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/algorithms/classical/classical.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/algorithms/many_sample/many_sample.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/algorithms/single_sample/single_sample.rst

This file was deleted.

28 changes: 0 additions & 28 deletions docs/apidoc/aqua/aqua.rst

This file was deleted.

21 changes: 0 additions & 21 deletions docs/apidoc/aqua/circuits/circuits.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/circuits/gates/gates.rst

This file was deleted.

33 changes: 0 additions & 33 deletions docs/apidoc/aqua/components/components.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/eigs/eigs.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/feaure_maps/feature_maps.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/initial_states/initial_states.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/iqfts/iqfts.rst

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/neural_networks/neural_networks.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/optimizers/optimizers.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/oracles/oracles.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/qfts/qfts.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/components/reciprocals/reciprocals.rst

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions docs/apidoc/aqua/input/input.rst

This file was deleted.

Loading

0 comments on commit 337fc9e

Please sign in to comment.