-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (54 loc) · 2.15 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
64
65
66
67
68
69
70
.DEFAULT: help
CONTAINER_NAME = python_template_container
.ONESHELL:
CONTAINER_VERSION ?= $(shell git rev-parse HEAD)
.PHONY: help
help:
@echo 'help - show help'
@echo 'lock - lock the project dependencies'
@echo 'bootstrap - install the project dependencies'
@echo 'build - build project packages'
@echo 'upload - upload built packages to package repository'
@echo 'container - build the docker image on the current machine'
@echo 'devcontainer - run isolated environment inside the docker container'
@echo 'hooks - install all git hooks'
@echo 'tests - run project tests'
@echo 'docs - generate the project documentation'
@echo 'lint - inspect project source code for problems and errors'
@echo 'stubs - create files that include only type hints for the public interface of modules'
@echo 'jupyter - run jupyter server'
@echo 'analysis - run the python script with performance analysis'
@echo 'clean - clean up project environment and all the build artifacts'
.PHONY: lock
lock:
@poetry lock --no-cache
bootstrap: poetry.lock poetry.toml pyproject.toml
@poetry check
@poetry install -vv --compile --extras cpu --no-cache --with dev --with docs --with tests
build: bootstrap
@poetry build --clean
upload: build
@poetry run twine upload --non-interactive --skip-existing dist/*
.PHONY: container
container:
@env DOCKER_BUILDKIT=1 docker build --network host --tag $(CONTAINER_NAME):$(CONTAINER_VERSION) $(PWD)
devcontainer: container
@docker run --interactive --network host --rm --tty --volume $(PWD):/src:Z $(CONTAINER_NAME):$(CONTAINER_VERSION)
hooks: bootstrap
@poetry run pre-commit install --config .githooks.yml
tests: bootstrap
@poetry run tox
docs: bootstrap
@poetry run tox -e docs
lint: bootstrap
@poetry run tox -e lint
stubs: bootstrap
@poetry run stubgen --output .stubs -- src
jupyter: bootstrap
@poetry run jupyter notebook --log-level INFO --ServerApp.notebook_dir $(PWD)
analysis: bootstrap
@poetry run python -m cProfile -o analysis.prof $(or $(PROFILE_SCRIPT), main.py)
@poetry run snakeviz analysis.prof
.PHONY: clean
clean:
git clean -X -d --force