diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8aac09a0..70e0ba37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,7 +35,7 @@ jobs: - name: Upload pages artifact uses: actions/upload-pages-artifact@v2 with: - path: public + path: public/html - id: deployment name: Deploy to GitHub Pages uses: actions/deploy-pages@v2 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dc5e03a4..5e3c73c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,7 +59,7 @@ package: pages: artifacts: paths: - - public + - public/html except: refs: - schedules diff --git a/.gitlab-ci.yml.jinja b/.gitlab-ci.yml.jinja index 6540c106..67a86af4 100644 --- a/.gitlab-ci.yml.jinja +++ b/.gitlab-ci.yml.jinja @@ -76,7 +76,7 @@ package: pages: artifacts: paths: - - public + - public/html except: refs: - schedules diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 43ba0242..34ec0ab5 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -2,10 +2,8 @@ build: os: ubuntu-22.04 tools: python: '3' -python: - install: - - extra_requirements: - - docs - method: pip - path: . + commands: + - pip install --upgrade pip + - make dev-docs + - make docs version: 2 diff --git a/Makefile b/Makefile index 638c45a0..fdec4b1f 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ # Construct pipenv run command with or without site-packages flag when not in CI environment and pipenv command exists. SITE_PACKAGES_FLAG = $(shell [ "${SS_SITE_PACKAGES}" = "true" ] && echo --site-packages) PIPRUN := $(shell [ "${CI}" != "true" ] && command -v pipenv > /dev/null 2>&1 && echo pipenv ${SITE_PACKAGES_FLAG} run) +PUBLIC_DIR := $(or $(READTHEDOCS_OUTPUT),public) # Remove common intermediate files. clean: @@ -15,7 +16,7 @@ clean: Pipfile* \ coverage.xml \ dist \ - public + $(PUBLIC_DIR) find . -name '*.egg-info' -print0 | xargs -0 rm -rf find . -name '*.pyc' -print0 | xargs -0 rm -f find . -name '*.swp' -print0 | xargs -0 rm -f @@ -72,7 +73,9 @@ upload: ${PIPRUN} python -m twine upload dist/* docs: - ${PIPRUN} python -m sphinx.cmd.build docs public + ${PIPRUN} python -m sphinx.cmd.build docs ${PUBLIC_DIR}/html + ${PIPRUN} python -m mypy tests src --html-report ${PUBLIC_DIR}/html/reports/mypy + ${PIPRUN} python -m pytest --cov-report html:${PUBLIC_DIR}/html/reports/coverage . docs-autobuild: - ${PIPRUN} python -m sphinx_autobuild docs public --watch src + ${PIPRUN} python -m sphinx_autobuild docs ${PUBLIC_DIR}/html --watch src diff --git a/Makefile.jinja b/Makefile.jinja index 53ddeb8a..caf006c2 100644 --- a/Makefile.jinja +++ b/Makefile.jinja @@ -3,6 +3,7 @@ # Construct pipenv run command with or without site-packages flag when not in CI environment and pipenv command exists. SITE_PACKAGES_FLAG = $(shell [ "${SS_SITE_PACKAGES}" = "true" ] && echo --site-packages) PIPRUN := $(shell [ "${CI}" != "true" ] && command -v pipenv > /dev/null 2>&1 && echo pipenv ${SITE_PACKAGES_FLAG} run) +PUBLIC_DIR := $(or $(READTHEDOCS_OUTPUT),public) # Remove common intermediate files. clean: @@ -17,7 +18,7 @@ clean: Pipfile* \ coverage.xml \ dist \ - public + $(PUBLIC_DIR) find . -name '*.egg-info' -print0 | xargs -0 rm -rf find . -name '*.pyc' -print0 | xargs -0 rm -f find . -name '*.swp' -print0 | xargs -0 rm -f @@ -74,7 +75,9 @@ upload: ${PIPRUN} python -m twine upload dist/* docs: - ${PIPRUN} python -m sphinx.cmd.build docs public + ${PIPRUN} python -m sphinx.cmd.build docs ${PUBLIC_DIR}/html + ${PIPRUN} python -m mypy tests src --html-report ${PUBLIC_DIR}/html/reports/mypy + ${PIPRUN} python -m pytest --cov-report html:${PUBLIC_DIR}/html/reports/coverage . docs-autobuild: - ${PIPRUN} python -m sphinx_autobuild docs public --watch src + ${PIPRUN} python -m sphinx_autobuild docs ${PUBLIC_DIR}/html --watch src diff --git a/copier.yaml b/copier.yaml index 9d360f42..792304a7 100644 --- a/copier.yaml +++ b/copier.yaml @@ -6,7 +6,6 @@ _exclude: - __pycache__ - copier.yaml - copier.yml - - docs/modules/serious_scaffold.settings.rst - includes - src/serious_scaffold - ~* diff --git a/docs/cli/index.rst b/docs/cli/index.rst index 2a2a7513..c3798ecb 100644 --- a/docs/cli/index.rst +++ b/docs/cli/index.rst @@ -1,5 +1,5 @@ -Command Line Interface -====================== +CLI Reference +============= .. click:: serious_scaffold.cli:typer_click_object :prog: serious-scaffold-cli diff --git a/docs/cli/index.rst.jinja b/docs/cli/index.rst.jinja index da395198..47c8c1cf 100644 --- a/docs/cli/index.rst.jinja +++ b/docs/cli/index.rst.jinja @@ -1,5 +1,5 @@ -Command Line Interface -====================== +CLI Reference +============= .. click:: {{ module_name }}.cli:typer_click_object :prog: {{ package_name }}-cli diff --git a/docs/index.rst b/docs/index.rst index 84ef3dde..5141b4a6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,6 +6,7 @@ Welcome to Serious Scaffold Python's documentation! cli/index api/index + reports/index Indices and tables ================== diff --git a/docs/index.rst.jinja b/docs/index.rst.jinja index 0f5643a2..3b727a8b 100644 --- a/docs/index.rst.jinja +++ b/docs/index.rst.jinja @@ -6,6 +6,7 @@ Welcome to {{ project_name }}'s documentation! cli/index api/index + reports/index Indices and tables ================== diff --git a/docs/reports/coverage/index.rst b/docs/reports/coverage/index.rst new file mode 100644 index 00000000..95f61be3 --- /dev/null +++ b/docs/reports/coverage/index.rst @@ -0,0 +1,4 @@ +Coverage Reports +================ + +This is a placeholder for coverage reports which supposed to be overridden. diff --git a/docs/reports/index.rst b/docs/reports/index.rst new file mode 100644 index 00000000..cf491a7c --- /dev/null +++ b/docs/reports/index.rst @@ -0,0 +1,8 @@ +Code Quality Reports +==================== + +.. toctree:: + :maxdepth: 2 + + mypy/index + coverage/index diff --git a/docs/reports/mypy/index.rst b/docs/reports/mypy/index.rst new file mode 100644 index 00000000..16f27ab4 --- /dev/null +++ b/docs/reports/mypy/index.rst @@ -0,0 +1,4 @@ +MyPy Reports +============ + +This is a placeholder for mypy reports which supposed to be overridden. diff --git a/requirements/docs.txt b/requirements/docs.txt index 8c74bcdc..56cda99c 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,6 +1,9 @@ # Requirements for docs. autodoc-pydantic furo +mypy[reports] +pytest +pytest-cov Sphinx sphinx-autobuild sphinx-click diff --git a/src/serious_scaffold/cli.py b/src/serious_scaffold/cli.py index bb0aa6d5..2cda5489 100644 --- a/src/serious_scaffold/cli.py +++ b/src/serious_scaffold/cli.py @@ -23,7 +23,3 @@ def main() -> None: # NOTE(huxuan): click object is used for document generation. # Reference: https://github.com/tiangolo/typer/issues/200#issuecomment-796485787 typer_click_object = typer.main.get_command(app) - - -if __name__ == "__main__": - app() # pragma: no cover diff --git a/src/{{ module_name }}/cli.py.jinja b/src/{{ module_name }}/cli.py.jinja index 2f7b3a19..9182c4de 100644 --- a/src/{{ module_name }}/cli.py.jinja +++ b/src/{{ module_name }}/cli.py.jinja @@ -23,7 +23,3 @@ def main() -> None: # NOTE(huxuan): click object is used for document generation. # Reference: https://github.com/tiangolo/typer/issues/200#issuecomment-796485787 typer_click_object = typer.main.get_command(app) - - -if __name__ == "__main__": - app() # pragma: no cover