-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (122 loc) · 4.06 KB
/
Makefile
File metadata and controls
143 lines (122 loc) · 4.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# AsymmeTree Makefile
# Python project automation for development, testing, and deployment
.PHONY: help install install-dev test lint format clean build publish run dev-run check-deps update-deps venv interactive run-custom-example
# Default target
help:
@echo "AsymmeTree Development Makefile"
@echo ""
@echo "Available targets:"
@echo " help Show this help message"
@echo " install Install project dependencies"
@echo " install-dev Install development dependencies"
@echo " test Run tests"
@echo " lint Run linting checks"
@echo " format Format code with black and isort"
@echo " clean Clean up build artifacts and cache files"
@echo " build Build the package"
@echo " publish Publish to PyPI"
@echo " run Run the main application"
@echo " dev-run Run in development mode"
@echo " check-deps Check for outdated dependencies"
@echo " update-deps Update dependencies"
@echo " venv Create virtual environment"
@echo " interactive Run in interactive mode"
@echo " run-custom-example Run with a custom dataset"
# Variables
PYTHON := python3
PIP := pip
PACKAGE_NAME := asymmetree
VENV_DIR := .venv
# Virtual environment creation
venv:
@echo "Creating virtual environment..."
$(PYTHON) -m venv $(VENV_DIR)
@echo "Virtual environment created. Activate with: source $(VENV_DIR)/bin/activate"
# Install project dependencies
install:
@echo "Installing project dependencies..."
$(PIP) install -e .
# Install development dependencies
install-dev:
@echo "Installing development dependencies..."
$(PIP) install -e .[dev]
$(PIP) install pytest pytest-cov black isort flake8 mypy pre-commit
# Run tests
test:
@echo "Running tests..."
pytest tests/ -v --cov=$(PACKAGE_NAME) --cov-report=html --cov-report=term
# Run linting checks
lint:
@echo "Running linting checks..."
flake8 $(PACKAGE_NAME)/ main.py
mypy $(PACKAGE_NAME)/ main.py
@echo "Linting completed!"
# Format code
format:
@echo "Formatting code..."
black $(PACKAGE_NAME)/ main.py
isort $(PACKAGE_NAME)/ main.py
@echo "Code formatting completed!"
# Clean up build artifacts and cache
clean:
@echo "Cleaning up..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf htmlcov/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.coverage" -delete
find . -type f -name ".coverage" -delete
@echo "Cleanup completed!"
# Build the package
build: clean
@echo "Building package..."
$(PYTHON) -m build
@echo "Package built successfully!"
# Publish to PyPI
publish: build
@echo "Publishing to PyPI..."
$(PYTHON) -m twine upload dist/*
@echo "Package published!"
# Run the main application
run:
@echo "Running AsymmeTree in demo mode..."
$(PYTHON) main.py demo
# Run in development mode with verbose output
dev-run:
@echo "Running AsymmeTree in development mode (demo)..."
$(PYTHON) -v main.py demo
# Run in interactive mode
interactive:
@echo "Running AsymmeTree in interactive mode..."
$(PYTHON) main.py interactive
# Example of a custom run. Users should modify this.
run-custom-example:
@echo "Running AsymmeTree with a custom dataset..."
# Create a dummy data file for the example
@echo "target,feature1,feature2" > dummy_data.csv
@echo "1,10,20" >> dummy_data.csv
@echo "0,15,25" >> dummy_data.csv
$(PYTHON) main.py custom --data dummy_data.csv --target target --max-depth 3
@rm dummy_data.csv
# Check for outdated dependencies
check-deps:
@echo "Checking for outdated dependencies..."
$(PIP) list --outdated
# Update dependencies
update-deps:
@echo "Updating dependencies..."
$(PIP) install --upgrade -r requirements.txt
@echo "Dependencies updated!"
# Run all quality checks
quality: lint test
@echo "All quality checks completed!"
# Setup development environment
setup-dev: venv install-dev
@echo "Development environment setup completed!"
@echo "Remember to activate the virtual environment: source $(VENV_DIR)/bin/activate"
# Quick development cycle: format, lint, and test
dev-cycle: format lint test
@echo "Development cycle completed!"