forked from langroid/langroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (73 loc) · 2.09 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
.PHONY: setup check lint tests docs nodocs loc
SHELL := /bin/bash
.PHONY: setup update
setup: ## Setup the git pre-commit hooks
poetry run pre-commit install
update: ## Update the git pre-commit hooks
poetry run pre-commit autoupdate
check:
@poetry run pre-commit install
@poetry run pre-commit autoupdate
@poetry run pre-commit run --all-files
@echo "Running black..."
@black --check .
@echo "Running flake8 on git-tracked files ONLY! ..."
@git ls-files | grep '\.py$$' | xargs flake8 --exclude=.git,__pycache__,.venv
@poetry run ruff .
@echo "Running mypy...";
@poetry run mypy -p langroid
@echo "All checks passed!"
lint:
black .
poetry run ruff . --fix
tests:
pytest tests/main --basetemp=/tmp/pytest
docs:
@# Kill any existing 'mkdocs serve' processes.
@pkill -f "mkdocs serve" 2>/dev/null || true
@# Build the documentation.
mkdocs build
@# Serve the documentation in the background.
mkdocs serve &
@echo "Documentation is being served in the background."
@echo "You can access the documentation at https://127.0.0.1:8000/"
nodocs:
@# Kill any existing 'mkdocs serve' processes.
@pkill -f "mkdocs serve" 2>/dev/null || echo "No 'mkdocs serve' process found."
@echo "Stopped serving documentation."
loc:
@echo "Lines in git-tracked files python files:"
@git ls-files | grep '\.py$$' | xargs cat | grep -v '^\s*$$' | wc -l
.PHONY: bump-patch
bump-patch:
@poetry version patch
@git commit pyproject.toml -m "Bump version"
.PHONY: bump-minor
bump-minor:
@poetry version minor
@git commit pyproject.toml -m "Bump version"
.PHONY: bump-major
bump-major:
@poetry version major
@git commit pyproject.toml -m "Bump version"
.PHONY: build
build:
@poetry build
.PHONY: push
push:
@git push origin main
.PHONY: clean
clean:
-rm -rf dist/*
.PHONY: release
release:
@VERSION=$$(poetry version | cut -d' ' -f2) && gh release create $${VERSION} dist/*
.PHONY: all-patch
all-patch: bump-patch clean build push release
.PHONY: all-minor
all-minor: bump-minor clean build push release
.PHONY: all-major
all-major: bump-major clean build push release
.PHONY: publish
publish:
poetry publish