diff --git a/.gitignore b/.gitignore index 00a6874..773a82e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,17 @@ +.tox/ + /dist/ /build/ -/src/**/*.egg-info -/src/**/*.pyc -/src/**/__pycache/ +*.egg-info +*.pyc /.venv/ /autom4te.cache/ /config.log /config.status /configure~ + +vendor/**/*.tar.gz +vendor/**/*.tar + +test-reports/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/Makefile b/Makefile index 1e6a41b..09fa329 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,62 @@ -.PHONY: requirements.txt requirements-dev.txt configure Pipfile.lock src/sphinx_theme_ref/assets build +WEB2_PACKAGE_ID := html-theme-web2-1.0.0 +WEB2_PACKAGE_URL := https://bitbucket.org/byteb4rb1e/html-theme-web2/downloads/$(WEB2_PACKAGE_ID).tar.gz +PYPKG_DIR := src/byteb4rb1e/sphinxcontrib/theme/web2 +WITH_GPG = $(shell command -v gpg && echo yes) -PKG_BASENAME := sphinx_theme_ref +PYTHON3=$(if $(wildcard .venv/.*),.venv/bin/python3,python3) -VENDOR_OUTPUT_PATH := $(shell realpath ./src/sphinx_theme_ref/assets) +VERSION=$(shell $(PYTHON3) -m setuptools_scm) -Pipfile.lock: - .venv/bin/pipenv lock +.chore: requirements.txt requirements-dev.txt Pipfile.lock configure -requirements.txt: - .venv/bin/pipenv requirements > requirements.txt - -requirements-dev.txt: - .venv/bin/pipenv requirements --dev-only > requirements-dev.txt +.clean: + rm -rvf dist/ build/ configure: autoconf -src/sphinx_theme_ref/assets: - rm -r src/$(PKG_BASENAME)/assets - make -C vendor/html-theme-ref build/production OUTPUT_PATH=$(VENDOR_OUTPUT_PATH) +dist: src/ + $(PYTHON3) -m build -# user acceptance testing -uat: - trap 'kill 0' SIGINT; \ - make -C vendor/html-theme-ref watch OUTPUT_PATH=$(VENDOR_OUTPUT_PATH) & \ - wait +Pipfile.lock: + pipenv lock -build: - .venv/bin/pipenv run build +requirements.txt: + $(PYTHON3) -m pipenv requirements > requirements.txt +requirements-dev.txt: + $(PYTHON3) -m pipenv requirements --dev-only > requirements-dev.txt + +src src/: $(PYPKG_DIR)/_static_extra.tar $(PYPKG_DIR)/_static_extra.tar.sha256 + +$(PYPKG_DIR)/_static_extra.tar: vendor/$(WEB2_PACKAGE_ID).tar + cp -vf "$<" "$@" + +$(PYPKG_DIR)/_static_extra.tar.sha256: vendor/$(WEB2_PACKAGE_ID).tar.sha256 + cp -vf "$<" "$@" + +test-reports test-reports/: test-reports/unit test-reports/integration + +test-reports/unit: + $(PYTHON3) -m tox -m unit + +test-reports/integration: + $(PYTHON3) -m tox -m integration + +test-reports/audit.json: + $(PYTHON3) -m tox -m integration + +vendor/$(WEB2_PACKAGE_ID).tar.gz: $(if $(WITH_GPG),vendor/$(WEB2_PACKAGE_ID).tar.gz.asc,) + curl -L --fail --output "$@" "$(WEB2_PACKAGE_URL)" +ifneq ($(WITH_GPG),) + gpg --verify "$<" "$@" +endif + +vendor/$(WEB2_PACKAGE_ID).tar.gz.asc: + curl -L --fail --output "$@" "$(WEB2_PACKAGE_URL).asc" + +vendor/$(WEB2_PACKAGE_ID).tar: vendor/$(WEB2_PACKAGE_ID).tar.gz + gzip --decompress --keep --stdout "$<" > $@ + +vendor/$(WEB2_PACKAGE_ID).tar.sha256: + curl -L --fail --output "vendor/$(WEB2_PACKAGE_ID).tar.sha256" "$(patsubst %.gz,%.sha256,$(WEB2_PACKAGE_URL))" diff --git a/NOTES b/NOTES new file mode 100644 index 0000000..087166e --- /dev/null +++ b/NOTES @@ -0,0 +1,11 @@ + + +=== Configuration === + +1. Run sh configure +2. Run make .chore + + +Ḿakefile conventions + +abstract targets (e.g. chore, clean, etc.) must be prepended with an underscore. diff --git a/README.md b/README.md index c76c37b..e5a66d1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - + # Tiara's Sphinx Theme Reference Implementation > 🛌 **NOTICE:** This project is taking a naap. It depends upon diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..09b9b7c --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,2 @@ +$(patsubst %.puml,%.png,$(wildcard **/*.puml)): + plantuml "$$(echo "$@" | sed 's|.png$$|.puml|')" diff --git a/docs/diagrams/workflow.png b/docs/diagrams/workflow.png new file mode 100644 index 0000000..f74b078 Binary files /dev/null and b/docs/diagrams/workflow.png differ diff --git a/docs/diagrams/workflow.puml b/docs/diagrams/workflow.puml new file mode 100644 index 0000000..d03f752 --- /dev/null +++ b/docs/diagrams/workflow.puml @@ -0,0 +1,32 @@ +@startuml +package "Vendor Source" { + [WEB2_PACKAGE_URL] --> [vendor/html-theme-web2-1.0.0.tar.gz] + [vendor/html-theme-web2-1.0.0.tar.gz] --> [vendor/html-theme-web2-1.0.0.tar] + [vendor/html-theme-web2-1.0.0.tar.gz.asc] --> [vendor/html-theme-web2-1.0.0.tar.gz] : GPG verify +} + +package "Python Project" { + [vendor/html-theme-web2-1.0.0.tar] --> [src/byteb4rb1e/sphinxcontrib/theme/web2/html-theme-web2.tar] : cp + [src/byteb4rb1e/sphinxcontrib/theme/web2/html-theme-web2.tar] ... [src/...] + [src/...] --> [dist] : build + [configure] --> [configure] : autoconf + [requirements.txt] <-- [Pipfile.lock] + [requirements-dev.txt] <-- [Pipfile.lock] +} + +package "Testing" { + [src/...] --> [test-reports/unit] : tox -m unit + [src/...] --> [test-reports/integration] : tox -m integration + [src/...] --> [test-reports/audit.json] : tox -m integration +} + +note right of [WEB2_PACKAGE_URL] + HTML theme tarball is fetched + as a compressed artifact +end note + +note right of [src/...] + Contains Python package source + and consumes the integrated theme +end note +@enduml diff --git a/pyproject.toml b/pyproject.toml index 5aa6513..5f4f841 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ description = "Functional theme for Sphinx documentation generator" authors = [ { name = "Tiara Rodney", email = "tiara.rodney@administratrix.de" } ] -license = { file = "LICENSE" } +license-files = ["LICENSE"] readme = "README.md" classifiers = [ "Development Status :: 1 - Planning", @@ -31,14 +31,18 @@ classifiers = [ "Topic :: Software Development :: Documentation", ] dependencies = [ - "sphinx >= 8.0,<9.0", + "sphinx >= 5.0" ] dynamic = ["version"] -requires-python = ">=3.8" +requires-python = ">=3.9" [project.entry-points."sphinx.html_themes"] web2 = "byteb4rb1e.sphinxcontrib.theme.web2" +[tool.setuptools.package-data] +# relative to root dir of package, NOT repository +"byteb4rb1e.sphinxcontrib.theme.web2" = ["*.tar", "*.tar.sha256"] + [project.urls] Bitbucket = "https://bitbucket.org/byteb4rb1e/sphinxcontrib-theme-seaharvest" GitHub = "https://github.com/ByteB4rb1e/sphinxcontrib-theme-seaharvest" diff --git a/src/byteb4rb1e/sphinxcontrib/theme/web2/.gitignore b/src/byteb4rb1e/sphinxcontrib/theme/web2/.gitignore new file mode 100644 index 0000000..d874ad6 --- /dev/null +++ b/src/byteb4rb1e/sphinxcontrib/theme/web2/.gitignore @@ -0,0 +1 @@ +*.tar diff --git a/src/byteb4rb1e/sphinxcontrib/theme/web2/_static_extra.tar.sha256 b/src/byteb4rb1e/sphinxcontrib/theme/web2/_static_extra.tar.sha256 new file mode 100644 index 0000000..d8d393b --- /dev/null +++ b/src/byteb4rb1e/sphinxcontrib/theme/web2/_static_extra.tar.sha256 @@ -0,0 +1 @@ +63e49714a06c865bf8f15e94f9d514cbcdb9927dc20c748a373e93570c4c8e8b \ No newline at end of file diff --git a/src/byteb4rb1e/sphinxcontrib/theme/web2/assets/.gitignore b/src/byteb4rb1e/sphinxcontrib/theme/web2/assets/.gitignore deleted file mode 100644 index d772e58..0000000 --- a/src/byteb4rb1e/sphinxcontrib/theme/web2/assets/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# generated by Tiara's HTML Theming Reference Implementation -# -# this .gitignore serves the purpose of allowing wrapping projects, that -# generate this project's assets dynamically, not having to worry about -# auxiliary debugging assets polution. The file is supposed to be copied by -# webpack into the output directory, so the globbing patterns shouldn't match -# the current directory. That's why it's called `gitignore` instead of -# `.gitignore` so that it isn't actually being picked up by git. webpack should -# rewrite the basename. -# -# Depending on your level of paranoia towards breaking changes in dependencies -# with no access to working versions, you can either choose to ignore the entire -# directory and generate HTML theme assets just-in-time, or commit them as -# static assets. I'm running registry proxies as pull-through mirrors locally, -# that I back up regularly, to keep my paranoia at bay. That way, I can.just -# gitignore the directory and generate all assets dynamically. -* -!/.gitignore -*.ts -*.map diff --git a/tests/integration/byteb4rb1e/sphinxcontrib/theme/web2/test_sphinx_theme.py b/tests/integration/byteb4rb1e/sphinxcontrib/theme/web2/test_sphinx_theme.py new file mode 100644 index 0000000..435f852 --- /dev/null +++ b/tests/integration/byteb4rb1e/sphinxcontrib/theme/web2/test_sphinx_theme.py @@ -0,0 +1,5 @@ + + +def test_default(): + """ + """ diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/byteb4rb1e/__init__.py b/tests/unit/byteb4rb1e/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/byteb4rb1e/sphinxcontrib/__init__.py b/tests/unit/byteb4rb1e/sphinxcontrib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/byteb4rb1e/sphinxcontrib/theme/__init__.py b/tests/unit/byteb4rb1e/sphinxcontrib/theme/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/byteb4rb1e/sphinxcontrib/theme/web2/__init__.py b/tests/unit/byteb4rb1e/sphinxcontrib/theme/web2/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/byteb4rb1e/sphinxcontrib/theme/web2/test_unarchive.py b/tests/unit/byteb4rb1e/sphinxcontrib/theme/web2/test_unarchive.py new file mode 100644 index 0000000..5428947 --- /dev/null +++ b/tests/unit/byteb4rb1e/sphinxcontrib/theme/web2/test_unarchive.py @@ -0,0 +1,3 @@ +def test_default(): + """ + """ diff --git a/tox.ini b/tox.ini index 6075fb8..b81dd10 100755 --- a/tox.ini +++ b/tox.ini @@ -1,73 +1,67 @@ [tox] -skipsdist = true -maxversion = 3.11.0 -isolated_build = True -env_list = - static-type-check +requires = + tox>=4.19 +env_list = + py3{8-12}-{unit} + py3{8-12}-sphinx{5-8}-{integration} lint - test - + format [testenv] -basepython = python3 deps = - {toxinidir} -setenv = PYTHONPATH = {toxinidir}/src - + . [testenv:lint] -description = lint with pylint -deps = - pylint >= 2.12.2, < 3 -commands = - python3 -m pylint {toxinidir}/src {posargs} - -[testenv:static-type-check] -description = static type checking -deps = - mypy >=1.5.1,<2 -commands = - python3 -m mypy {toxinidir}/src {posargs} - -[testenv:test] -description = test suite with pytest -deps = - pytest - pytest-cov -commands = - pytest \ - --junitxml=test-reports/full.xml \ - --cov-report term \ - --cov-report html:test-reports/coverage \ - --cov=wsgirouter \ - {posargs} - -[testenv:build-demo] -description = test suite with pytest -deps = - sphinx - {toxinidir} -commands = - sphinx-build -b html -Dhtml4_writer=0 \ - -d {envtmpdir}/doctrees demo \ - build/demo - -[testenv:autobuild-demo] -description = test suite with pytest -deps = - sphinx - sphinx-autobuild - {toxinidir} -commands = - sphinx-autobuild -b html -Dhtml4_writer=0 \ - -d {envtmpdir}/doctrees demo \ - --watch src/tiararodneycom_theme \ - build/demo - -[testenv:build-sdist] -description = build and package +description = run type check on code base +labels = static deps = - build >= 0.5.1, < 1 + mypy commands = - python3 -m build --sdist {posargs} + python3 -m mypy src tests --junit-xml test-reports/{env_name}.xml +[testenv:audit] +description = run type check on code base +labels = audit +deps = + pip-audit +commands = + pip-audit . + +[testenv:format] +description = run type check on code base +labels = static +deps = + black +commands = + black --check src tests + +[testenv:py3{9-13}-unit] +description = run type check on code base +labels = unit +deps = + {[testenv]deps} + pytest +commands = + pytest tests/unit --junitxml=test-reports/{env_name}.xml + +[testenv:py3{9-13}-sphinx{5-7}-integration] +description = run type check on code base +labels = integration +deps = + {[testenv]deps} + sphinx5: sphinx>=5.0,<=6.0 + sphinx6: sphinx>=6.0,<=7.0 + sphinx7: sphinx>=7.0,<=8.0 + pytest +commands = + pytest tests/integration --junitxml=test-reports/{env_name}.xml + +[testenv:py3{10-13}-sphinx8-integration] +description = run type check on code base +labels = integration +deps = + {[testenv]deps} + sphinx8: sphinx>=8.0,<=9.0 + pytest +commands = + pytest tests/integration --junitxml=test-reports/{env_name}.xml