|
2 | 2 |
|
3 | 3 | DOTENV_OVERRIDE_FILE ?= .env |
4 | 4 |
|
5 | | -POETRY_VERSION ?= 2.1.3 |
6 | | - |
7 | 5 | COMPOSE_FILE ?= docker/docker-compose.local.yml |
8 | 6 | COMPOSE_PROJECT_NAME ?= flagsmith-common |
| 7 | +UV_ALL_EXTRAS ?= true |
9 | 8 |
|
10 | 9 | -include $(DOTENV_OVERRIDE_FILE) |
11 | 10 |
|
12 | | -.PHONY: install-pip |
13 | | -install-pip: |
14 | | - python -m pip install --upgrade pip |
| 11 | +.PHONY: install-packages |
| 12 | +install-packages: ## Install all required packages |
| 13 | + uv sync $(opts) |
15 | 14 |
|
16 | | -.PHONY: install-poetry |
17 | | -install-poetry: |
18 | | - curl -sSL https://install.python-poetry.org | python3 - --version ${POETRY_VERSION} |
| 15 | +.PHONY: install-pre-commit ## Install pre-commit hooks |
| 16 | +install-pre-commit: |
| 17 | + uv run pre-commit install |
19 | 18 |
|
20 | | -.PHONY: install-packages |
21 | | -install-packages: |
22 | | - poetry install $(opts) |
| 19 | +.PHONY: ensure-dotenv |
| 20 | +ensure-dotenv: ## Create an .env file suitable for running tests |
| 21 | + @if [ ! -f .env ]; then cp .env-ci .env; echo ".env file created from .env-ci. Please update it with your settings."; fi |
23 | 22 |
|
24 | 23 | .PHONY: install |
25 | | -install: install-pip install-poetry install-packages |
| 24 | +install: install-packages install-pre-commit ensure-dotenv ## Ensure the environment is set up |
26 | 25 |
|
27 | 26 | .PHONY: lint |
28 | | -lint: |
29 | | - poetry run pre-commit run -a |
| 27 | +lint: ## Run linters |
| 28 | + uv run pre-commit run --all-files |
30 | 29 |
|
31 | 30 | .PHONY: docker-up |
32 | | -docker-up: |
| 31 | +docker-up: ## Start Docker containers |
33 | 32 | docker compose up --force-recreate --remove-orphans -d |
34 | 33 | docker compose ps |
35 | 34 |
|
36 | 35 | .PHONY: docker-down |
37 | | -docker-down: |
| 36 | +docker-down: ## Stop Docker containers |
38 | 37 | docker compose down |
39 | 38 |
|
40 | 39 | .PHONY: test |
41 | | -test: |
42 | | - poetry run pytest $(opts) |
| 40 | +test: docker-up ## Run all tests |
| 41 | + uv run pytest $(opts) |
43 | 42 |
|
44 | 43 | .PHONY: typecheck |
45 | | -typecheck: |
46 | | - poetry run mypy . |
| 44 | +typecheck: ## Run mypy |
| 45 | + uv run mypy src tests |
47 | 46 |
|
48 | 47 | .PHONY: django-make-migrations |
49 | | -django-make-migrations: |
50 | | - poetry run python manage.py waitfordb |
51 | | - poetry run python manage.py makemigrations $(opts) |
| 48 | +django-make-migrations: ## Create new migrations based on the changes detected to your models |
| 49 | + uv run python manage.py waitfordb |
| 50 | + uv run python manage.py makemigrations $(opts) |
52 | 51 |
|
53 | 52 | .PHONY: django-squash-migrations |
54 | | -django-squash-migrations: |
55 | | - poetry run python manage.py waitfordb |
56 | | - poetry run python manage.py squashmigrations $(opts) |
| 53 | +django-squash-migrations: ## Squash migrations for apps |
| 54 | + uv run python manage.py waitfordb |
| 55 | + uv run python manage.py squashmigrations $(opts) |
57 | 56 |
|
58 | 57 | .PHONY: django-migrate |
59 | | -django-migrate: |
60 | | - poetry run python manage.py waitfordb |
61 | | - poetry run python manage.py migrate |
62 | | - poetry run python manage.py createcachetable |
| 58 | +django-migrate: ## Apply migrations to the database |
| 59 | + uv run python manage.py waitfordb |
| 60 | + uv run python manage.py migrate |
| 61 | + uv run python manage.py createcachetable |
| 62 | + |
| 63 | +help: |
| 64 | + @echo "Usage: make [target]" |
| 65 | + @echo "" |
| 66 | + @echo "Available targets:" |
| 67 | + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
0 commit comments