mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 02:30:44 -06:00
chore: start using nox
This commit is contained in:
parent
e26922b808
commit
044a22901b
2 changed files with 50 additions and 14 deletions
19
Makefile
19
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 $@
|
||||
|
|
45
noxfile.py
Normal file
45
noxfile.py
Normal file
|
@ -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')
|
||||
#
|
Loading…
Reference in a new issue