@@ -15,7 +15,6 @@ GIT_TAG = `git describe --tags || echo "no version info"`
1515AUTHOR = $(USER )
1616
1717# Imports the environment variables
18- # # TODO if we call the file .env, then it'll be read by pipenv too
1918# # which is good for running migrate
2019# ifneq ("$(wildcard .env)","")
2120# include .env
@@ -25,22 +24,24 @@ AUTHOR = $(USER)
2524# export
2625# endif
2726
27+ # Env file for dockerrun, defaults to .env.local / .env
28+ export UV_ENV_FILE ?= $(if $(wildcard .env) ,.env,.env.default)
29+
2830# Django specific
2931APP_SRC_DIR := app
3032DJANGO_MANAGER := $(CURRENT_DIR ) /$(APP_SRC_DIR ) /manage.py
3133DJANGO_MANAGER_DEBUG := -m debugpy --listen localhost:5678 --wait-for-client $(CURRENT_DIR ) /$(APP_SRC_DIR ) /manage.py
3234
3335# Commands
34- PIPENV_RUN := pipenv run
35- PYTHON := $(PIPENV_RUN ) python3
36- TEST := $(PIPENV_RUN ) pytest
37- YAPF := $(PIPENV_RUN ) yapf
38- ISORT := $(PIPENV_RUN ) isort
39- PYLINT := $(PIPENV_RUN ) pylint
40- MYPY := $(PIPENV_RUN ) mypy
36+ UV_RUN := uv run
37+ PYTHON := $(UV_RUN )
38+ TEST := $(UV_RUN ) pytest
39+ RUFF := $(UV_RUN ) ruff
40+ ISORT := $(UV_RUN ) isort
41+ MYPY := $(UV_RUN ) mypy
4142PSQL := PGPASSWORD=postgres psql -h localhost -p 15433 -U postgres
4243PGRESTORE := PGPASSWORD=postgres pg_restore -h localhost -p 15433 -U postgres
43- BANDIT := $(PIPENV_RUN ) bandit
44+ BANDIT := $(UV_RUN ) bandit
4445
4546# Find all python files that are not inside a hidden directory (directory starting with .)
4647PYTHON_FILES := $(shell find $(APP_SRC_DIR ) -type f -name "* .py" -print)
@@ -52,34 +53,30 @@ DOCKER_IMG_LOCAL_TAG := $(DOCKER_REGISTRY)/$(SERVICE_NAME):local-$(USER)-$(GIT_H
5253# AWS variables
5354AWS_DEFAULT_REGION = eu-central-1
5455
55- # Env file for dockerrun, defaults to .env.local / .env
56- ENV_FILE ?= $(if $(wildcard .env.local) ,.env.local,.env)
57-
5856.PHONY : ci
5957ci :
6058 # Create virtual env with all packages for development using the Pipfile.lock
61- pipenv sync --dev
59+ uv sync --dev
6260
6361.PHONY : setup
6462setup : $(SETTINGS_TIMESTAMP ) # # Create virtualenv with all packages for development
65- pipenv install --dev
63+ uv sync --dev
6664 cp .env.default .env
67- pipenv shell
6865
6966.PHONY : format
7067format : # # Call yapf to make sure your code is easier to read and respects some conventions.
71- $(YAPF ) -p -i --style .style.yapf $( PYTHON_FILES )
68+ $(RUFF ) format ${ PYTHON_FILES}
7269 $(ISORT ) $(PYTHON_FILES )
7370
7471
7572.PHONY : django-checks
7673django-checks : # # Run the django checks
77- $(PYTHON ) $(DJANGO_MANAGER ) check --fail-level WARNING
74+ $(UV_RUN ) $(DJANGO_MANAGER ) check --fail-level WARNING
7875
7976.PHONY : django-check-migrations
8077django-check-migrations : # # Check the migrations
8178 @echo " Check for missing migration files"
82- $(PYTHON ) $(DJANGO_MANAGER ) makemigrations --no-input --check
79+ $(UV_RUN ) $(DJANGO_MANAGER ) makemigrations --no-input --check
8380
8481
8582.PHONY : ci-check-format
@@ -140,7 +137,7 @@ dockerrun: dockerbuild ## Run the locally built docker image
140137.PHONY : lint
141138lint : # # Run the linter on the code base
142139 @echo " Run pylint..."
143- LOGGING_CFG=0 $(PYLINT ) $(PYTHON_FILES )
140+ LOGGING_CFG=0 $(RUFF ) check $(PYTHON_FILES )
144141
145142.PHONY : type-check
146143type-check : # # Run the type-checker mypy
0 commit comments