-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
133 lines (94 loc) · 3.46 KB
/
Makefile
File metadata and controls
133 lines (94 loc) · 3.46 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
.PHONY: help install install-dev format lint type-check test test-cov test-integration clean docs build publish
# Default Python version
PYTHON := python3.11
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install: ## Install the package in development mode
pip install -e .
install-dev: ## Install development dependencies
pip install -e .[test,dev]
install-all: ## Install all dependencies including docs
pip install -e .[test,dev,docs]
format: ## Format code with ruff
ruff format src/ tests/
lint: ## Lint code with ruff
ruff check src/ tests/
lint-fix: ## Fix linting issues automatically
ruff check --fix src/ tests/
type-check: ## Run type checking with mypy
mypy src/
test: ## Run tests
pytest
test-unit: ## Run only unit tests
pytest -m unit
test-integration: ## Run only integration tests
pytest -m integration
test-cov: ## Run tests with coverage
pytest --cov=src/pyairtable_shared --cov-report=html --cov-report=term
test-cov-xml: ## Run tests with XML coverage report
pytest --cov=src/pyairtable_shared --cov-report=xml
test-fast: ## Run tests in parallel
pytest -n auto
clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .ruff_cache/
rm -rf htmlcov/
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
docs: ## Build documentation
cd docs && mkdocs build
docs-serve: ## Serve documentation locally
cd docs && mkdocs serve
build: clean ## Build package
python -m build
publish-test: build ## Publish to test PyPI
twine upload --repository testpypi dist/*
publish: build ## Publish to PyPI
twine upload dist/*
pre-commit: format lint type-check test ## Run all pre-commit checks
ci: install-dev format lint type-check test-cov ## Run CI pipeline locally
setup-pre-commit: ## Setup pre-commit hooks
pre-commit install
docker-build: ## Build Docker image for testing
docker build -t pyairtable-shared:test .
docker-test: ## Run tests in Docker
docker run --rm pyairtable-shared:test make test
# Database commands
db-upgrade: ## Run database migrations
alembic upgrade head
db-downgrade: ## Rollback database migration
alembic downgrade -1
db-revision: ## Create new database migration
alembic revision --autogenerate -m "$(message)"
db-reset: ## Reset database (DROP ALL TABLES)
@echo "WARNING: This will drop all tables. Continue? [y/N]" && read ans && [ $${ans:-N} = y ]
alembic downgrade base
alembic upgrade head
# Testing with different environments
test-postgres: ## Run tests with PostgreSQL
TEST_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/test_pyairtable pytest
test-redis: ## Run tests with Redis
TEST_REDIS_URL=redis://localhost:6379/1 pytest
# Utility commands
requirements: ## Generate requirements.txt from pyproject.toml
pip-compile pyproject.toml
security-check: ## Run security checks
bandit -r src/
complexity-check: ## Check code complexity
radon cc src/ -a -nc
profile: ## Profile test performance
pytest --profile
benchmark: ## Run performance benchmarks
pytest tests/benchmarks/ -v
# Development helpers
shell: ## Start interactive Python shell with package loaded
python -c "from pyairtable_shared import *; import IPython; IPython.start_ipython()"
version: ## Show package version
python -c "from pyairtable_shared import __version__; print(__version__)"