diff --git a/.config/docs-requirements.txt b/.config/docs-requirements.txt new file mode 100644 index 0000000..77dfef0 --- /dev/null +++ b/.config/docs-requirements.txt @@ -0,0 +1,2 @@ +mkdocs-ansible[lock]>=0.2.0 +pipdeptree>=2.7.1 diff --git a/.config/requirements-doc.txt b/.config/requirements-doc.txt deleted file mode 100644 index 6f43f93..0000000 --- a/.config/requirements-doc.txt +++ /dev/null @@ -1,3 +0,0 @@ -sphinx -myst-parser -sphinx-ansible-theme diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 19433af..c385fe1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @NilashishC +* @NilashishC @ansible/devtools diff --git a/.gitignore b/.gitignore index 08eb588..127b321 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ build/ *.tox/ __pycache__/ +.cache +_readthedocs diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index 1623a37..0000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# .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 diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..6592c91 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,25 @@ +--- +version: 2 + +mkdocs: + fail_on_warning: true + configuration: mkdocs.yml + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + commands: + - pip install --user tox + - python3 -m tox -e docs +python: + install: + - method: pip + path: tox + - method: pip + path: . + extra_requirements: + - docs +submodules: + include: all + recursive: true diff --git a/.vscode/settings.json b/.vscode/settings.json index bb4d107..5f1fdb1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "[python]": { "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll": true + "source.fixAll": "explicit" }, "editor.defaultFormatter": "ms-python.black-formatter" }, diff --git a/docs/.keep b/docs/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index d0c3cbf..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# 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) diff --git a/docs/source/collection_creation.md b/docs/collection_creation.md similarity index 100% rename from docs/source/collection_creation.md rename to docs/collection_creation.md diff --git a/docs/source/developer_contribution.md b/docs/contributing.md similarity index 100% rename from docs/source/developer_contribution.md rename to docs/contributing.md diff --git a/docs/source/index.md b/docs/index.md similarity index 66% rename from docs/source/index.md rename to docs/index.md index 71ac6df..d7b19e9 100644 --- a/docs/source/index.md +++ b/docs/index.md @@ -1,7 +1,8 @@ -% 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. +--- +hide: + - navigation + - toc +--- # Welcome to Ansible-Creator Documentation @@ -9,23 +10,13 @@ The `ansible-creator` is a Command-Line Interface (CLI) tool designed for effort This documentation serves as a detailed guide for using ansible-creator, emphasizing the 'init' functionality for initializing Ansible Collections. Stay tuned for updates on the 'create' branch that will bring new features to enhance your Ansible workflow. -```{toctree} -:caption: 'Contents:' -:maxdepth: 2 - -self -installation_usage -collection_creation -developer_contribution -``` - ## Upcoming Features The `create` command is currently under development which will allow you scaffold ansible plugins of your choice. -```{Tip} -Switch to the create [create branch](https://github.com/ansible/ansible-creator/tree/create) of the project to try it out! -``` +!!! notice + + Switch to the create [create branch](https://github.com/ansible/ansible-creator/tree/create) of the project to try it out! ## Licensing diff --git a/docs/source/installation_usage.md b/docs/installing.md similarity index 95% rename from docs/source/installation_usage.md rename to docs/installing.md index a38ed53..8ffa2f8 100644 --- a/docs/source/installation_usage.md +++ b/docs/installing.md @@ -14,9 +14,7 @@ $ pip install ansible-creator The Command-Line Interface (CLI) for ansible-creator provides a straightforward and efficient way to interact with the tool. Users can initiate actions, such as initializing Ansible Collections, through concise commands. The CLI is designed for simplicity, allowing users to execute operations with ease and without the need for an extensive understanding of the tool's intricacies. It serves as a flexible and powerful option for users who prefer command-line workflows, enabling them to integrate ansible-creator seamlessly into their development processes. -```{seealso} -Command line not your preferred method? You can also leverage the GUI interface within VS Code's Ansible extension that offers a more visually intuitive experience of ansible-creator. See here: {doc}`collection_creation` -``` +If command line is not your preferred method, you can also leverage the GUI interface within VS Code's Ansible extension that offers a more visually intuitive experience of ansible-creator. See [here](collection_creation.md). ### General Usage diff --git a/docs/source/media/log-to-file.gif b/docs/media/log-to-file.gif similarity index 100% rename from docs/source/media/log-to-file.gif rename to docs/media/log-to-file.gif diff --git a/docs/source/media/open-collection.gif b/docs/media/open-collection.gif similarity index 100% rename from docs/source/media/open-collection.gif rename to docs/media/open-collection.gif diff --git a/docs/source/media/open-folder.gif b/docs/media/open-folder.gif similarity index 100% rename from docs/source/media/open-folder.gif rename to docs/media/open-folder.gif diff --git a/docs/source/media/open-log-file.gif b/docs/media/open-log-file.gif similarity index 100% rename from docs/source/media/open-log-file.gif rename to docs/media/open-log-file.gif diff --git a/docs/source/media/refresh.gif b/docs/media/refresh.gif similarity index 100% rename from docs/source/media/refresh.gif rename to docs/media/refresh.gif diff --git a/docs/source/__init__.py b/docs/source/__init__.py deleted file mode 100644 index 6e03199..0000000 --- a/docs/source/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# noqa: D104 diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index e531408..0000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,74 +0,0 @@ -"""The ansible-creator Documentation builder source.""" - -# pylint: disable=redefined-builtin,invalid-name - -# Configuration file for the Sphinx documentation builder. -# -# 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" # noqa: A001 # pylint: disable=redefined-builtin -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", -] - -myst_enable_extensions = [ - "attrs_inline", -] - -autosectionlabel_prefix_document = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# 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 -html_title = "Ansible Creator Documentation" - -# 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"] - -html_theme_options = { - "display_version": False, - "titles_only": False, - "documentation_home_url": "https://ansible-creator.readthedocs.io/en/latest/", -} diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..3f0e0d5 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,117 @@ +--- +# cspell:ignore autohide, autofix +site_name: Ansible Creator Documentation +site_url: https://ansible.readthedocs.io/projects/creator/ +repo_url: https://github.com/ansible/ansible-creator +edit_uri: blob/main/docs/ +copyright: Copyright © 2023 Red Hat, Inc. +docs_dir: docs +strict: true + +# extra_css: +# - stylesheets/extra.css + +theme: + name: ansible + features: + - announce.dismiss + - content.action.edit + - content.action.view + - content.code.annotate + - content.code.copy + - content.tabs.link + - content.tooltips + - header.autohide + - navigation.expand + - navigation.footer + - navigation.indexes + - navigation.instant + - navigation.path + - navigation.prune + - navigation.sections + - navigation.tabs + - navigation.tabs.sticky + - navigation.top + - navigation.tracking + - search.highlight + - search.share + - search.suggest + - toc.integrate +extra: + generator: false + social: + - icon: fontawesome/brands/python + link: https://pypi.org/project/ansible-creator/ + name: PyPI + - icon: fontawesome/solid/scroll + link: https://github.com/ansible/ansible-creator/releases + name: Releases + - icon: simple/mastodon + link: https://fosstodon.org/@ansible + name: Mastodon + - icon: fontawesome/brands/twitter + link: https://twitter.com/ansible + name: Twitter + - icon: simple/matrix + link: https://matrix.to/#/#devtools:ansible.com + name: Matrix + - icon: fontawesome/solid/comments + link: https://github.com/ansible/ansible-creator/discussions + name: Discussions + - icon: fontawesome/brands/github-alt + link: https://github.com/ansible/ansible-creator + name: GitHub + +nav: + - Home: + - home: index.md + - Setup: + - installing.md + - collection_creation.md + - Contributing: contributing.md + +exclude_docs: | + _autofix_rules.md + +plugins: + - autorefs + - markdown-exec + - material/search: + separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])' + - material/social + - material/tags + # https://github.com/manuzhang/mkdocs-htmlproofer-plugin + # - htmlproofer + +markdown_extensions: + - markdown_include.include: + base_path: docs + - admonition + - def_list + - footnotes + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.superfences + - pymdownx.magiclink: + repo_url_shortener: true + repo_url_shorthand: true + social_url_shorthand: true + social_url_shortener: true + user: facelessuser + repo: pymdown-extensions + normalize_issue_symbols: true + - pymdownx.tabbed: + alternate_style: true + - toc: + toc_depth: 2 + permalink: true + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - name: python + class: python + validator: !!python/name:markdown_exec.validator + format: !!python/name:markdown_exec.formatter diff --git a/pyproject.toml b/pyproject.toml index 9ad9ed6..4481b7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,7 +113,7 @@ convention = "pep257" [tool.setuptools.dynamic] dependencies = {file = "requirements.txt"} -optional-dependencies.doc = {file = [".config/requirements-doc.txt"]} +optional-dependencies.docs = {file = [".config/docs-requirements.txt"]} optional-dependencies.test = {file = [".config/requirements-test.txt"]} [tool.setuptools_scm] diff --git a/tox.ini b/tox.ini index 886ca28..e6fe567 100644 --- a/tox.ini +++ b/tox.ini @@ -1,17 +1,18 @@ [tox] requires = - tox>=4.2 + tox>=4.6.3 env_list = py lint -no_package = true -skip_missing_interpreters = true -work_dir = {env:TOX_WORK_DIR:.tox} + docs + +[testenv] +package = editable [testenv:py] description = Run pytest under {basepython} ({envpython}) -deps = - -e .[test] +extras = + test commands = python --version pip list @@ -24,3 +25,12 @@ deps = pre-commit commands = pre-commit run --show-diff-on-failure --all-files + +[testenv:docs] +description = Builds docs +package = editable +skip_install = false +extras = + docs +commands = + mkdocs {posargs:build --strict --site-dir=_readthedocs/html/}