-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (76 loc) · 2.9 KB
/
Copy pathMakefile
File metadata and controls
99 lines (76 loc) · 2.9 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
89
90
91
92
93
94
95
96
97
98
99
.PHONY: help install update build publish run clean test test-fast test-short test-clean genbadge-coverage genbadge-tests badges docs readme black ruff lint
# Variables
PATH_SRC = data_validate
PYTHON = poetry run python
PYTEST = poetry run pytest
COVERAGE = poetry run coverage
# 1. Help command
help: ## Shows available commands
@echo "Data Validate - Available commands:"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
# 2. Install dependencies
install: ## Install development dependencies
rm -rf poetry.lock
poetry install
update: ## Update dependencies to latest versions
rm -rf poetry.lock
poetry update
poetry update --only=dev
configure-auto-update: # Configure Poetry plugins
poetry self add poetry-plugin-up
auto-update:
poetry up --latest
build: ## Build the package
rm -rf dist/
poetry build
publish: readme ## Build and Publish the package to PyPI
rm -rf dist/
poetry build
poetry run twine upload --repository testpypi dist/*
poetry run twine upload dist/*
# 3. Run main script
run: ## Execute main pipeline script
bash scripts/run_main_pipeline.sh
clean: test-clean ## Remove output data in data/output/
rm -rf data/output/
rm -rf data/temp/
rm -rf docs/
rm -rf assets/coverage/
rm -rf dist/
# 4. Testing and coverage (using pyproject.toml configuration)
test: ## Run all tests with coverage (uses pyproject.toml config)
$(PYTEST)
test-fast: ## Run tests quickly (no coverage, fail fast)
$(PYTEST) -x --no-cov
test-short: ## Run tests showing only the name of the tested file
$(PYTEST) -q --tb=short
test-clean: ## Remove temporary files and reports
rm -rf .coverage
rm -rf dev-reports/
rm -rf .pytest_cache/
rm -rf __pycache__/
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
# 5. Badges
genbadge-coverage: ## Generate coverage badge
@mkdir -p assets/coverage
poetry run genbadge coverage -i dev-reports/coverage.xml -o assets/coverage/coverage_badge.svg
genbadge-tests: ## Generate tests badge
@mkdir -p assets/coverage
poetry run genbadge tests --input-file dev-reports/junit/junit.xml -o assets/coverage/tests_badge.svg
badges: genbadge-coverage genbadge-tests ## Generate all badges
# 6. Documentation
docs: ## Generate documentation with pdoc
rm -rf docs/
poetry run pdoc ./$(PATH_SRC)/ -o ./docs --logo "https://avatars.githubusercontent.com/u/141270342?s=400&v=4"
readme: ## Generate README documentation
$(PYTHON) $(PATH_SRC)/helpers/tools/readme/generate_readme.py
# 7. Code formatting and linting
black: ## Format code with black
poetry run black $(PATH_SRC) tests
ruff: ## Lint and fix code with ruff
poetry run ruff check . --fix
lint: black ruff ## Run all linting tools
exec: ## Execute main pipeline script
python3 data_validate/main.py --o data/output/temp/ --i data/input/data_ground_truth_01/