Skip to content

Commit

Permalink
Setup doc pipeline (#39)
Browse files Browse the repository at this point in the history
* add initial framework for documentation build

* add readthedocs configuration

* fix linting issues

* update pyproject.toml
  • Loading branch information
priyamsahoo authored Nov 17, 2023
1 parent b603773 commit b354c98
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ argvalues
astimezone
autorefs
basesystem
BUILDDIR
caplog
cliconf # Ansible network cli abstraction plugin
codeclimate
Expand Down Expand Up @@ -100,6 +101,7 @@ premanent
pullable
pymdown
pymdownx
quickstart
redhatinsights
Regset
representer
Expand All @@ -122,6 +124,9 @@ SIGTERM
SKEL
smartquotes
somevalue
SOURCEDIR
SPHINXBUILD
SPHINXOPTS
statemachine
stripspaces
subaction
Expand All @@ -141,6 +146,7 @@ testns
testorg
testpaths
tmplt
toctree
topbar
topdown
Towncrier # Changelog generator
Expand Down
3 changes: 3 additions & 0 deletions .config/requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx
myst-parser
sphinx-ansible-theme
23 changes: 23 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

python:
install:
- method: pip
path: .

- requirements: .config/requirements-doc.txt
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1 change: 1 addition & 0 deletions docs/source/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# noqa: D104
51 changes: 51 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Configuration file for the Sphinx documentation builder. # noqa: D100
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os # noqa: ERA001
# import sys # noqa: ERA001
# sys.path.insert(0, os.path.abspath('.')) # noqa: ERA001


# -- Project information -----------------------------------------------------

PROJECT = "Ansible Creator"
COPYRIGHT = "2023, Ansible"
AUTHOR = "Ansible"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["myst_parser", "sphinx.ext.duration", "sphinx_ansible_theme"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_ansible_theme" # pylint: disable=invalid-name

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
13 changes: 13 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
% Ansible Creator documentation master file, created by
% sphinx-quickstart on Fri Nov 17 12:47:50 2023.
% You can adapt this file completely to your liking, but it should at least
% contain the root `toctree` directive.

```{include} ../../README.md
:relative-images:
```

```{toctree}
:caption: 'Contents:'
:maxdepth: 2
```
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ convention = "pep257"

[tool.setuptools.dynamic]
dependencies = {file = "requirements.txt"}
optional-dependencies.doc = {file = [".config/requirements-doc.txt"]}
optional-dependencies.test = {file = [".config/requirements-test.txt"]}

[tool.setuptools_scm]
Expand Down

0 comments on commit b354c98

Please sign in to comment.