-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (58 loc) · 2.27 KB
/
Copy pathMakefile
File metadata and controls
76 lines (58 loc) · 2.27 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
######################################################################
# YamlDB Makefile
######################################################################
# Variables
PYTHON := python
PIP := $(PYTHON) -m pip
PACKAGE_NAME := $(shell basename $(CURDIR))
VERSION_FILE := VERSION
GIT := git
.PHONY: help install pip clean reinstall version test test-html test-cov setup-test uninstall-all check-syntax
help:
@echo
@echo "Makefile for YamlDB:"
@echo
@echo " version - Display current version from $(VERSION_FILE)"
@echo " install - Install in editable mode for local development"
@echo " pip - Install dependencies and package"
@echo " reinstall - Clean and reinstall locally"
@echo " clean - Remove build artifacts, cache, and test debris"
@echo " test - Run pytest suite with HTML report"
@echo " test-cov - Run pytest with coverage report"
@echo " setup-test - Install test deps"
@echo " check-syntax - Check YAML syntax for a file (usage: make check-syntax FILE=path/to/file.yaml)"
@echo
# --- VERSION MANAGEMENT ---
version:
@cat $(VERSION_FILE)
# --- DEVELOPMENT & TESTING ---
check-syntax:
@if [ -z "$(FILE)" ]; then echo "Error: FILE variable is required. Usage: make check-syntax FILE=yourfile.yaml"; exit 1; fi
$(PYTHON) -c "from yamldb.util import print_yaml_errors; print_yaml_errors('$(FILE)')"
install: pip
pip:
$(PIP) install -e .
requirements:
pip-compile --output-file=requirements.txt pyproject.toml
test:
$(PYTHON) -m pytest -v
test-html:
$(PYTHON) -m pytest -v --html=.report.html
open .report.html
test-cov:
pytest --cov=yamldb --cov-report=term-missing tests/
setup-test:
$(PIP) install pytest pytest-mock pytest-cov pytest-html
# --- CLEANUP & REINSTALL ---
uninstall-all:
@echo "Searching for installed yamldb packages..."
@$(PIP) freeze | grep "yamldb" | cut -d'=' -f1 | xargs $(PIP) uninstall -y || echo "No yamldb packages found."
clean:
@echo "Cleaning artifacts and temporary test plugins..."
rm -rf build/ dist/ *.egg-info .pytest_cache .coverage .report.html
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
rm -rf tmp/yamldb-*
reinstall: uninstall-all clean
@echo "Performing fresh install..."
$(PIP) install -e .