forked from missinglinks/pit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
101 lines (79 loc) · 3.04 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[\.a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: test
test: ## Run tests
pytest provit -v --cov=provit --cov-report term-missing:skip-covered
.PHONY: check
check: bandit black-check pip-check test ## Run all checks
.PHONY: bandit
bandit: ## Run bandit
python -m bandit -r provit
.PHONY: black-check
black-check: ## Check code formatting
python -m black --check provit
.PHONY: black
black: ## Format code
python -m black provit
.PHONY: git-flow
git-flow: ## Initialize git-flow
@if [ $$(git-flow version 2>/dev/null | grep -c AVH) -lt 1 ]; then \
echo "You need to have gitflow-avh installed" >&2; \
exit 1; \
fi
grep -q '^\[gitflow ' .git/config || git-flow init -d
.PHONY: pip-sync
pip-sync: ## Install all dev dependencies
python -m pip install "$$(grep '^pip-tools=' requirements-dev.txt)"
python -m piptools sync requirements-dev.txt
.PHONY: develop
develop: git-flow pip-sync pip-check ## Setup repository for development
.PHONY: pip-check
pip-check: ## Verify that all python package dependencies are met
python -m pip check
# Sets the annotation content for the files generated by pip-compile
export CUSTOM_COMPILE_COMMAND := make update-requirements
.PHONY: update-requirements
update-requirements: ## Regenerate requirements.txt with newest versions of dependencies
python -m piptools compile --rebuild --upgrade --quiet requirements.in
python -m piptools compile --rebuild --upgrade --quiet requirements-dev.in
.PHONY: upgrade
upgrade: ## Update all packages as available
python -m pip install --upgrade-strategy eager --upgrade $$(cat requirements.in | sed -n 's/==.*$$//p')
python -m pip install --upgrade-strategy eager --upgrade $$(cat requirements-dev.in | sed -n 's/==.*$$//p')
.PHONY: build-frontend
build-frontend: ## Build the frontend and copies it into the python application
cd frontend; npm run build
cp -r frontend/build/static provit/browser
mkdir -p provit/browser/templates/
cp frontend/build/index.html provit/browser/templates/index.html
sed -i -r "s@/static/([^\"]*)@{{ url_for('static', filename='\1')}}@g" provit/browser/templates/index.html
.PHONY: install-frontend-modules
install-frontend-modules: ## Install the frontend
cd frontend; npm install
.PHONY: clean
clean: ## Clean the project directory
rm -fr frontend/build
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
.PHONY: docs
docs: ## build docs
rm -f docs/source/pit.rst
rm -f docs/source/modules.rst
sphinx-apidoc -o docs/source provit
$(MAKE) -C docs clean
$(MAKE) -C docs html
.PHONY: dist
dist: clean build-frontend ## Clean repo, build fronend, sdist and bdist
python setup.py sdist bdist_wheel
.PHONY: testupload
testupload: dist ## Upload release to PyPI Test
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
.PHONY: release
release: dist ## Upload release to PyPI
twine upload dist/*