-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (63 loc) · 2.06 KB
/
Copy pathMakefile
File metadata and controls
85 lines (63 loc) · 2.06 KB
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
.PHONY: install run dev clean format lint type-check check-all build publish
TOML_FILE := pyproject.toml
SETUP_FILE := setup.py
# Extract version from file
get-version:
@grep -E '^version *= *"' $(TOML_FILE) | sed -E 's/.*"([0-9]+\.[0-9]+\.[0-9]+)".*/\1/'
bump-patch:
@current=$$(make get-version); \
new_version=$$(echo $$current | awk -F. '{ printf "%d.%d.%d", $$1, $$2, $$3+1 }'); \
echo "Bumping patch: $$current -> $$new_version"; \
make bump-version VERSION=$$new_version
bump-minor:
@current=$$(make get-version); \
new_version=$$(echo $$current | awk -F. '{ printf "%d.%d.%d", $$1, $$2+1, 0 }'); \
echo "Bumping minor: $$current -> $$new_version"; \
make bump-version VERSION=$$new_version
bump-major:
@current=$$(make get-version); \
new_version=$$(echo $$current | awk -F. '{ printf "%d.%d.%d", $$1+1, 0, 0 }'); \
echo "Bumping major: $$current -> $$new_version"; \
make bump-version VERSION=$$new_version
bump-version:
@if [ -z "$(VERSION)" ]; then \
echo "Usage: make bump-version VERSION=x.y.z"; \
exit 1; \
fi; \
if ! echo "$(VERSION)" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$$'; then \
echo "Invalid version format: $(VERSION)"; \
exit 1; \
fi; \
echo "Updating version to $(VERSION)"; \
sed -i.bak 's/version = "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"/version = "$(VERSION)"/' $(TOML_FILE); \
rm -f $(TOML_FILE).bak; \
sed -i.bak 's/VERSION = "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"/VERSION = "$(VERSION)"/' $(SETUP_FILE); \
rm -f $(SETUP_FILE).bak; \
echo "Version bumped to: $(VERSION)"
install:
pip install -r requirements.txt
pip install -e .
run:
piko
dev:
python watch.py watchmedo auto-restart --directory=./piko --pattern="*.py" --recursive -- piko
clean:
find . -type f -name '*.pyc' -delete
find . -type d -name '__pycache__' -exec rm -r {} +
# Formatting and linting commands
format:
black .
isort .
lint:
ruff check . --fix
type-check:
mypy .
check-all: format lint type-check
build:
python setup.py sdist bdist_wheel
publish:
twine upload dist/* --config-file .pypirc
release:
rm -rf dist
make build
make publish