Skip to content

Commit 2006f4e

Browse files
committed
Refine Makefile
1 parent dd5b98b commit 2006f4e

File tree

1 file changed

+64
-22
lines changed

1 file changed

+64
-22
lines changed

Makefile

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NetGraph-Core Development Makefile
22

3-
.PHONY: help venv clean-venv dev install check check-ci lint format test qt clean build info hooks cov cpp-test rebuild check-python sanitize-test
3+
.PHONY: help venv clean-venv dev install check check-ci lint format test qt build clean check-dist publish-test publish info hooks check-python cpp-test cov sanitize-test rebuild
44

55
.DEFAULT_GOAL := help
66

@@ -36,22 +36,36 @@ DEFAULT_MACOSX := 15.0
3636

3737
help:
3838
@echo "🔧 NetGraph-Core Development Commands"
39-
@echo " make venv - Create a local virtualenv (./venv)"
40-
@echo " make dev - Install dev deps and pre-commit"
41-
@echo " make install - Editable install (no dev deps)"
42-
@echo " make check - Pre-commit (auto-fix) + C++/Python tests, then lint"
43-
@echo " make check-ci - Non-mutating lint + tests (CI entrypoint)"
44-
@echo " make lint - Ruff + Pyright"
45-
@echo " make format - Ruff format"
46-
@echo " make test - Run pytest"
47-
@echo " make qt - Quick tests (exclude slow/benchmark if marked)"
48-
@echo " make cov - Coverage summary + XML + single-page combined HTML"
49-
@echo " make build - Build wheel"
50-
@echo " make clean - Clean build artifacts"
51-
@echo " make hooks - Run pre-commit on all files"
52-
@echo " make info - Show tool versions"
53-
@echo " make check-python - Check if venv Python matches best available"
54-
@echo " make rebuild - Clean and rebuild (respects CMAKE_ARGS)"
39+
@echo ""
40+
@echo "Setup & Installation:"
41+
@echo " make venv - Create a local virtualenv (./venv)"
42+
@echo " make dev - Full development environment (package + dev deps + hooks)"
43+
@echo " make install - Install package for usage (no dev dependencies)"
44+
@echo " make clean-venv - Remove virtual environment"
45+
@echo " make rebuild - Clean and rebuild (respects CMAKE_ARGS)"
46+
@echo ""
47+
@echo "Code Quality & Testing:"
48+
@echo " make check - Run pre-commit (auto-fix) + C++/Python tests, then lint"
49+
@echo " make check-ci - Run non-mutating lint + tests (CI entrypoint)"
50+
@echo " make lint - Run only linting (non-mutating: ruff + pyright)"
51+
@echo " make format - Auto-format code with ruff"
52+
@echo " make test - Run tests with coverage"
53+
@echo " make qt - Run quick tests only (exclude slow/benchmark)"
54+
@echo " make cpp-test - Build and run C++ tests"
55+
@echo " make cov - Coverage summary + XML + single-page combined HTML"
56+
@echo " make sanitize-test - Build and run C++ tests with sanitizers"
57+
@echo ""
58+
@echo "Build & Package:"
59+
@echo " make build - Build distribution packages"
60+
@echo " make clean - Clean build artifacts and cache files"
61+
@echo " make check-dist - Check distribution packages with twine"
62+
@echo " make publish-test - Publish to Test PyPI"
63+
@echo " make publish - Publish to PyPI"
64+
@echo ""
65+
@echo "Utilities:"
66+
@echo " make info - Show project information"
67+
@echo " make hooks - Run pre-commit on all files"
68+
@echo " make check-python - Check if venv Python matches best available"
5569

5670
# Allow callers to pass CMAKE_ARGS and MACOSX_DEPLOYMENT_TARGET consistently
5771
ENV_MACOS := $(if $(MACOSX_DEPLOYMENT_TARGET),MACOSX_DEPLOYMENT_TARGET=$(MACOSX_DEPLOYMENT_TARGET),MACOSX_DEPLOYMENT_TARGET=$(DEFAULT_MACOSX))
@@ -134,15 +148,43 @@ build:
134148
exit 1; \
135149
fi
136150

151+
check-dist:
152+
@echo "🔍 Checking distribution packages..."
153+
@if $(PYTHON) -c "import twine" >/dev/null 2>&1; then \
154+
$(PYTHON) -m twine check dist/*; \
155+
else \
156+
echo "❌ twine not installed. Install dev dependencies with: make dev"; \
157+
exit 1; \
158+
fi
159+
160+
publish-test:
161+
@echo "📦 Publishing to Test PyPI..."
162+
@if $(PYTHON) -c "import twine" >/dev/null 2>&1; then \
163+
$(PYTHON) -m twine upload --repository testpypi dist/*; \
164+
else \
165+
echo "❌ twine not installed. Install dev dependencies with: make dev"; \
166+
exit 1; \
167+
fi
168+
169+
publish:
170+
@echo "🚀 Publishing to PyPI..."
171+
@if $(PYTHON) -c "import twine" >/dev/null 2>&1; then \
172+
$(PYTHON) -m twine upload dist/*; \
173+
else \
174+
echo "❌ twine not installed. Install dev dependencies with: make dev"; \
175+
exit 1; \
176+
fi
177+
137178
clean:
138179
@echo "🧹 Cleaning build artifacts and cache files..."
139180
@rm -rf build/ dist/ *.egg-info/ || true
140-
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
141-
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
142-
@find . -type f -name "*.pyo" -delete 2>/dev/null || true
143-
@rm -f .coverage coverage-*.xml coverage-*.html || true
144-
@rm -rf htmlcov-python || true
181+
@rm -rf .pytest_cache .ruff_cache .mypy_cache htmlcov htmlcov-python .coverage coverage.xml coverage-*.xml .benchmarks .pytest-benchmark || true
145182
@rm -rf Testing CTestTestfile.cmake || true
183+
@find . -path "./venv" -prune -o -type f -name "*.pyc" -delete 2>/dev/null || true
184+
@find . -path "./venv" -prune -o -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
185+
@find . -path "./venv" -prune -o -type f -name "*.pyo" -delete 2>/dev/null || true
186+
@find . -path "./venv" -prune -o -type f -name "*~" -delete 2>/dev/null || true
187+
@find . -path "./venv" -prune -o -type f -name "*.orig" -delete 2>/dev/null || true
146188
@echo "✅ Cleanup complete!"
147189

148190
info:

0 commit comments

Comments
 (0)