From 1a575d6db8117b4053465c13aecea6afae83b954 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Mon, 18 Apr 2022 01:48:36 +0300 Subject: [PATCH] move documentation to tox --- .gitignore | 2 ++ Makefile | 30 ++++++++++++------------------ setup.py | 6 ++++++ tox.ini | 19 +++++++++++++++++++ 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index a604aa9a..1fa4cc9d 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,5 @@ ENV/ status_cache.json *.db + +docs/html/ diff --git a/Makefile b/Makefile index ec8e20ef..8bd4fece 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: architecture archive archive_directory archlinux check clean directory docs-clean docs-html docs-source man push tests version +.PHONY: archive archive_directory archlinux check clean directory push spec spec-html tests version .DEFAULT_GOAL := archlinux PROJECT := ahriman @@ -10,9 +10,6 @@ IGNORE_FILES := package/archlinux src/.mypy_cache $(TARGET_FILES) : $(addprefix $(PROJECT), %) : $(addprefix ., %) directory version @cp -rp $< $@ -architecture: - cd src && pydeps ahriman -o ../docs/ahriman-architecture.svg --no-show --cluster - archive: archive_directory tar cJf "$(PROJECT)-$(VERSION)-src.tar.xz" "$(PROJECT)" rm -rf "$(PROJECT)" @@ -36,26 +33,23 @@ clean: directory: clean mkdir "$(PROJECT)" -docs-clean: clean - find docs/source -type f -name "$(PROJECT)*.rst" -delete - rm -rf docs/html docs/source/modules.rst - -docs-html: docs-source - sphinx-build -b html -a -j auto docs/source docs/html - -docs-source: docs-clean - SPHINX_APIDOC_OPTIONS=members,no-undoc-members,show-inheritance sphinx-apidoc --force --private -o docs/source src - -man: - cd src && PYTHONPATH=. argparse-manpage --module ahriman.application.ahriman --function _parser --author "ahriman team" --project-name ahriman --author-email "" --url https://github.com/arcan1s/ahriman --output ../docs/ahriman.1 - -push: architecture docs-source man archlinux +push: spec archlinux git add package/archlinux/PKGBUILD src/ahriman/version.py docs/ahriman-architecture.svg docs/ahriman.1 git commit -m "Release $(VERSION)" git tag "$(VERSION)" git push git push --tags +spec: + # make sure that old files are removed + find docs/source -type f -name "$(PROJECT)*.rst" -delete + rm -f docs/source/modules.rst + tox -e docs + +spec-html: spec + rm -rf docs/html + tox -e docs-html + tests: clean tox -e tests diff --git a/setup.py b/setup.py index a8e428e8..3c662f81 100644 --- a/setup.py +++ b/setup.py @@ -93,6 +93,12 @@ setup( "mypy", "pylint", ], + "docs": [ + "Sphinx", + "argparse-manpage", + "pydeps", + "sphinxcontrib-napoleon", + ], "s3": [ "boto3", ], diff --git a/tox.ini b/tox.ini index 2676827a..82e4ee2a 100644 --- a/tox.ini +++ b/tox.ini @@ -27,6 +27,25 @@ commands = bandit -c .bandit-test.yml -r "tests/{[tox]project_name}" /bin/bash -c 'mypy --implicit-reexport --strict -p "{[tox]project_name}" --install-types --non-interactive || mypy --implicit-reexport --strict -p "{[tox]project_name}"' +[testenv:docs] +deps = + {[tox]dependencies} + -e .[docs] +changedir = src +setenv = + SPHINX_APIDOC_OPTIONS=members,no-undoc-members,show-inheritance +commands = + argparse-manpage --module ahriman.application.ahriman --function _parser --author "ahriman team" --project-name ahriman --author-email "" --url https://github.com/arcan1s/ahriman --output ../docs/ahriman.1 + pydeps ahriman -o ../docs/ahriman-architecture.svg --no-config --no-show --cluster + sphinx-apidoc --force --private -o ../docs/source . + +[testenv:docs-html] +deps = + {[tox]dependencies} + -e .[docs] +commands = + sphinx-build -b html -a -j auto docs/source docs/html + [testenv:tests] deps = {[tox]dependencies}