Skip to content

Commit

Permalink
new Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Feb 4, 2025
1 parent c3d5b0f commit 6283d0a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 40 deletions.
77 changes: 42 additions & 35 deletions Makefile
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)
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ dependencies = [
"scikit-learn>=1.6.1",
]


[tool.poetry.dependencies]
cvxsimulator = "*"
scikit-learn = "*"

[tool.poetry.dev-dependencies]
pytest = "8.3.4"
pytest-cov = "*"
Expand Down

0 comments on commit 6283d0a

Please sign in to comment.