-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
226 lines (182 loc) · 7.24 KB
/
Makefile
File metadata and controls
226 lines (182 loc) · 7.24 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Cost Katana Python SDK - Development Makefile
.PHONY: help install install-dev test lint format clean build upload upload-test docs examples
help: ## Show this help message
@echo "Cost Katana Python SDK - Available Commands:"
@echo "============================================="
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
install: ## Install the package in development mode
pip install -e .
install-dev: ## Install development dependencies
pip install -e .
pip install -r requirements-dev.txt
test: ## Run tests
python3 -m pytest tests/ -v --cov=cost_katana --cov-report=html --cov-report=term
test-examples: ## Test example scripts
@echo "Testing example scripts..."
python3 -m py_compile examples/*.py
@echo "✅ All examples compile successfully"
lint: ## Run linting
flake8 cost_katana/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 cost_katana/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
format: ## Format code
black cost_katana/
black examples/
isort cost_katana/
isort examples/
type-check: ## Run type checking
mypy cost_katana/ --ignore-missing-imports
clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf htmlcov/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
build: ## Build package
python3 -m build
upload-test: ## Upload to TestPyPI
python3 -m twine upload --repository testpypi dist/*
upload: ## Upload to PyPI
python3 -m twine upload dist/*
docs: ## Generate documentation
@echo "Generating documentation..."
python3 -c "import cost_katana; help(cost_katana)" > docs/api_reference.txt
@echo "✅ Documentation generated in docs/"
demo: ## Run interactive demo
python3 examples/basic_usage.py
demo-chat: ## Run chat demo
python3 examples/chat_session.py
demo-comparison: ## Run provider comparison demo
python3 examples/provider_comparison.py
demo-config: ## Run configuration demo
python3 examples/config_example.py
demo-old-vs-new: ## Run old vs new comparison
python3 examples/old_vs_new.py
setup-config: ## Create sample configuration
@echo "Creating sample configuration..."
@echo '{' > config.json
@echo ' "api_key": "dak_your_api_key_here",' >> config.json
@echo ' "base_url": "https://api.costkatana.com",' >> config.json
@echo ' "default_model": "gemini-2.0-flash",' >> config.json
@echo ' "default_temperature": 0.7,' >> config.json
@echo ' "cost_limit_per_day": 50.0,' >> config.json
@echo ' "enable_optimization": true,' >> config.json
@echo ' "enable_failover": true' >> config.json
@echo '}' >> config.json
@echo "✅ Created config.json - edit with your API key"
cli-init: ## Initialize CLI configuration
cost-katana init
cli-test: ## Test CLI connection
cost-katana test
cli-models: ## List available models via CLI
cost-katana models
cli-chat: ## Start CLI chat session
cost-katana chat
verify-install: ## Verify installation
@echo "Verifying Cost Katana installation..."
python3 -c "import cost_katana; print(f'✅ Cost Katana {cost_katana.__version__} installed successfully')"
python3 -c "from cost_katana import GenerativeModel, configure; print('✅ All imports working')"
@echo "🚀 Ready to use Cost Katana!"
check-deps: ## Check dependencies
pip check
pip list --outdated
# Development workflow commands
dev-setup: install-dev setup-config ## Complete development setup
@echo "🚀 Development environment ready!"
@echo "Next steps:"
@echo " 1. Edit config.json with your API key"
@echo " 2. Run: make verify-install"
@echo " 3. Run: make demo"
release-check: clean lint type-check test build ## Pre-release checks
@echo "✅ Release checks passed!"
# CI/CD helpers
ci-test: ## Run tests for CI
python3 -m pytest tests/ -v --cov=cost_katana --cov-report=xml
# Package info
info: ## Show package information
@echo "Cost Katana Python SDK"
@echo "====================="
@echo "Version: $(shell python3 -c 'import cost_katana; print(cost_katana.__version__)')"
@echo "Location: $(shell python3 -c 'import cost_katana; print(cost_katana.__file__)')"
@echo "Dependencies: $(shell pip freeze | grep -E '(requests|httpx|pydantic|rich)' | wc -l) core packages"
@echo ""
@echo "🌐 Website: https://costkatana.com"
@echo "📚 Docs: https://docs.costkatana.com"
@echo "💬 Discord: https://discord.gg/D8nDArmKbY"
# Quick start for new users
# CI/CD helpers
ci-test: ## Run tests for CI
python3 -m pytest tests/ -v --cov=cost_katana --cov-report=xml
ci-lint: ## Run linting for CI
flake8 cost_katana/ --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 cost_katana/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
ci-format: ## Run format check for CI
black --check cost_katana/
black --check examples/
ci-type: ## Run type checking for CI
mypy cost_katana/ --ignore-missing-imports
ci-build: ## Build package for CI
python3 -m build
ci-check: ## Check package for CI
python3 -m twine check dist/*
ci-security: ## Run security checks
pip install safety bandit
safety check --full-report
bandit -r cost_katana/ -f txt
# Release helpers
release-prepare: ## Prepare a new release
@echo "🚀 Preparing release..."
@./scripts/prepare-release.sh
release-push: ## Push release to GitHub
@echo "📤 Pushing release to GitHub..."
git push origin main
git push --tags
release-full: release-prepare release-push ## Complete release process
release-patch: ## Bump patch version and release (e.g., 2.0.7 -> 2.0.8)
@echo "🔖 Bumping patch version..."
@python3 scripts/bump_version.py patch
@VERSION=$$(grep -o 'version="[^"]*"' setup.py | cut -d'"' -f2); \
git add setup.py && \
git commit -m "chore: bump version to $$VERSION" && \
git tag v$$VERSION && \
git push origin master --follow-tags && \
echo "✅ Released v$$VERSION"
release-minor: ## Bump minor version and release (e.g., 2.0.7 -> 2.1.0)
@echo "🔖 Bumping minor version..."
@python3 scripts/bump_version.py minor
@VERSION=$$(grep -o 'version="[^"]*"' setup.py | cut -d'"' -f2); \
git add setup.py && \
git commit -m "chore: bump version to $$VERSION" && \
git tag v$$VERSION && \
git push origin master --follow-tags && \
echo "✅ Released v$$VERSION"
release-major: ## Bump major version and release (e.g., 2.0.7 -> 3.0.0)
@echo "🔖 Bumping major version..."
@python3 scripts/bump_version.py major
@VERSION=$$(grep -o 'version="[^"]*"' setup.py | cut -d'"' -f2); \
git add setup.py && \
git commit -m "chore: bump version to $$VERSION" && \
git tag v$$VERSION && \
git push origin master --follow-tags && \
echo "✅ Released v$$VERSION"
quick-start: ## Quick start guide
@echo "🚀 Cost Katana Python SDK - Quick Start"
@echo "========================================"
@echo ""
@echo "1. Install the package:"
@echo " pip install cost-katana"
@echo ""
@echo "2. Get your API key:"
@echo " Visit: https://costkatana.com/integrations"
@echo ""
@echo "3. Configure:"
@echo " cost-katana init"
@echo ""
@echo "4. Test:"
@echo " cost-katana test"
@echo ""
@echo "5. Start chatting:"
@echo " cost-katana chat"
@echo ""
@echo "🔗 Full documentation: https://docs.costkatana.com"