-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (57 loc) · 2.1 KB
/
Copy pathMakefile
File metadata and controls
88 lines (57 loc) · 2.1 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
86
87
88
VERSION ?= $(shell cat VERSION)
PYPI_REPO ?= https://test.pypi.org/
check-tag = !(git rev-parse -q --verify "refs/tags/v${VERSION}" > /dev/null 2>&1) || \
(echo "the version: ${VERSION} has been released already" && exit 1)
.PHONY: help
help: ## Get help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: install
install: ## Install locally from current directory
pip install -e ."[dev]"
.PHONY: test
test: ## Run basic unit tests
python -m unittest discover --verbose tests
# pytest -vv tests
.PHONY: test-doctests
test-doctests: ## Test test_*.txt docstring tests in tests/doctests/
python -m unittest discover -v tests -k doctests
.PHONY: test-documentation
test-documentation: ## Test all docstrings in the source
python -m unittest discover tests -k test_doc
.PHONY: test-typecheck
test-typecheck: ## Run type checker on tests to verify FST typing
mypy tests/*.py
.PHONY: coverage
coverage: ## Get test coverage
pytest -v --cov=fst --cov-report=html tests
.PHONY: lint
lint: ## Lint stuff
ruff check --output-format=concise
.PHONY: regen-tests
regen-tests: ## Regenerate test data
python tests/test_fst.py --regen-all
python tests/test_parse.py --regen-all
python tests/test_one.py --regen-all
python tests/test_slice.py --regen-all
python tests/test_match.py --regen-all
.PHONY: docs
docs: ## Compile documentation
python make_docs.py
.PHONY: clean
clean: ## Delete all generated files and directories
rm -rf build/ dist/ src/pfst.egg-info/
find . -name __pycache__ -type d -exec rm -rf {} +
.PHONY: check-version
check-version: ## Check if VERSION has already been released/tagged
@$(check-tag)
.PHONY: publish
publish: ## Tag git commit with VERSION and push
@$(check-tag)
git tag v${VERSION}
git push origin v${VERSION}
.PHONY: build-wheel
build-wheel: ## Build python wheel
python -m build --wheel
.PHONY: publish-wheel
publish-wheel: ## Publish python wheel
TWINE_USERNAME=${PYPI_USERNAME} TWINE_PASSWORD=${PYPI_API_KEY} twine upload --repository-url ${PYPI_REPO} dist/*