From 2ccb65caeb9e56e9da4ccf28c40ffad12d2d95c4 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Tue, 9 Mar 2021 13:11:10 -0600 Subject: [PATCH 1/3] copy over docs ci command from rest of ets --- ci/edmtool.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/ci/edmtool.py b/ci/edmtool.py index 4e3ed4d4c..59af6b6c5 100644 --- a/ci/edmtool.py +++ b/ci/edmtool.py @@ -108,6 +108,15 @@ 'null': set() } +doc_dependencies = { + "sphinx", + "enthought_sphinx_theme" +} + +doc_ignore = { + "*/tests", +} + environment_vars = { 'pyside2': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyside2'}, 'pyqt': {'ETS_TOOLKIT': 'qt4', 'QT_API': 'pyqt'}, @@ -267,6 +276,61 @@ def update(runtime, toolkit, environment): click.echo('Done update') +@cli.command() +@click.option("--runtime", default="3.6", help="Python version to use") +@click.option("--toolkit", default="null", help="Toolkit and API to use") +@click.option("--environment", default=None, help="EDM environment to use") +def docs(runtime, toolkit, environment): + """ Autogenerate documentation + + """ + parameters = get_parameters(runtime, toolkit, environment) + packages = " ".join(doc_dependencies) + ignore = " ".join(doc_ignore) + commands = [ + "edm install -y -e {environment} " + packages, + ] + click.echo( + "Installing documentation tools in '{environment}'".format( + **parameters + ) + ) + execute(commands, parameters) + click.echo("Done installing documentation tools") + + click.echo( + "Regenerating API docs in '{environment}'".format(**parameters) + ) + api_path = os.path.join("docs", "source", "api") + if os.path.exists(api_path): + rmtree(api_path) + os.makedirs(api_path) + commands = [ + "edm run -e {environment} -- sphinx-apidoc -e -M --no-toc -o " + + api_path + + " chaco " + + ignore + ] + execute(commands, parameters) + click.echo("Done regenerating API docs") + + os.chdir("docs") + command = ( + "edm run -e {environment} -- sphinx-build -b html " + "-d build/doctrees " + "source " + "build/html" + ) + click.echo( + "Building documentation in '{environment}'".format(**parameters) + ) + try: + execute([command], parameters) + finally: + os.chdir("..") + click.echo("Done building documentation") + + @cli.command() def test_all(): """ Run test_clean across all supported environment combinations. From 0adfc0631913a8f87b0a8735ee5522598a7249da Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 10 Mar 2021 09:26:48 -0600 Subject: [PATCH 2/3] update gitignore --- .gitignore | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6d7e662ad..818986277 100644 --- a/.gitignore +++ b/.gitignore @@ -6,11 +6,22 @@ *~ .DS_Store +# Docs files to ignore +/docs/source/api/*.rst +!docs/source/api/axis.rst +!docs/source/api/containers.rst +!docs/source/api/data_ranges.rst +!docs/source/api/data_sources.rst +!docs/source/api/mappers.rst +!docs/source/api/plot_factories.rst +!docs/source/api/renderers.rst +!docs/source/api/visual_components +docs/build/ + # ignore the build directories *.egg-info/ build/ dist/ -docs/build/ # Auto-generated by setup.py _version.py From 9e9b8bff692a7e0a0fcf2d5c681e3ca84adce478 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Wed, 10 Mar 2021 09:28:08 -0600 Subject: [PATCH 3/3] dont delete and remake api_path as we already have files there --- ci/edmtool.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/edmtool.py b/ci/edmtool.py index 59af6b6c5..272c5ef37 100644 --- a/ci/edmtool.py +++ b/ci/edmtool.py @@ -302,9 +302,6 @@ def docs(runtime, toolkit, environment): "Regenerating API docs in '{environment}'".format(**parameters) ) api_path = os.path.join("docs", "source", "api") - if os.path.exists(api_path): - rmtree(api_path) - os.makedirs(api_path) commands = [ "edm run -e {environment} -- sphinx-apidoc -e -M --no-toc -o " + api_path