-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (99 loc) · 3.69 KB
/
Copy pathMakefile
File metadata and controls
135 lines (99 loc) · 3.69 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
# Makefile for d365fo-client Python package
# Use this with 'make <target>' on Unix-like systems or 'mingw32-make <target>' on Windows
.PHONY: help install install-dev test test-verbose lint format type-check quality-check clean build publish dev-setup run docs-build docs-serve pre-commit all
# Default target
help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Development setup
dev-setup: ## Set up development environment
uv sync
uv add --dev pytest black isort mypy ruff pre-commit
@echo "Development environment setup complete!"
install: ## Install package dependencies
uv sync
install-dev: ## Install package with development dependencies
uv sync --dev
# Code quality
format: ## Format code with black and isort
uv run black .
uv run isort .
@echo "Code formatting complete!"
format-check: ## Check code formatting without making changes
uv run black --check .
uv run isort --check-only .
lint: ## Run linting with ruff
uv run ruff check .
lint-fix: ## Run linting with automatic fixes
uv run ruff check --fix .
type-check: ## Run type checking with mypy
uv run mypy src/
quality-check: format-check lint type-check ## Run all code quality checks
# Testing
test: ## Run tests
uv run pytest
test-unit: ## Run unit tests only
uv run pytest tests/unit
test-integration: ## Run integration tests only
uv run pytest tests/integration
test-verbose: ## Run tests with verbose output
uv run pytest -v
test-coverage: ## Run tests with coverage report
uv run pytest --cov=d365fo_client --cov-report=html --cov-report=term
test-watch: ## Run tests in watch mode (requires pytest-watch)
uv run ptw
# Building and publishing
clean: ## Clean build artifacts
rm -rf dist/
rm -rf build/
rm -rf *.egg-info/
rm -rf src/*.egg-info/
find . -type d -name __pycache__ -delete
find . -type f -name "*.pyc" -delete
find . -type d -name .pytest_cache -delete
find . -type d -name .mypy_cache -delete
build: clean ## Build package
uv build
publish-test: build ## Publish to Test PyPI
uv publish --repository testpypi
publish: build ## Publish to PyPI
uv publish
# Development commands
run: ## Run the application
uv run d365fo-client
shell: ## Open Python shell with package installed
uv run python
# Pre-commit hooks
pre-commit-install: ## Install pre-commit hooks
uv run pre-commit install
pre-commit: ## Run pre-commit hooks on all files
uv run pre-commit run --all-files
# Documentation (if using sphinx)
docs-build: ## Build documentation
@echo "Documentation build not configured yet"
docs-serve: ## Serve documentation locally
@echo "Documentation serve not configured yet"
# Comprehensive targets
all: quality-check test build ## Run quality checks, tests, and build
ci: install-dev quality-check test ## Run CI pipeline (install, quality checks, tests)
release-patch: ## Bump patch version and create release
@echo "Release automation not implemented yet"
release-minor: ## Bump minor version and create release
@echo "Release automation not implemented yet"
release-major: ## Bump major version and create release
@echo "Release automation not implemented yet"
# Security
security-check: ## Run security checks
uv run pip-audit
# Environment info
info: ## Show environment information
@echo "Python version:"
uv run python --version
@echo "\nPackage version:"
uv run python -c "import d365fo_client; print(d365fo_client.__version__)"
@echo "\nInstalled packages:"
uv pip list
# Quick development workflow
dev: format lint type-check test ## Quick development check (format, lint, type-check, test)
# Help ensure targets are not confused with files
.SUFFIXES: