Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci command for building documentation #566

Merged
merged 3 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 61 additions & 0 deletions ci/edmtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down Expand Up @@ -267,6 +276,58 @@ 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")
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.
Expand Down