1- SHELL := /bin/bash
2-
3- # -----------------------------------------------------------------------------
4- # Display Formatting and Colors
5- # -----------------------------------------------------------------------------
6- BLUE := $(shell printf "\033[1;34m")
7- GREEN := $(shell printf "\033[1;32m")
8- RED := $(shell printf "\033[1;31m")
9- YELLOW := $(shell printf "\033[1;33m")
10- NC := $(shell printf "\033[0m")
11- INFO := $(shell printf "$(BLUE ) ℹ$(NC ) ")
12- OK := $(shell printf "$(GREEN ) ✓$(NC ) ")
13- WARN := $(shell printf "$(YELLOW ) ⚠$(NC ) ")
14- ERROR := $(shell printf "$(RED ) ✖$(NC ) ")
15-
16- # =============================================================================
17- # Configuration and Environment Variables
18- # =============================================================================
191.DEFAULT_GOAL: =help
202.ONESHELL :
21- .EXPORT_ALL_VARIABLES :
22- MAKEFLAGS += --no-print-directory
23-
24- USING_NPM = $(shell python3 -c "if __import__('pathlib') .Path('package-lock.json').exists(): print('yes')")
25- ENV_PREFIX =.venv/bin/
26- VENV_EXISTS = $(shell python3 -c "if __import__('pathlib') .Path('.venv/bin/activate').exists(): print('yes')")
27- NODE_MODULES_EXISTS = $(shell python3 -c "if __import__('pathlib') .Path('node_modules').exists(): print('yes')")
28- BUILD_DIR =dist
29- COLLECTOR_PACKAGE =sql-scripts
30- BASE_DIR =$(shell pwd)
31-
3+ VENV_EXISTS =$(shell python3 -c "if __import__('pathlib') .Path('.venv/bin/activate').exists(): print('yes')")
4+ VERSION := $(shell grep -m 1 current_version .bumpversion.cfg | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
5+ BUILD_DIR =dist
6+ COLLECTOR_PACKAGE =sql-scripts
7+ BASE_DIR =$(shell pwd)
8+
329.EXPORT_ALL_VARIABLES :
3310
3411ifndef VERBOSE
@@ -38,46 +15,15 @@ endif
3815REPO_INFO ?= $(shell git config --get remote.origin.url)
3916COMMIT_SHA ?= git-$(shell git rev-parse --short HEAD)
4017
41- # =============================================================================
42- # Help and Documentation
43- # =============================================================================
44-
4518help : # # Display this help
4619 @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
4720
48- # =============================================================================
49- # Developer Utils
50- # =============================================================================
51- install-pipx : # # Install pipx
52- @python3 -m pip install --upgrade --user pipx
53-
54- install-hatch : # # Install Hatch, UV, and Ruff
55- @sh ./tools/install-hatch.sh
56-
57- configure-hatch : # # Configure Hatch defaults
58- @hatch config set dirs.env.virtual .direnv
59- @hatch config set dirs.env.pip-compile .direnv
60-
61- upgrade-hatch : # # Update Hatch, UV, and Ruff
62- @hatch self update
63-
21+ .PHONY : install
6422install : # # Install the project in dev mode.
65- @if [ " $( VENV_EXISTS) " ]; then echo " => Removing existing virtual environment" ; $(MAKE ) destroy-venv; fi
66- @$(MAKE ) clean
67- @if ! hatch --version > /dev/null; then echo ' => Installing `hatch`' ; $(MAKE ) install-hatch ; fi
68- @echo " => Creating Python environments..."
69- @$(MAKE ) configure-hatch
70- @hatch env create local
71- @echo " => Install complete! Note: If you want to re-install re-run 'make install'"
72- # .venv/bin/pip install -U wheel setuptools cython pip mypy sqlfluff && .venv/bin/pip install -U -r requirements.txt -r requirements-docs.txt
73-
74- .PHONY : upgrade
75- upgrade : # # Upgrade all dependencies to the latest stable versions
76- @echo " => Updating all dependencies"
77- @echo " => Python Dependencies Updated"
78- @hatch run lint:pre-commit autoupdate
79- @echo " => Updated Pre-commit"
80- @$(MAKE ) install
23+ @if [ " $( VENV_EXISTS) " ]; then source .venv/bin/activate; fi
24+ @if [ ! " $( VENV_EXISTS) " ]; then python3 -m venv .venv && source .venv/bin/activate; fi
25+ .venv/bin/pip install -U wheel setuptools cython pip mypy sqlfluff && .venv/bin/pip install -U -r requirements.txt -r requirements-docs.txt
26+ @echo " => Build environment installed successfully. ** If you want to re-install or update, 'make install'"
8127
8228.PHONY : clean
8329clean : # # Cleanup temporary build artifacts
@@ -92,21 +38,6 @@ clean: ## Cleanup temporary build a
9238 @find . -name ' .ipynb_checkpoints' -exec rm -rf {} + > /dev/null 2>&1
9339 @echo " ${OK} Working directory cleaned"
9440
95- deep-clean : clean destroy-venv destroy-node_modules # # Clean everything up
96- @hatch python remove all
97- @echo " => Hatch environments pruned and python installations trimmed"
98- @uv cache clean
99- @echo " => UV Cache cleaned successfully"
100-
101- destroy-venv : # # Destroy the virtual environment
102- @hatch env prune
103- @hatch env remove lint
104- @rm -Rf .venv
105- @rm -Rf .direnv
106-
107- destroy-node_modules : # # Destroy the node environment
108- @rm -rf node_modules .astro
109-
11041.PHONY : clean-sqlscripts
11142clean-sqlscripts :
11243 @echo " => Cleaning previous build artifacts for sql scripts..."
@@ -163,14 +94,6 @@ package-sqlscripts:
16394.PHONY : build
16495build : build-sqlscripts # # Build and package the collectors
16596
166- .PHONY : pre-release
167- pre-release : # # bump the version and create the release tag
168- make docs
169- make clean
170- hatch run local:bump2version $(increment )
171- head .bumpversion.cfg | grep ^current_version
172- make build
173-
17497
17598# ##############
17699# docs #
@@ -200,4 +123,10 @@ docs: ## generate HTML documentation and serve it to the browser
200123 ./.venv/bin/mkdocs build
201124 ./.venv/bin/mkdocs serve
202125
203-
126+ .PHONY : pre-release
127+ pre-release : # # bump the version and create the release tag
128+ make gen-docs
129+ make clean
130+ .venv/bin/bump2version $(increment )
131+ head .bumpversion.cfg | grep ^current_version
132+ make build
0 commit comments