diff --git a/.config/dictionary.txt b/.config/dictionary.txt new file mode 100644 index 0000000..8f62476 --- /dev/null +++ b/.config/dictionary.txt @@ -0,0 +1,48 @@ +PYTHONBREAKPOINT +PYTHONIOENCODING +PYTHONPYCACHEPREFIX +REQPASS +Roboto +TOXENV +ansiblelint +arithmatex +autofix +autohide +autoupdate +betterem +cairosvg +clib +codecov +codenotify +codespell +commitlint +devel +dists +docstrings +fontawesome +htmlproofer +inlinehilite +linenums +magiclink +minversion +mkdocs +mkdocstrings +mypy +notest +outdir +pipdeptree +pycontribs +pylint +pymdown +pymdownx +pypa +pyproject +pyupgrade +ruamel +setuptools +smartsymbols +sourcegraph +squidfunk +superfences +tasklist +tomli diff --git a/.config/requirements-test.txt b/.config/requirements-test.txt new file mode 100644 index 0000000..e69de29 diff --git a/.config/requirements.in b/.config/requirements.in new file mode 100644 index 0000000..2ecf48e --- /dev/null +++ b/.config/requirements.in @@ -0,0 +1,13 @@ +cairosvg>=2.6.0 +markdown-exec>=1.3.0 +mkdocs-gen-files>=0.4.0 +mkdocs-htmlproofer-plugin>=0.10.2 +mkdocs-material-extensions>=1.1.1 +mkdocs-material>=9.0.13 +mkdocs-minify-plugin +mkdocs>=1.4.2 +mkdocstrings-python>=0.8.3 +mkdocstrings>=0.20.0 +pillow>=9.4.0 +pipdeptree>=2.4.0 +pymdown-extensions>=9.9.2 diff --git a/.config/requirements.txt b/.config/requirements.txt new file mode 100644 index 0000000..88b22af --- /dev/null +++ b/.config/requirements.txt @@ -0,0 +1,55 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile --extra=docs --extra=test --no-annotate --output-file=.config/requirements.txt --resolver=backtracking --strip-extras --unsafe-package=ruamel-yaml-clib pyproject.toml +# +beautifulsoup4==4.11.2 +cairocffi==1.4.0 +cairosvg==2.6.0 +certifi==2022.12.7 +cffi==1.15.1 +charset-normalizer==3.1.0 +click==8.1.3 +colorama==0.4.6 +csscompressor==0.9.5 +cssselect2==0.7.0 +defusedxml==0.7.1 +ghp-import==2.1.0 +griffe==0.25.5 +htmlmin==0.1.12 +idna==3.4 +importlib-metadata==6.0.0 +jinja2==3.1.2 +jsmin==3.0.1 +markdown==3.3.7 +markdown-exec==1.3.0 +markupsafe==2.1.2 +mergedeep==1.3.4 +mkdocs==1.4.2 +mkdocs-autorefs==0.4.1 +mkdocs-gen-files==0.4.0 +mkdocs-htmlproofer-plugin==0.10.3 +mkdocs-material==9.1.1 +mkdocs-material-extensions==1.1.1 +mkdocs-minify-plugin==0.6.2 +mkdocstrings==0.20.0 +mkdocstrings-python==0.8.3 +packaging==23.0 +pillow==9.4.0 +pipdeptree==2.5.2 +pycparser==2.21 +pygments==2.14.0 +pymdown-extensions==9.10 +python-dateutil==2.8.2 +pyyaml==6.0 +pyyaml-env-tag==0.1 +regex==2022.10.31 +requests==2.28.2 +six==1.16.0 +soupsieve==2.4 +tinycss2==1.2.1 +urllib3==1.26.14 +watchdog==2.3.1 +webencodings==0.5.1 +zipp==3.15.0 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..d1f5d6b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @ansible/devtools diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4227e7f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +--- +version: 2 +updates: + - package-ecosystem: pip + directory: /.config/ + schedule: + day: sunday + interval: weekly + labels: + - dependabot + - skip-changelog + versioning-strategy: lockfile-only + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: daily + labels: + - dependabot + - skip-changelog diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..11fa614 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,3 @@ +--- +# see https://github.com/ansible/devtools +_extends: ansible/devtools diff --git a/.github/workflows/ack.yml b/.github/workflows/ack.yml new file mode 100644 index 0000000..5e7b9f5 --- /dev/null +++ b/.github/workflows/ack.yml @@ -0,0 +1,10 @@ +--- +# See https://github.com/ansible/devtools/blob/main/.github/workflows/ack.yml +name: ack +on: + pull_request_target: + types: [opened, labeled, unlabeled, synchronize] + +jobs: + ack: + uses: ansible/devtools/.github/workflows/ack.yml@main diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..1a01af8 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,13 @@ +--- +# See https://github.com/ansible/devtools/blob/main/.github/workflows/push.yml +name: push +on: + push: + branches: + - main + - "releases/**" + - "stable/**" + +jobs: + ack: + uses: ansible/devtools/.github/workflows/push.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..84ef052 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,43 @@ +--- +# cspell:ignore mislav +name: release + +on: + release: + types: [published] + +jobs: + pypi: + name: Publish to PyPI registry + environment: release + runs-on: ubuntu-22.04 + + env: + FORCE_COLOR: 1 + PY_COLORS: 1 + TOXENV: pkg + + steps: + - name: Switch to using Python 3.9 by default + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install tox + run: python3 -m pip install --user "tox>=4.0.0" + + - name: Check out src from Git + uses: actions/checkout@v3 + with: + fetch-depth: 0 # needed by setuptools-scm + submodules: true + + - name: Build dists + run: python -m tox + + - name: Publish to pypi.org + if: >- # "create" workflows run separately from "push" & "pull_request" + github.event_name == 'release' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml new file mode 100644 index 0000000..5ff8050 --- /dev/null +++ b/.github/workflows/tox.yml @@ -0,0 +1,151 @@ +--- +name: tox + +on: + push: # only publishes pushes to the main branch to TestPyPI + branches: # any integration branch but not tag + - "main" + pull_request: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +env: + FORCE_COLOR: 1 + PY_COLORS: 1 + +jobs: + pre: + name: pre + runs-on: ubuntu-22.04 + outputs: + matrix: ${{ steps.generate_matrix.outputs.matrix }} + steps: + - name: Determine matrix + id: generate_matrix + uses: coactions/dynamic-matrix@v1 + with: + min_python: "3.9" + max_python: "3.11" + other_names: | + lint + docs + # platforms: linux,macos + + build: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os || 'ubuntu-22.04' }} + needs: pre + defaults: + run: + shell: ${{ matrix.shell || 'bash'}} + strategy: + fail-fast: false + matrix: ${{ fromJson(needs.pre.outputs.matrix) }} + env: + PYTEST_REQPASS: 0 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # needed by setuptools-scm + submodules: true + + - name: Set pre-commit cache + uses: actions/cache@v3 + if: ${{ matrix.passed_name == 'lint' }} + with: + path: | + ~/.cache/pre-commit + key: pre-commit-${{ matrix.name || matrix.passed_name }}-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Set galaxy cache + uses: actions/cache@v3 + if: ${{ startsWith(matrix.passed_name, 'py') }} + with: + path: | + examples/playbooks/collections/*.tar.gz + examples/playbooks/collections/ansible_collections + key: galaxy-${{ hashFiles('examples/playbooks/collections/requirements.yml') }} + + - name: Set up Python ${{ matrix.python_version || '3.9' }} + uses: actions/setup-python@v4 + with: + cache: pip + python-version: ${{ matrix.python_version || '3.9' }} + + - name: Install tox + run: | + python3 -m pip install --upgrade pip + python3 -m pip install --upgrade "tox>=4.0.0" + + - name: Log installed dists + run: python3 -m pip freeze --all + + - name: Initialize tox envs ${{ matrix.passed_name }} + run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.passed_name }} + timeout-minutes: 5 # average is under 1, but macos can be over 3 + + # sequential run improves browsing experience (almost no speed impact) + - name: tox -e ${{ matrix.passed_name }} + run: python3 -m tox -e ${{ matrix.passed_name }} + + - name: Combine coverage data + if: ${{ startsWith(matrix.passed_name, 'py') }} + # produce a single .coverage file at repo root + run: tox -e coverage + + - name: Upload coverage data + if: ${{ startsWith(matrix.passed_name, 'py') }} + uses: codecov/codecov-action@v3 + with: + name: ${{ matrix.passed_name }} + fail_ci_if_error: false # see https://github.com/codecov/codecov-action/issues/598 + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true # optional (default = false) + + - name: Archive logs + uses: actions/upload-artifact@v3 + with: + name: logs.zip + path: .tox/**/log/ + # https://github.com/actions/upload-artifact/issues/123 + continue-on-error: true + + - name: Report failure if git reports dirty status + run: | + if [[ -n $(git status -s) ]]; then + # shellcheck disable=SC2016 + echo -n '::error file=git-status::' + printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY" + exit 99 + fi + # https://github.com/actions/toolkit/issues/193 + + check: # This job does nothing and is only used for the branch protection + if: always() + permissions: + pull-requests: write # allow codenotify to comment on pull-request + + needs: + - build + + runs-on: ubuntu-latest + + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} + + - name: Check out src from Git + uses: actions/checkout@v3 + + - name: Notify repository owners about lint change affecting them + uses: sourcegraph/codenotify@v0.6.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # https://github.com/sourcegraph/codenotify/issues/19 + continue-on-error: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..856a308 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +**/*.egg-info +.DS_Store +.tox +__pycache__ +build/ +dist +site +src/mkdocs_ansible/_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..35ca062 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,152 @@ +--- +ci: + # format compatible with commitlint + autoupdate_commit_msg: "chore: pre-commit autoupdate" + autoupdate_schedule: monthly + autofix_commit_msg: | + chore: auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + skip: + # https://github.com/pre-commit-ci/issues/issues/55 + - pip-compile + - schemas + submodules: true +exclude: > + (?x)^( + src/mkdocs_ansible/_version.py + )$ +repos: + - repo: meta + hooks: + - id: check-useless-excludes + - repo: https://github.com/pre-commit/mirrors-prettier + # keep it before yamllint + rev: v3.0.0-alpha.6 + hooks: + - id: prettier + always_run: true + additional_dependencies: + - prettier + - prettier-plugin-toml + - prettier-plugin-sort-json + - repo: https://github.com/streetsidesoftware/cspell-cli + rev: v6.28.0 + hooks: + - id: cspell + # entry: codespell --relative + args: [--relative, --no-progress, --no-summary] + name: Spell check with cspell + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.21.0 + hooks: + - id: check-github-workflows + - repo: https://github.com/pre-commit/pre-commit-hooks.git + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: mixed-line-ending + - id: fix-byte-order-marker + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: debug-statements + language_version: python3 + - repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell + exclude: > + (?x)^( + .config/dictionary.txt + )$ + additional_dependencies: + - tomli + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.29.0 + hooks: + - id: yamllint + files: \.(yaml|yml)$ + types: [file, yaml] + entry: yamllint --strict + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + args: + # https://github.com/pre-commit/mirrors-isort/issues/9#issuecomment-624404082 + - --filter-files + - repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + language_version: python3 + - repo: https://github.com/pycqa/flake8.git + rev: 6.0.0 + hooks: + - id: flake8 + language_version: python3 + additional_dependencies: + - flake8-2020>=1.6.0 + # - flake8-black>=0.1.1 + - flake8-docstrings>=1.5.0 + - flake8-print>=5.0 + - flake8-pytest-style>=1.2.2 + - flake8-future-annotations>=0.0.3 + - repo: https://github.com/asottile/pyupgrade + # keep it after flake8 + rev: v3.3.1 + hooks: + - id: pyupgrade + args: ["--py39-plus"] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.0.1 + hooks: + - id: mypy + # empty args needed in order to match mypy cli behavior + args: [--strict] + additional_dependencies: [] + - repo: https://github.com/pycqa/pylint + rev: v2.16.4 + hooks: + - id: pylint + args: + - --output-format=colorized + additional_dependencies: [] + - repo: https://github.com/jazzband/pip-tools + rev: 6.12.3 + hooks: + - id: pip-compile + name: lock + alias: lock + always_run: true + entry: pip-compile --upgrade --resolver=backtracking -q --no-annotate --output-file=.config/requirements-lock.txt pyproject.toml --strip-extras --unsafe-package ruamel-yaml-clib + files: ^.config\/requirements.*$ + language: python + language_version: "3.9" # minimal we support officially + pass_filenames: false + stages: [manual] + additional_dependencies: + - pip>=22.3.1 + - id: pip-compile + name: deps + alias: deps + always_run: true + entry: pip-compile --resolver=backtracking -q --no-annotate --output-file=.config/requirements.txt pyproject.toml --extra docs --extra test --strip-extras --unsafe-package ruamel-yaml-clib + files: ^.config\/requirements.*$ + language: python + language_version: "3.9" # minimal we support officially + pass_filenames: false + additional_dependencies: + - pip>=22.3.1 + - id: pip-compile + entry: pip-compile --resolver=backtracking -q --no-annotate --output-file=.config/requirements.txt pyproject.toml --extra docs --extra test --strip-extras --unsafe-package ruamel-yaml-clib --upgrade + language: python + always_run: true + pass_filenames: false + files: ^.config\/requirements.*$ + alias: up + stages: [manual] + language_version: "3.9" # minimal we support officially + additional_dependencies: + - pip>=22.3.1 diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..8262c4e --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,26 @@ +--- +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 -- --strict --site-dir=_readthedocs/html/ +python: + system_packages: false + install: + - method: pip + path: tox + - method: pip + path: . + extra_requirements: + - docs +submodules: + include: all + recursive: true diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..2772c3c --- /dev/null +++ b/.yamllint @@ -0,0 +1,15 @@ +--- +rules: + comments: + # prettier compatibility + min-spaces-from-content: 1 + document-start: + present: true + indentation: + level: error + indent-sequences: consistent + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true +ignore: | + .tox diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 0000000..fce0237 --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,22 @@ +--- +dictionaryDefinitions: + - name: words + path: .config/dictionary.txt + addWords: true +dictionaries: + # Use `cspell-cli trace word` to check where a work is defined + - en_US + - bash + - words + - python +ignorePaths: + - cspell.config.yaml + # The requirements file + - .config/requirements.txt + - docs/requirements.txt + - docs/requirements.in + # Test fixtures generated from outside + - test/**/*.result + - src/ansiblelint/schemas/*.json + # Other + - "*.svg" diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..03addb2 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,13 @@ +# mkdocs-ansible theme + +This [mkdocs](https://www.mkdocs.org/) theme is based on [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) and aims to provide a consistent +look and feel for any project related to [Ansible](https://docs.ansible.com/) ecosystem. + +Some of the projects that use this theme are: + +- [ansible-compat](https://ansible-compat.readthedocs.io/) +- [ansible-devtools](https://ansible-devtools.readthedocs.io/) +- [ansible-language-server](https://ansible-language-server.readthedocs.io/) +- [ansible-lint](https://ansible-lint.readthedocs.io/) +- [ansible-navigator](https://ansible-navigator.readthedocs.io/en/latest/) +- [molecule](https://molecule.readthedocs.io/) diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..9099dbf --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,101 @@ +--- +site_name: Ansible MkDocs Theme +site_url: https://mkdocs-ansible.readthedocs.io/ +site_author: Ansible +site_description: >- + This mkdocs theme is based on mkdocs-material and aims to provide a + consistent look and feel for any project related to Ansible. +# Repository +repo_name: ansible/mkdocs-ansible +repo_url: https://github.com/ansible/mkdocs-ansible +edit_uri: blob/main/docs/ + +# Copyright +copyright: Copyright 2023 Red Hat Inc + +# Configuration +theme: + name: ansible + # custom_dir: src/mkdocs_ansible/.overrides + 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.prune + - navigation.sections + # - navigation.tabs + # - navigation.tabs.sticky + - navigation.top + - navigation.tracking + - search.highlight + - search.share + - search.suggest + - toc.follow + # - toc.integrate + # favicon: assets/favicon.png + icon: + logo: logo + +# Plugins +plugins: + - search: + separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])' + - minify: + minify_html: true + +# Customization +extra: + # analytics: + # provider: google + # property: !ENV GOOGLE_ANALYTICS_KEY + social: + - icon: fontawesome/brands/github + link: https://github.com/ansible/mkdocs-ansible + - icon: fontawesome/brands/python + link: https://pypi.org/project/mkdocs-ansible/ + +# Extensions +markdown_extensions: + - abbr + - admonition + - attr_list + - def_list + - footnotes + - md_in_html + - toc: + permalink: true + - pymdownx.arithmatex: + generic: true + - pymdownx.betterem: + smart_enable: all + - pymdownx.caret + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.magiclink: + repo_url_shorthand: true + user: squidfunk + repo: mkdocs-material + - pymdownx.mark + - pymdownx.smartsymbols + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.tabbed: + alternate_style: true + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.tilde diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..51d7f3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = [ + "setuptools >= 63.0.0", # required by pyproject+setuptools_scm integration + "setuptools_scm[toml] >= 7.0.5", # required for "no-local-version" scheme + +] +build-backend = "setuptools.build_meta" + +[project] +requires-python = ">=3.9" +dynamic = ["version", "dependencies", "optional-dependencies"] +name = "mkdocs-ansible" +description = "Ansible MkDocs Theme based on mkdocs-material" +readme = "docs/README.md" +authors = [{ "name" = "Ansible by Red Hat", "email" = "info@ansible.com" }] +maintainers = [{ "name" = "Ansible by Red Hat", "email" = "info@ansible.com" }] +license = { text = "MIT" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "License :: OSI Approved :: MIT License", + "Programming Language :: JavaScript", + "Programming Language :: Python", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", + "Topic :: Text Processing :: Markup :: HTML", +] +keywords = ["ansible", "mkdocs", "theme"] + +[project.urls] +homepage = "https://github.com/ansible/mkdocs-ansible" +documentation = "https://mkdocs-ansible.readthedocs.io/" +repository = "https://github.com/ansible/mkdocs-ansible" +changelog = "https://github.com/ansible/mkdocs-ansible/releases" + +[project.entry-points."mkdocs.themes"] +ansible = "mkdocs_ansible" + +[[tool.mypy.overrides]] +module = ["mkdocs_ansible._version"] + +[tool.pylint.MASTER] +ignore-paths = "^src/.*/(_version|_vendor).*$" + +[tool.setuptools.dynamic] +optional-dependencies.test = { file = [".config/requirements-test.txt"] } +optional-dependencies.lock = { file = [".config/requirements-lock.txt"] } +dependencies = { file = [".config/requirements.in"] } + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools_scm] +local_scheme = "no-local-version" +write_to = "src/mkdocs_ansible/_version.py" diff --git a/src/mkdocs_ansible/.icons/logo.svg b/src/mkdocs_ansible/.icons/logo.svg new file mode 100644 index 0000000..ffe210b --- /dev/null +++ b/src/mkdocs_ansible/.icons/logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/mkdocs_ansible/.overrides/.gitignore b/src/mkdocs_ansible/.overrides/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/src/mkdocs_ansible/__init__.py b/src/mkdocs_ansible/__init__.py new file mode 100644 index 0000000..c672cb6 --- /dev/null +++ b/src/mkdocs_ansible/__init__.py @@ -0,0 +1,7 @@ +"""mkdocs-ansible theme.""" +try: + from ._version import version as __version__ +except ImportError: # pragma: no cover + __version__ = "0.1.dev1" + +__all__ = ("__version__",) diff --git a/src/mkdocs_ansible/assets/images/favicon.ico b/src/mkdocs_ansible/assets/images/favicon.ico new file mode 100644 index 0000000..ea4ebc1 Binary files /dev/null and b/src/mkdocs_ansible/assets/images/favicon.ico differ diff --git a/src/mkdocs_ansible/assets/images/logo.png b/src/mkdocs_ansible/assets/images/logo.png new file mode 100644 index 0000000..f3626b0 Binary files /dev/null and b/src/mkdocs_ansible/assets/images/logo.png differ diff --git a/src/mkdocs_ansible/assets/images/logo.svg b/src/mkdocs_ansible/assets/images/logo.svg new file mode 100644 index 0000000..ffe210b --- /dev/null +++ b/src/mkdocs_ansible/assets/images/logo.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/mkdocs_ansible/mkdocs_theme.yml b/src/mkdocs_ansible/mkdocs_theme.yml new file mode 100644 index 0000000..b6cca9b --- /dev/null +++ b/src/mkdocs_ansible/mkdocs_theme.yml @@ -0,0 +1,33 @@ +--- +extends: material + +language: en +direction: ltr +features: [] +palette: + - scheme: default + primary: teal + accent: teal + toggle: + icon: material/brightness-7 + name: Switch to dark mode + - scheme: slate + primary: teal + accent: teal + toggle: + icon: material/brightness-4 + name: Switch to light mode + +font: + # Must be a valid Google Font name from https://fonts.google.com/ + # text: Roboto + # code: Roboto Mono + text: Red Hat Display + code: Red Hat Mono +# From Material 5.x on, icons are inlined into the HTML and CSS as SVGs. Some +# icons that are part of the HTML can be configured and replaced +icon: + +favicon: assets/images/favicon.ico +static_templates: + - 404.html diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..833c305 --- /dev/null +++ b/tox.ini @@ -0,0 +1,113 @@ +# spell-checker:ignore linkcheck basepython changedir envdir envlist envname envsitepackagesdir passenv setenv testenv toxinidir toxworkdir usedevelop doctrees envpython posargs +[tox] +minversion = 4.0.0 +envlist = + lint + pkg + docs + +[testenv] +passenv = + CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437 + FORCE_COLOR + HOME + NO_COLOR + PYTEST_* # allows developer to define their own preferences + PYTEST_REQPASS # needed for CI + PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,... + PY_COLORS + RTD_TOKEN + REQUESTS_CA_BUNDLE # https proxies + SETUPTOOLS_SCM_DEBUG + SSL_CERT_FILE # https proxies + SSH_AUTH_SOCK # may be needed by git when running with progressive + LANG + LC_* +setenv = + + COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}} + COVERAGE_PROCESS_START={toxinidir}/pyproject.toml + PIP_CONSTRAINT = {toxinidir}/.config/requirements.txt + devel,pkg: PIP_CONSTRAINT = /dev/null + PIP_DISABLE_PIP_VERSION_CHECK = 1 + PRE_COMMIT_COLOR = always + FORCE_COLOR = 1 +allowlist_externals = + sh + +[testenv:lint] +description = Run all linters +# pip compile includes python version in output constraints, so we want to +# be sure that version does not change randomly. +basepython = python3.9 +deps = + pre-commit>=2.6.0 + setuptools>=51.1.1 + pytest>=7.2.0 # to updated schemas +skip_install = true +commands = + {envpython} -m pre_commit run --all-files --show-diff-on-failure {posargs:} +passenv = + {[testenv]passenv} + PRE_COMMIT_HOME +setenv = + {[testenv]setenv} + # avoid messing pre-commit with out own constraints + PIP_CONSTRAINT= +[testenv:deps] +description = Bump all test dependencies +# we reuse the lint environment +envdir = {toxworkdir}/lint +skip_install = true +basepython = python3.9 +deps = + {[testenv:lint]deps} +setenv = + # without his upgrade would likely not do anything + PIP_CONSTRAINT = /dev/null +commands = + pre-commit run --all-files --show-diff-on-failure --hook-stage manual lock + pre-commit run --all-files --show-diff-on-failure --hook-stage manual up + # Update pre-commit hooks + pre-commit autoupdate + # Update npm deps + sh -c "cd test/schemas && npm run deps" + # We fail if files are modified at the end + git diff --exit-code + +[testenv:docs] +description = Builds docs +extras = + docs +setenv = + # Disable colors until markdown-exec supports it: + # https://github.com/pawamoy/markdown-exec/issues/11 + NO_COLOR = 1 + TERM = dump +skip_install = false +usedevelop = true +commands = + mkdocs build {posargs:} + +[testenv:pkg] +description = + Build package, verify metadata, install package and assert behavior when ansible is missing. +deps = + build >= 0.9.0 + twine >= 4.0.1 +skip_install = true +# Ref: https://twitter.com/di_codes/status/1044358639081975813 +commands = + # build wheel and sdist using PEP-517 + {envpython} -c 'import os.path, shutil, sys; \ + dist_dir = os.path.join("{toxinidir}", "dist"); \ + os.path.isdir(dist_dir) or sys.exit(0); \ + print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \ + shutil.rmtree(dist_dir)' + {envpython} -m build --outdir {toxinidir}/dist/ {toxinidir} + # Validate metadata using twine + twine check --strict {toxinidir}/dist/* + # Install the wheel + sh -c 'python3 -m pip install "mkdocs-ansible[lock] @ file://$(echo {toxinidir}/dist/*.whl)"' + # Uninstall it + python3 -m pip uninstall -y mkdocs-ansible