Skip to content

Commit 94530c0

Browse files
authored
Enhance Makefile with clean and deptry targets
Added clean and deptry targets to the Makefile.
1 parent 2d1b58a commit 94530c0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ RESET := \033[0m
2121
.PHONY: install install-uv test fmt
2222

2323
UV_INSTALL_DIR := ./bin
24+
TESTS_FOLDER := tests
25+
SOURCE_FOLDER := pypfopt
2426

2527
##@ Bootstrap
2628
install-uv: ## ensure uv (and uvx) are installed locally
@@ -39,6 +41,17 @@ install: install-uv ## install
3941
@printf "${BLUE}[INFO] Installing dependencies${RESET}\n"
4042
@./bin/uv sync --all-extras --frozen || { printf "${RED}[ERROR] Failed to install dependencies${RESET}\n"; exit 1; }
4143

44+
clean: ## clean
45+
@printf "${BLUE}Cleaning project...${RESET}\n"
46+
# do not clean .env files
47+
@git clean -d -X -f -e .env -e '.env.*'
48+
@rm -rf dist build *.egg-info .coverage .pytest_cache
49+
@printf "${BLUE}Removing local branches with no remote counterpart...${RESET}\n"
50+
@git fetch --prune
51+
@git branch -vv \
52+
| grep ': gone]' \
53+
| awk '{print $1}' \
54+
| xargs -r git branch -D 2>/dev/null || true
4255

4356
##@ Development and Testing
4457
test: install ## run all tests
@@ -49,7 +62,9 @@ test: install ## run all tests
4962

5063
fmt: install-uv ## check the pre-commit hooks and the linting
5164
@./bin/uvx pre-commit run --all-files
52-
@./bin/uvx deptry .
65+
66+
deptry: install-uv ## run deptry if pyproject.toml exists
67+
@./bin/uvx deptry "${SOURCE_FOLDER}"
5368

5469
##@ Meta
5570
help: ## Display this help message

0 commit comments

Comments
 (0)