Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build docs from individual source elements (Qiskit#551)
* 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