-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (69 loc) · 2.26 KB
/
Makefile
File metadata and controls
81 lines (69 loc) · 2.26 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
.PHONY: help install install-dev test lint format clean build bump-patch bump-minor publish upload
# Default target
help:
@echo "Available targets:"
@echo " install Install the package"
@echo " install-dev Install the package with dev dependencies"
@echo " test Run tests"
@echo " lint Run linting"
@echo " format Format code"
@echo " clean Clean build artifacts"
@echo " build Build the package"
@echo " bump-patch Bump patch version (0.1.2 -> 0.1.3)"
@echo " bump-minor Bump minor version (0.1.2 -> 0.2.0)"
@echo " publish Bump version, build and publish to PyPI"
@echo " upload Upload to PyPI (alias for publish)"
# Install the package
install:
pip3 install -e .
# Install with dev dependencies
install-dev:
pip3 install -e ".[dev]"
# Run tests
test:
python3 -m pytest
# Run linting
lint:
ruff check .
mypy pyqual
# Format code
format:
ruff format .
# Clean build artifacts
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
find . -type d -name __pycache__ -not -path "./.venv/*" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -not -path "./.venv/*" -delete
# Build the package
build: clean
python3 -m build
# Bump patch version (0.1.2 -> 0.1.3)
bump-patch:
@echo "Bumping patch version..."
@CURRENT=$$(cat VERSION); \
MAJOR=$$(echo $$CURRENT | cut -d. -f1); \
MINOR=$$(echo $$CURRENT | cut -d. -f2); \
PATCH=$$(echo $$CURRENT | cut -d. -f3); \
NEW_PATCH=$$((PATCH + 1)); \
NEW_VERSION="$$MAJOR.$$MINOR.$$NEW_PATCH"; \
echo "$$NEW_VERSION" > VERSION; \
sed -i "s/version = \"$$CURRENT\"/version = \"$$NEW_VERSION\"/" pyproject.toml; \
echo "Version bumped: $$CURRENT -> $$NEW_VERSION"
# Bump minor version (0.1.2 -> 0.2.0)
bump-minor:
@echo "Bumping minor version..."
@CURRENT=$$(cat VERSION); \
MAJOR=$$(echo $$CURRENT | cut -d. -f1); \
MINOR=$$(echo $$CURRENT | cut -d. -f2); \
NEW_MINOR=$$((MINOR + 1)); \
NEW_VERSION="$$MAJOR.$$NEW_MINOR.0"; \
echo "$$NEW_VERSION" > VERSION; \
sed -i "s/version = \"$$CURRENT\"/version = \"$$NEW_VERSION\"/" pyproject.toml; \
echo "Version bumped: $$CURRENT -> $$NEW_VERSION"
# Build and publish to PyPI (auto-bumps patch version)
publish: bump-patch build
python3 -m twine upload dist/*
# Upload to PyPI (alias)
upload: publish