-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (56 loc) · 2.24 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
71
72
# Copyright 2023 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SILENT:
.PHONY:
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys # isort:skip
matches = []
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
matches.append(match.groups())
for target, help in sorted(matches):
print(" %-25s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
PYTHON = python$(PYTHON_VERSION)
help: ## Print this help
@echo
@echo " make targets:"
@echo
@$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
init-venv: ## Create virtual environment in venv folder
@$(PYTHON) -m venv venv
init: init-venv ## Init virtual environment
@./venv/bin/python3 -m pip install -U pip
@./venv/bin/python3 -m pip install -r requirements.prod.txt
@./venv/bin/python3 -m pip install -r requirements.dev.txt
@./venv/bin/python3 -m pre_commit install --install-hooks --overwrite
@echo "use 'source venv/bin/activate' to activate venv "
@./venv/bin/python3 -m pip install -e .
format: ## Run formatter on source code
@./venv/bin/python3 -m black --config=pyproject.toml .
lint: ## Run linter on source code
@./venv/bin/python3 -m black --config=pyproject.toml --check .
@./venv/bin/python3 -m flake8 --config=.flake8 .
clean-lite: ## Remove pycache files, pytest files, etc
@rm -rf build dist .cache .coverage .coverage.* *.egg-info
@find . -name .coverage | xargs rm -rf
@find . -name .pytest_cache | xargs rm -rf
@find . -name .tox | xargs rm -rf
@find . -name __pycache__ | xargs rm -rf
@find . -name *.egg-info | xargs rm -rf
clean: clean-lite ## Remove virtual environment, downloaded models, etc
@rm -rf venv
@echo "run 'make init'"
run: ## Run the application
@./venv/bin/python3 beamforge/app.py