diff --git a/Makefile b/Makefile index aca9ac7..452f17e 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,6 @@ VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g') PREFIX ?= ~/bin -lint: ## run pre-commit hooks - pdm run pre-commit run --all || pdm run pre-commit run --all - -types: ## run mypy - pdm run mypy src/viv - bump: ## update version and tag commit @echo "bumping to version => $(VERSION)" @sed -i 's/__version__ = ".*"/__version__ = "$(VERSION)"/g' src/viv/viv.py @@ -25,18 +19,15 @@ assets/viv-help.svg: dev-install: ln -sf $(PWD)/src/viv/viv.py ~/.local/share/viv/viv.py -docs: docs/index.md docs/viv.py ## build docs - pdm run mkdocs build - -svgs: ## build svgs for docs - pdm run python ./scripts/generate-svgs.py +## docs |> update docs files +docs: docs/viv.py docs/index.md docs/viv.py: src/viv/viv.py - cp $< $@ + @cp $< $@ docs/index.md: README.md - printf -- '---\nhide: [navigation]\n---\n\n' > $@ - cat $< >> $@ + @printf -- '---\nhide: [navigation]\n---\n\n' > $@ + @cat $< >> $@ examples/black: .FORCE rm -f $@ diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..0b12b97 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +import os +from pathlib import Path + +import nox + +nox.options.reuse_existing_virtualenvs = True +os.environ.update({"PDM_IGNORE_SAVED_PYTHON": "1"}) + +def pdm_install(session,group): + session.run_always("pdm", "install", "-G", group, external=True, silent=True) + + +@nox.session +def lint(session): + pdm_install(session,"dev") + session.run("pre-commit", "run") + session.run("mypy", "src/") + +@nox.session +def svgs(session): + pdm_install(session, "docs") + session.run("./scripts/generate-svgs.py", external=True) + +@nox.session +def docs(session): + pdm_install(session,"docs") + if not Path('docs/svgs').is_dir(): + svgs(session) + + session.run("make","docs", external=True) + if session.interactive: + session.run("mkdocs","serve") + else: + session.run("mkdocs","build") + + +# @nox.session( +# python=["3.8", "3.9", "3.10", "3.11"] +# ) +# def test(session): +# pdm_install(session,'test') +# session.run('pytest') +#