-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,55 @@ | ||
# Colors for pretty output | ||
BLUE := \033[36m | ||
BOLD := \033[1m | ||
RESET := \033[0m | ||
|
||
.DEFAULT_GOAL := help | ||
|
||
SHELL=/bin/bash | ||
.PHONY: help verify install fmt test marimo clean | ||
|
||
##@ Development Setup | ||
|
||
venv: | ||
@printf "$(BLUE)Creating virtual environment...$(RESET)\n" | ||
@curl -LsSf https://astral.sh/uv/install.sh | sh | ||
@uv venv --python 3.12 | ||
|
||
UNAME=$(shell uname -s) | ||
install: venv ## Install all dependencies using uv | ||
@printf "$(BLUE)Installing dependencies...$(RESET)\n" | ||
@uv sync --dev --frozen | ||
|
||
.PHONY: install | ||
install: ## Install a virtual environment | ||
@poetry install -vv --all-extras | ||
##@ Code Quality | ||
|
||
.PHONY: fmt | ||
fmt: ## Run autoformatting and linting | ||
@poetry run pre-commit run --all-files | ||
fmt: venv ## Run code formatting and linting | ||
@printf "$(BLUE)Running formatters and linters...$(RESET)\n" | ||
@uv pip install pre-commit | ||
@uv run pre-commit install | ||
@uv run pre-commit run --all-files | ||
|
||
.PHONY: test | ||
test: install ## Run tests | ||
@poetry run pytest | ||
##@ Testing | ||
|
||
.PHONY: clean | ||
clean: ## Clean up caches and build artifacts | ||
@git clean -X -d -f | ||
test: install ## Run all tests | ||
@printf "$(BLUE)Running tests...$(RESET)\n" | ||
@uv pip install pytest | ||
@uv run pytest src/tests | ||
|
||
##@ Cleanup | ||
|
||
.PHONY: coverage | ||
coverage: install ## test and coverage | ||
@poetry run coverage run --source=cvx/. -m pytest | ||
@poetry run coverage report -m | ||
@poetry run coverage html | ||
clean: ## Clean generated files and directories | ||
@printf "$(BLUE)Cleaning project...$(RESET)\n" | ||
@git clean -d -X -f | ||
|
||
@if [ ${UNAME} == "Darwin" ]; then \ | ||
open htmlcov/index.html; \ | ||
elif [ ${UNAME} == "linux" ]; then \ | ||
xdg-open htmlcov/index.html 2> /dev/null; \ | ||
fi | ||
##@ Marimo & Jupyter | ||
|
||
.PHONY: tree | ||
tree: install ## make a tree | ||
@poetry show --tree | ||
jupyter: install ## Start a Jupyter server | ||
@printf "$(BLUE)Start Jupyter server...$(RESET)\n" | ||
@uv pip install jupyterlab | ||
@uv run jupyter lab | ||
|
||
.PHONY: help | ||
help: ## Display this help screen | ||
@echo -e "\033[1mAvailable commands:\033[0m" | ||
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort | ||
##@ Help | ||
|
||
.PHONY: jupyter | ||
jupyter: install ## Run jupyter lab | ||
@poetry run pip install jupyterlab | ||
@poetry run jupyter lab | ||
help: ## Display this help message | ||
@printf "$(BOLD)Usage:$(RESET)\n" | ||
@printf " make $(BLUE)<target>$(RESET)\n\n" | ||
@printf "$(BOLD)Targets:$(RESET)\n" | ||
@awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_-]+:.*?##/ { printf " $(BLUE)%-15s$(RESET) %s\n", $$1, $$2 } /^##@/ { printf "\n$(BOLD)%s$(RESET)\n", substr($$0, 5) }' $(MAKEFILE_LIST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters