-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (65 loc) · 2.79 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
SHELL := /bin/bash
python_version = 3.10.6
venv_prefix = hastycdr
venv_name = $(venv_prefix)-$(python_version)
pyenv_instructions=https://github.com/pyenv/pyenv#installation
pyenv_virt_instructions=https://github.com/pyenv/pyenv-virtualenv#pyenv-virtualenv
init: require_pyenv ## Setup a dev environment for local development.
@pyenv install $(python_version) -s
@echo -e "\033[0;32m ✔️ 🐍 $(python_version) installed \033[0m"
@if ! [ -d "$$(pyenv root)/versions/$(venv_name)" ]; then\
pyenv virtualenv $(python_version) $(venv_name);\
fi;
@pyenv local $(venv_name)
@echo -e "\033[0;32m ✔️ 🐍 $(venv_name) virtualenv activated \033[0m"
pip install --upgrade pip pip-tools
pip-sync tests/dev-requirements.txt
pip install -e . --no-deps
@echo -e "\nEnvironment setup! ✨ 🍰 ✨ 🐍 \n\nCopy this path to tell PyCharm where your virtualenv is. You may have to click the refresh button in the pycharm file explorer.\n"
@echo -e "\033[0;32m"
@pyenv which python
@echo -e "\n\033[0m"
@echo -e "The following commands are available to run in the Makefile\n"
@make -s help
af: autoformat ## Alias for `autoformat`
autoformat: ## Run the autoformatter.
@pycln . --all --quiet --extend-exclude __init__\.py
@isort --atomic --profile black .
@black .
test: ## Run the tests.
@pytest
@echo -e "The tests pass! ✨ 🍰 ✨"
lint: ## Run the code linter.
@pylama
@echo -e "No linting errors - well done! ✨ 🍰 ✨"
check: autoformat lint test ## Run the autoformatter, linter, and tests.
deploy: ## Deploy the package to pypi.org
pip install twine wheel
-git tag $$(python setup.py -V)
git push --tags
rm -rf dist
python setup.py bdist_wheel
#python setup.py sdist
@echo 'pypi.org Username: '
@read username && twine upload --verbose dist/* -u $$username;
rm -rf build
rm -rf dist
@echo "Deploy successful! ✨ 🍰 ✨"
requirements: ## Freeze the requirements.txt file
pip-compile setup.py tests/dev-requirements.in --resolver=backtracking --output-file=tests/dev-requirements.txt --upgrade
require_pyenv:
@if ! [ -x "$$(command -v pyenv)" ]; then\
echo -e '\n\033[0;31m ❌ pyenv is not installed. Follow instructions here: $(pyenv_instructions)\n\033[0m';\
exit 1;\
else\
echo -e "\033[0;32m ✔️ pyenv installed\033[0m";\
fi
@if ! [[ "$$(pyenv virtualenv --version)" == *"pyenv-virtualenv"* ]]; then\
echo -e '\n\033[0;31m ❌ pyenv virtualenv is not installed. Follow instructions here: $(pyenv_virt_instructions) \n\033[0m';\
exit 1;\
else\
echo -e "\033[0;32m ✔️ pyenv-virtualenv installed\033[0m";\
fi
help: ## Show this help message.
@## https://gist.github.com/prwhite/8168133#gistcomment-1716694
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)" | sort