-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
88 lines (71 loc) · 2.4 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
.DEFAULT_GOAL := help
pkg_src = visyn_core
black = black --line-length 140 $(pkg_src) setup.py
pyright = pyright $(pkg_src) setup.py
ruff = ruff check $(pkg_src) setup.py --line-length 140 --select E,W,F,N,I,C,B,UP,PT,SIM,RUF --ignore E501,C901,B008
.PHONY: start ## Start the development server
start:
python $(pkg_src)
.PHONY: celery ## Start the celery worker
celery:
celery -A $(pkg_src).dev_celery worker --loglevel=INFO --concurrency=8 -O fair -P prefork
.PHONY: all ## Perform the most common development-time rules
all: format lint test
.PHONY: ci ## Run all CI validation steps without making any changes to code
ci: check-format lint test
.PHONY: format ## Auto-format the source code
format:
$(ruff) --fix
$(black)
.PHONY: check-format ## Check the source code format without changes
check-format:
$(black) --check
.PHONY: lint ## Run flake8 and pyright
lint:
$(ruff) --output-format=github
$(pyright)
.PHONY: test ## Run tests
test:
pytest $(pkg_src)
.PHONEY: documentation ## Generate docs
documentation:
echo "TODO"
.PHONY: install ## Install the requirements
install:
@if [ ! -z "${CI}" ]; then \
uv pip install -e . --system --upgrade; \
else \
uv pip install -e . --upgrade; \
fi
.PHONY: develop ## Set up the development environment
develop:
@if [ ! -z "${CI}" ]; then \
uv pip install -e ".[develop]" --system --upgrade; \
else \
uv pip install -e ".[develop]" --upgrade; \
fi
.PHONY: env_encrypt ## Encrypts the current ./<app>/.env
env_encrypt:
openssl aes-256-cbc -pbkdf2 -in ./$(pkg_src)/.env -out ./$(pkg_src)/.env.enc
.PHONY: env_decrypt ## Decrypts the ./<app>/.env.enc
env_decrypt:
@if [ -z "${ENV_PASSWORD}" ]; then \
echo "No ENV_PASSWORD set, prompting for password..."; \
openssl aes-256-cbc -pbkdf2 -d -in ./$(pkg_src)/.env.enc -out ./$(pkg_src)/.env; \
else \
echo "ENV_PASSWORD set, using it..."; \
openssl aes-256-cbc -pbkdf2 -d -in ./$(pkg_src)/.env.enc -out ./$(pkg_src)/.env -pass env:ENV_PASSWORD; \
fi
.PHONY: build ## Build a wheel
build:
python setup.py sdist bdist_wheel --dist-dir dist_python
.PHONY: publish ## Publish the ./dist/* using twine
publish:
pip install twine==3.8.0
twine upload --repository-url https://upload.pypi.org/legacy/ dist_python/*
.PHONY: help ## Display this message
help:
@grep -E \
'^.PHONY: .*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-20s\033[0m %s\n", $$2, $$3}'