-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (89 loc) · 2.47 KB
/
Makefile
File metadata and controls
102 lines (89 loc) · 2.47 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
# ==============================
# Project Configuration Section
# ==============================
PROJECT_NAME := rongcloud-server-mcp-python
MODULE_NAME := rongcloud_server_mcp
VENV_DIR := .venv
PYTHON := python3
UV := uv
MCP := mcp
# ==============================
# Environment Management
# ==============================
.PHONY: venv
venv:
@echo "Creating virtual environment using uv..."
@if [ ! -d "$(VENV_DIR)" ]; then \
$(UV) venv $(VENV_DIR); \
else \
echo "Virtual environment already exists at $(VENV_DIR)"; \
fi
@echo "\nActivate with:\nsource $(VENV_DIR)/bin/activate # Linux/macOS\n.\\$(VENV_DIR)\\Scripts\\activate # Windows"
# Sync all dependencies (including dev and extras)
.PHONY: sync
sync: venv
ifeq ($(MODE),prod)
@echo "Syncing PRODUCTION dependencies..."
@$(UV) sync
else
@echo "Syncing DEVELOPMENT dependencies..."
@$(UV) sync --dev
endif
# Install project in editable mode with development dependencies (default)
# or production mode if MODE=prod is set
.PHONY: install
install: venv
ifeq ($(MODE),prod)
@echo "Installing project in production mode..."
@$(UV) pip install .
else
@echo "Installing project in development mode..."
@$(UV) pip install -e ".[dev]"
endif
# ==============================
# Development Workflow
# ==============================
.PHONY: dev
dev:
@. $(VENV_DIR)/bin/activate && $(MCP) dev src/$(MODULE_NAME)/server.py
.PHONY: format
format:
@. $(VENV_DIR)/bin/activate && \
ruff format src/ tests/ && \
ruff format src/ tests/
# ==============================
# Testing & Quality Assurance
# ==============================
.PHONY: test
test:
@. $(VENV_DIR)/bin/activate && pytest -v tests/
.PHONY: lint
lint:
@. $(VENV_DIR)/bin/activate && ruff check src/ tests/
.PHONY: fix
fix:
@. $(VENV_DIR)/bin/activate && ruff check src/ tests/ --fix
# ==============================
# Build & Release
# ==============================
.PHONY: build
build:
@. $(VENV_DIR)/bin/activate && $(UV) pip install --upgrade build
@$(UV) run scripts/update_version.py
@$(UV) run python -m build
.PHONY: publish
publish: build
@. $(VENV_DIR)/bin/activate && $(UV) pip install --upgrade twine
@twine upload dist/*
# ==============================
# Cleanup
# ==============================
.PHONY: clean
clean:
@rm -rf build/ dist/ *.egg-info/
@rm -rf $(VENV_DIR)
@find . -type d -name '__pycache__' -exec rm -rf {} +
@find . -type f -name '*.pyc' -delete
.PHONY: uninstall
uninstall:
@. $(VENV_DIR)/bin/activate && $(UV) pip uninstall $(PROJECT_NAME)