-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (45 loc) · 2.66 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
REQUIRED := python3
$(foreach bin,$(REQUIRED),\
$(if $(shell command -v $(bin) 2> /dev/null),,$(error Please install `$(bin)`)))
REPOSITORY_ROOT := $(PWD)
help: ## Show this help. (Default target)
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help
.PHONY : install install-poetry run-nox-all run-nox-session format run-quick-test ipython-shell new-version
install-poetry: .poetry/bin/poetry ## Install poetry in the project.
$< install
install: install-poetry ## install all dependencies for development
NOXSESSION='pre-commit -- install' make run-nox-session
.poetry/bin/poetry: ## install poetry
@curl -sSL https://install.python-poetry.org | POETRY_HOME=$(REPOSITORY_ROOT)/$(shell basename $(dir $(abspath $(dir $(@))))) python3 - --version=1.4.0
$(MAKE) install-poetry
run-nox-all: .poetry/bin/poetry ## Run all nox sessions
@PATH=$$PATH:$(dir $<) $< run nox
run-nox-session: .poetry/bin/poetry guard-NOXSESSION ## Run a specific nox session. Call via something like NOXSESSION=tests-3.10 make run-nox-session
@# nox needs poetry, so we need to put poetry on the path
@PATH=$$PATH:$(dir $<) $< run nox -- -s $(NOXSESSION)
list-of-nox-sessions-print: .poetry/bin/poetry
$< run nox --list
run-quick-test: .poetry/bin/poetry ## Run all nox sessions
$< run pytest
run-quick-mypy: .poetry/bin/poetry ## Run all nox sessions
$< run mypy .
ipython-shell: .poetry/bin/poetry ## Fire up an ipython shell with dependencies available in the environment.
$< run ipython
format: .poetry/bin/poetry ## Format the code by running isort and black on the repo.
$< run isort .
$< run black .
new-version: ## Release a new version Use: make new-version-<patch|minor|major|prepatch|preminor|premajor|prerelease>
@echo "NOTE: please run make new-version-<patch|minor|major|prepatch|preminor|premajor|prerelease> to make a new version"
new-version-%: .poetry/bin/poetry ## Make a new version. Use: make new-version-<patch|minor|major|prepatch|preminor|premajor|prerelease>
$< version -- $*
$(eval NEW_VERSION = $(shell $< version -s))
@echo NOTE: You must now commit and push the changes made by the make $@ command to initialize the release action on Github.
@echo Suggested commands:
@echo git add pyproject.toml
@echo git commit -m \'Release New Version\'
@echo git push
guard-%: .poetry/bin/poetry ## Used to ensure an env var is available for a target that depends on guard-%
@if [ -z '${${*}}' ]; then echo 'Variable $* not set. You can set it with $*=VALUE make ...' && exit 1; fi
docs-serve: .poetry/bin/poetry
$< sphinx-autobuild docs docs/_build/html